import { useTranslation } from 'react-i18next' import * as eventTracking from '../../../../infrastructure/event-tracking' 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, downloadPath, } = useFileTreeActionable() const createWithAnalytics = () => { eventTracking.sendMB('new-file-click', { location: 'file-menu' }) startCreatingDocOrFile() } const uploadWithAnalytics = () => { eventTracking.sendMB('upload-click', { location: 'file-menu' }) startUploadingDocOrFile() } return ( <> {canRename ? ( {t('rename')} ) : null} {downloadPath ? ( {t('download')} ) : null} {canDelete ? ( {t('delete')} ) : null} {canCreate ? ( <> {t('new_file')} {t('new_folder')} {t('upload')} ) : null} ) } export default FileTreeItemMenuItems