import React from 'react'
import { useTranslation } from 'react-i18next'
import Icon from '../../../shared/components/icon'
import TooltipButton from '../../../shared/components/tooltip-button'
import { useFileTreeMainContext } from '../contexts/file-tree-main'
import { useFileTreeActionable } from '../contexts/file-tree-actionable'
function FileTreeToolbar() {
const { hasWritePermissions } = useFileTreeMainContext()
if (!hasWritePermissions) return null
return (
)
}
function FileTreeToolbarLeft() {
const { t } = useTranslation()
const {
canCreate,
startCreatingFolder,
startCreatingDocOrFile,
startUploadingDocOrFile,
} = useFileTreeActionable()
if (!canCreate) return null
return (
)
}
function FileTreeToolbarRight() {
const { t } = useTranslation()
const {
canRename,
canDelete,
startRenaming,
startDeleting,
} = useFileTreeActionable()
if (!canRename && !canDelete) {
return null
}
return (
{canRename ? (
) : null}
{canDelete ? (
) : null}
)
}
export default FileTreeToolbar