2020-11-26 09:22:30 -05:00
|
|
|
import { useTranslation } from 'react-i18next'
|
|
|
|
|
|
|
|
import { MenuItem } from 'react-bootstrap'
|
|
|
|
import { useFileTreeActionable } from '../../contexts/file-tree-actionable'
|
|
|
|
|
|
|
|
function FileTreeItemMenuItems() {
|
|
|
|
const { t } = useTranslation()
|
|
|
|
|
|
|
|
const {
|
|
|
|
canRename,
|
|
|
|
canDelete,
|
|
|
|
canCreate,
|
|
|
|
startRenaming,
|
|
|
|
startDeleting,
|
|
|
|
startCreatingFolder,
|
|
|
|
startCreatingDocOrFile,
|
2021-04-27 03:52:58 -04:00
|
|
|
startUploadingDocOrFile,
|
2022-08-12 05:54:32 -04:00
|
|
|
downloadPath,
|
2020-11-26 09:22:30 -05:00
|
|
|
} = useFileTreeActionable()
|
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
{canRename ? (
|
|
|
|
<MenuItem onClick={startRenaming}>{t('rename')}</MenuItem>
|
|
|
|
) : null}
|
2022-08-12 05:54:32 -04:00
|
|
|
{downloadPath ? (
|
|
|
|
<MenuItem href={downloadPath}>{t('download')}</MenuItem>
|
|
|
|
) : null}
|
2020-11-26 09:22:30 -05:00
|
|
|
{canDelete ? (
|
|
|
|
<MenuItem onClick={startDeleting}>{t('delete')}</MenuItem>
|
|
|
|
) : null}
|
|
|
|
{canCreate ? (
|
|
|
|
<>
|
|
|
|
<MenuItem divider />
|
|
|
|
<MenuItem onClick={startCreatingDocOrFile}>{t('new_file')}</MenuItem>
|
|
|
|
<MenuItem onClick={startCreatingFolder}>{t('new_folder')}</MenuItem>
|
|
|
|
<MenuItem onClick={startUploadingDocOrFile}>{t('upload')}</MenuItem>
|
|
|
|
</>
|
|
|
|
) : null}
|
|
|
|
</>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default FileTreeItemMenuItems
|