|
|
@@ -8,7 +8,11 @@ import { usePermissionsContext } from '@/features/ide-react/context/permissions-
|
|
|
import FileTreeActionButton from './file-tree-action-button'
|
|
|
import { useRailContext } from '../../contexts/rail-context'
|
|
|
|
|
|
-export default function FileTreeActionButtons() {
|
|
|
+export default function FileTreeActionButtons({
|
|
|
+ fileTreeExpanded,
|
|
|
+}: {
|
|
|
+ fileTreeExpanded: boolean
|
|
|
+}) {
|
|
|
const { t } = useTranslation()
|
|
|
const { fileTreeReadOnly } = useFileTreeData()
|
|
|
const { write } = usePermissionsContext()
|
|
|
@@ -72,37 +76,41 @@ export default function FileTreeActionButtons() {
|
|
|
|
|
|
return (
|
|
|
<div className="file-tree-toolbar-action-buttons">
|
|
|
- {canCreate && (
|
|
|
- <FileTreeActionButton
|
|
|
- id="new-file"
|
|
|
- description={t('new_file')}
|
|
|
- onClick={createWithAnalytics}
|
|
|
- iconType="note_add"
|
|
|
- />
|
|
|
- )}
|
|
|
- {canCreate && (
|
|
|
- <FileTreeActionButton
|
|
|
- id="new-folder"
|
|
|
- description={t('new_folder')}
|
|
|
- onClick={startCreatingFolder}
|
|
|
- iconType="create_new_folder"
|
|
|
- />
|
|
|
- )}
|
|
|
- {canCreate && (
|
|
|
- <FileTreeActionButton
|
|
|
- id="upload"
|
|
|
- description={t('upload')}
|
|
|
- onClick={uploadWithAnalytics}
|
|
|
- iconType="upload"
|
|
|
- />
|
|
|
- )}
|
|
|
- {canBulkDelete && (
|
|
|
- <FileTreeActionButton
|
|
|
- id="delete"
|
|
|
- description={t('delete')}
|
|
|
- onClick={startDeleting}
|
|
|
- iconType="delete"
|
|
|
- />
|
|
|
+ {fileTreeExpanded && (
|
|
|
+ <>
|
|
|
+ {canCreate && (
|
|
|
+ <FileTreeActionButton
|
|
|
+ id="new-file"
|
|
|
+ description={t('new_file')}
|
|
|
+ onClick={createWithAnalytics}
|
|
|
+ iconType="note_add"
|
|
|
+ />
|
|
|
+ )}
|
|
|
+ {canCreate && (
|
|
|
+ <FileTreeActionButton
|
|
|
+ id="new-folder"
|
|
|
+ description={t('new_folder')}
|
|
|
+ onClick={startCreatingFolder}
|
|
|
+ iconType="create_new_folder"
|
|
|
+ />
|
|
|
+ )}
|
|
|
+ {canCreate && (
|
|
|
+ <FileTreeActionButton
|
|
|
+ id="upload"
|
|
|
+ description={t('upload')}
|
|
|
+ onClick={uploadWithAnalytics}
|
|
|
+ iconType="upload"
|
|
|
+ />
|
|
|
+ )}
|
|
|
+ {canBulkDelete && (
|
|
|
+ <FileTreeActionButton
|
|
|
+ id="delete"
|
|
|
+ description={t('delete')}
|
|
|
+ onClick={startDeleting}
|
|
|
+ iconType="delete"
|
|
|
+ />
|
|
|
+ )}
|
|
|
+ </>
|
|
|
)}
|
|
|
<FileTreeActionButton
|
|
|
id="close"
|