mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
1be43911b4
Set Prettier's "trailingComma" setting to "es5" GitOrigin-RevId: 9f14150511929a855b27467ad17be6ab262fe5d5
41 lines
1.1 KiB
JavaScript
41 lines
1.1 KiB
JavaScript
import React from 'react'
|
|
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,
|
|
startUploadingDocOrFile,
|
|
} = useFileTreeActionable()
|
|
|
|
return (
|
|
<>
|
|
{canRename ? (
|
|
<MenuItem onClick={startRenaming}>{t('rename')}</MenuItem>
|
|
) : null}
|
|
{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
|