diff --git a/.changeset/remove-broken-upload-file-button.md b/.changeset/remove-broken-upload-file-button.md new file mode 100644 index 000000000..ef866f6ec --- /dev/null +++ b/.changeset/remove-broken-upload-file-button.md @@ -0,0 +1,5 @@ +--- +"@inkeep/open-knowledge": patch +--- + +Remove the broken "Upload file" button from the file sidebar. This drops the upload-via-file-picker entry points: the sidebar toolbar button, the folder and empty-area right-click menu items, and the empty-state button. Drag-and-drop file upload onto the file tree is unchanged. diff --git a/packages/app/src/components/FileSidebar.dom.test.tsx b/packages/app/src/components/FileSidebar.dom.test.tsx index 4b4d4a117..f04384b28 100644 --- a/packages/app/src/components/FileSidebar.dom.test.tsx +++ b/packages/app/src/components/FileSidebar.dom.test.tsx @@ -92,7 +92,6 @@ const treeCalls = { expandAll: mock(() => {}), startCreating: mock((_kind: 'file' | 'folder', _parentDir: string) => {}), startCreatingFromTemplate: mock((_parentDir: string) => {}), - uploadFiles: mock((_parentDir: string) => {}), }; const projectLocalPatch = mock((_patch: unknown) => projectPatchResult); const showItemInFolderMock = mock((_path: string) => Promise.resolve()); @@ -144,7 +143,6 @@ mock.module('@/components/FileTree', () => ({ treeListeners.add(listener); return () => treeListeners.delete(listener); }, - uploadFiles: treeCalls.uploadFiles, }; ref?.(handle); return () => ref?.(null); @@ -402,7 +400,6 @@ describe('FileSidebar runtime behavior', () => { treeCalls.expandAll, treeCalls.startCreating, treeCalls.startCreatingFromTemplate, - treeCalls.uploadFiles, projectLocalPatch, showItemInFolderMock, notifyViewMenuStateChangedMock, @@ -489,11 +486,9 @@ describe('FileSidebar runtime behavior', () => { fireEvent.click(screen.getAllByRole('button', { name: 'New from template' })[0]); fireEvent.click(screen.getByRole('button', { name: 'Daily' })); fireEvent.click(screen.getAllByRole('button', { name: 'New folder' })[0]); - fireEvent.click(screen.getAllByRole('button', { name: 'Upload file' })[0]); expect(treeCalls.startCreating).toHaveBeenCalledWith('file', 'docs'); expect(treeCalls.createFromTemplate).toHaveBeenCalledWith('docs', 'daily'); expect(treeCalls.startCreating).toHaveBeenCalledWith('folder', 'docs'); - expect(treeCalls.uploadFiles).toHaveBeenCalledWith('docs'); expect(screen.getByRole('button', { name: 'Expand all' })).toBeTruthy(); expect(screen.getByRole('button', { name: 'Collapse all' })).toBeTruthy(); @@ -520,7 +515,6 @@ describe('FileSidebar runtime behavior', () => { 'empty-space-menu-new-file', 'empty-space-menu-new-from-template', 'empty-space-menu-new-folder', - 'empty-space-menu-upload-file', 'empty-space-menu-reveal-in-finder', 'open-in-agent-empty-space-submenu', 'empty-space-menu-copy-full-path', @@ -539,11 +533,9 @@ describe('FileSidebar runtime behavior', () => { fireEvent.click(screen.getByTestId('empty-space-menu-new-from-template')); fireEvent.click(screen.getByRole('menuitem', { name: 'Root daily' })); fireEvent.click(screen.getByTestId('empty-space-menu-new-folder')); - fireEvent.click(screen.getByTestId('empty-space-menu-upload-file')); expect(treeCalls.startCreating).toHaveBeenCalledWith('file', ''); expect(treeCalls.createFromTemplate).toHaveBeenCalledWith('', 'root-daily'); expect(treeCalls.startCreating).toHaveBeenCalledWith('folder', ''); - expect(treeCalls.uploadFiles).toHaveBeenCalledWith(''); fireEvent.click(screen.getByTestId('empty-space-menu-reveal-in-finder')); expect(showItemInFolderMock).toHaveBeenCalledWith('/tmp/open-knowledge'); diff --git a/packages/app/src/components/FileSidebar.menu-action.dom.test.tsx b/packages/app/src/components/FileSidebar.menu-action.dom.test.tsx index d81b1b4e0..7000a63fb 100644 --- a/packages/app/src/components/FileSidebar.menu-action.dom.test.tsx +++ b/packages/app/src/components/FileSidebar.menu-action.dom.test.tsx @@ -65,7 +65,6 @@ const treeCalls = { expandAll: mock(() => {}), startCreating: mock((_kind: 'file' | 'folder', _parentDir: string) => {}), startCreatingFromTemplate: mock((_parentDir: string) => {}), - uploadFiles: mock((_parentDir: string) => {}), }; const projectLocalPatch = mock((_patch: unknown) => ({ ok: true as const })); let menuActionCallback: ((action: MenuAction) => void) | null = null; @@ -85,7 +84,6 @@ mock.module('@/components/FileTree', () => ({ startCreating: treeCalls.startCreating, startCreatingFromTemplate: treeCalls.startCreatingFromTemplate, subscribe: () => () => {}, - uploadFiles: treeCalls.uploadFiles, }; ref?.(handle); return () => ref?.(null); @@ -232,7 +230,6 @@ describe('FileSidebar menu-action runtime routing', () => { treeCalls.expandAll, treeCalls.startCreating, treeCalls.startCreatingFromTemplate, - treeCalls.uploadFiles, ]) { fn.mockClear(); } diff --git a/packages/app/src/components/FileSidebar.tsx b/packages/app/src/components/FileSidebar.tsx index 777cfd66e..3d55be52d 100644 --- a/packages/app/src/components/FileSidebar.tsx +++ b/packages/app/src/components/FileSidebar.tsx @@ -9,7 +9,6 @@ import { ListCollapse, SquarePen, UnfoldVertical, - Upload, } from 'lucide-react'; import { type ComponentProps, type FC, type MouseEventHandler, useEffect, useState } from 'react'; import { ErrorBoundary } from 'react-error-boundary'; @@ -208,10 +207,6 @@ function FileSidebarInner({ onOpenSearch }: FileSidebarProps) { if (!workspace) return; tree?.startCreating('folder', ''); }; - const handleEmptySpaceUploadFile = () => { - if (!workspace) return; - tree?.uploadFiles(''); - }; const handleEmptySpaceReveal = () => { if (!workspace || !bridge) return; void bridge.shell.showItemInFolder(workspace.contentDir); @@ -544,11 +539,6 @@ function FileSidebarInner({ onOpenSearch }: FileSidebarProps) { label={t`New folder`} onClick={() => tree?.startCreating('folder', initialCreateDir)} /> - tree?.uploadFiles(initialCreateDir)} - /> {/* @@ -662,12 +652,12 @@ function FileSidebarInner({ onOpenSearch }: FileSidebarProps) { {/* - * Empty-space menu — 12 items, 4 sections. + * Empty-space menu — 11 items, 4 sections. * - * Section 1: Creation and upload (always visible). New file / from + * Section 1: Creation (always visible). New file / from * template / folder dispatch the project-root creation flow - * (parentDir = '' → contentDir). Upload opens the project-root file - * picker. Disabled when workspace hasn't resolved. + * (parentDir = '' → contentDir). Disabled when workspace hasn't + * resolved. * * Section 2: Act-on-project. Reveal in Finder * is Electron-only (`if (!bridge) return null`); Open with AI submenu @@ -719,14 +709,6 @@ function FileSidebarInner({ onOpenSearch }: FileSidebarProps) {