feat: add selected file size in context menu (#1224)

This commit is contained in:
Aman Harwara
2022-07-07 15:51:16 +05:30
committed by GitHub
parent 6ebac52cb0
commit 50c024e643
2 changed files with 10 additions and 2 deletions

View File

@@ -8,6 +8,7 @@ import { useCloseOnBlur } from '@/Hooks/useCloseOnBlur'
import { PopoverFileSubmenuProps } from './PopoverFileItemProps' import { PopoverFileSubmenuProps } from './PopoverFileItemProps'
import { PopoverFileItemActionType } from './PopoverFileItemAction' import { PopoverFileItemActionType } from './PopoverFileItemAction'
import HorizontalSeparator from '../Shared/HorizontalSeparator' import HorizontalSeparator from '../Shared/HorizontalSeparator'
import { formatSizeToReadableString } from '@standardnotes/filepicker'
const PopoverFileSubmenu: FunctionComponent<PopoverFileSubmenuProps> = ({ const PopoverFileSubmenu: FunctionComponent<PopoverFileSubmenuProps> = ({
file, file,
@@ -188,9 +189,12 @@ const PopoverFileSubmenu: FunctionComponent<PopoverFileSubmenuProps> = ({
<span className="text-danger">Delete permanently</span> <span className="text-danger">Delete permanently</span>
</button> </button>
<div className="px-3 py-1 text-xs font-medium text-neutral"> <div className="px-3 py-1 text-xs font-medium text-neutral">
<div> <div className="mb-1">
<span className="font-semibold">File ID:</span> {file.uuid} <span className="font-semibold">File ID:</span> {file.uuid}
</div> </div>
<div>
<span className="font-semibold">Size:</span> {formatSizeToReadableString(file.decryptedSize)}
</div>
</div> </div>
</> </>
)} )}

View File

@@ -7,6 +7,7 @@ import { observer } from 'mobx-react-lite'
import { FilesController } from '@/Controllers/FilesController' import { FilesController } from '@/Controllers/FilesController'
import { SelectedItemsController } from '@/Controllers/SelectedItemsController' import { SelectedItemsController } from '@/Controllers/SelectedItemsController'
import HorizontalSeparator from '../Shared/HorizontalSeparator' import HorizontalSeparator from '../Shared/HorizontalSeparator'
import { formatSizeToReadableString } from '@standardnotes/filepicker'
type Props = { type Props = {
closeMenu: () => void closeMenu: () => void
@@ -149,9 +150,12 @@ const FileMenuOptions: FunctionComponent<Props> = ({
</button> </button>
{selectedFiles.length === 1 && ( {selectedFiles.length === 1 && (
<div className="px-3 pt-1.5 pb-0.5 text-xs font-medium text-neutral"> <div className="px-3 pt-1.5 pb-0.5 text-xs font-medium text-neutral">
<div> <div className="mb-1">
<span className="font-semibold">File ID:</span> {selectedFiles[0].uuid} <span className="font-semibold">File ID:</span> {selectedFiles[0].uuid}
</div> </div>
<div>
<span className="font-semibold">Size:</span> {formatSizeToReadableString(selectedFiles[0].decryptedSize)}
</div>
</div> </div>
)} )}
</> </>