Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

Add sidebar drag-and-drop uploads for external files (#1885)

Dimitri POSTOLOV5b28777bb50b
diff --git a/packages/app/package.json b/packages/app/package.json
index 93ef147fa..039bb03fe 100644
--- a/packages/app/package.json
+++ b/packages/app/package.json
@@ -43,7 +43,7 @@
{
"name": "main app bundle (gzipped)",
"path": "dist/assets/index-*.js",
- "limit": "405 kB",
+ "limit": "407 kB",
"gzip": true,
"running": false
},
diff --git a/packages/app/src/components/FileSidebar.dom.test.tsx b/packages/app/src/components/FileSidebar.dom.test.tsx
index ed8925337..c16e3fe60 100644
--- a/packages/app/src/components/FileSidebar.dom.test.tsx
+++ b/packages/app/src/components/FileSidebar.dom.test.tsx
@@ -92,6 +92,7 @@ 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 dispatchOpenInTerminalMock = mock((_bridge: unknown, _path: string) => Promise.resolve());
@@ -144,6 +145,7 @@ mock.module('@/components/FileTree', () => ({
treeListeners.add(listener);
return () => treeListeners.delete(listener);
},
+ uploadFiles: treeCalls.uploadFiles,
};
ref?.(handle);
return () => ref?.(null);
@@ -404,6 +406,7 @@ describe('FileSidebar runtime behavior', () => {
treeCalls.expandAll,
treeCalls.startCreating,
treeCalls.startCreatingFromTemplate,
+ treeCalls.uploadFiles,
projectLocalPatch,
dispatchOpenInTerminalMock,
showItemInFolderMock,
@@ -491,9 +494,11 @@ 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,6 +525,7 @@ 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-open-in-terminal',
@@ -539,9 +545,11 @@ 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 6c2c6c1fb..b19ea026f 100644
--- a/packages/app/src/components/FileSidebar.menu-action.dom.test.tsx
+++ b/packages/app/src/components/FileSidebar.menu-action.dom.test.tsx
@@ -66,6 +66,7 @@ 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,6 +86,7 @@ mock.module('@/components/FileTree', () => ({
startCreating: treeCalls.startCreating,
startCreatingFromTemplate: treeCalls.startCreatingFromTemplate,
subscribe: () => () => {},
+ uploadFiles: treeCalls.uploadFiles,
};
ref?.(handle);
return () => ref?.(null);
@@ -235,6 +237,7 @@ 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 9b9a15b00..9594b3ae5 100644
--- a/packages/app/src/components/FileSidebar.tsx
+++ b/packages/app/src/components/FileSidebar.tsx
@@ -10,6 +10,7 @@ import {
SquarePen,
Terminal,
UnfoldVertical,
+ Upload,
} from 'lucide-react';
import { type ComponentProps, type FC, type MouseEventHandler, useEffect, useState } from 'react';
import { ErrorBoundary } from 'react-error-boundary';
@@ -210,6 +211,10 @@ 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);
@@ -556,6 +561,11 @@ function FileSidebarInner({ onOpenSearch }: FileSidebarProps) {
label={t`New folder`}
onClick={() => tree?.startCreating('folder', initialCreateDir)}
/>
+ <ToolbarButton
+ icon={Upload}
+ label={t`Upload file`}
+ onClick={() => tree?.uploadFiles(initialCreateDir)}
+ />
</div>
</SidebarHeader>
{/*
@@ -669,11 +679,12 @@ function FileSidebarInner({ onOpenSearch }: FileSidebarProps) {
</ContextMenuTrigger>
<ContextMenuContent>
{/*
- * Empty-space menu — 11 items, 4 sections.
+ * Empty-space menu — 12 items, 4 sections.
*
- * Section 1: Creation (always visible). New file / from template /
- * folder dispatch the project-root creation flow (parentDir = ''
- * → contentDir). Disabled when workspace hasn't resolved.
+ * Section 1: Creation and upload (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.
*
* Section 2: Act-on-project. Reveal in Finder + Open in Terminal
* are Electron-only (`if (!bridge) return null`); Open with AI submenu
@@ -725,6 +736,14 @@ function FileSidebarInner({ onOpenSearch }: FileSidebarProps) {
<FolderPlus aria-hidden="true" />
<Trans>New folder</Trans>
</ContextMenuItem>
+ <ContextMenuItem
+ disabled={!workspace}
+ onSelect={handleEmptySpaceUploadFile}
+ data-testid="empty-space-menu-upload-file"
+ >
+ <Upload aria-hidden="true" />
+ <Trans>Upload file</Trans>
+ </ContextMenuItem>
<ContextMenuSeparator />
{bridge ? (
<ContextMenuItem
diff --git a/packages/app/src/components/FileTree.tsx b/packages/app/src/components/FileTree.tsx
index eb5a9ab64..2a322736f 100644
--- a/packages/app/src/components/FileTree.tsx
+++ b/packages/app/src/components/FileTree.tsx
@@ -14,6 +14,7 @@ import {
type OkignoreBinding,
RenamePathSuccessSchema,
TrashCleanupSuccessSchema,
+ UploadAssetSuccessSchema,
WorkspaceSuccessSchema,
} from '@inkeep/open-knowledge-core';
import { plural, t } from '@lingui/core/macro';
@@ -43,12 +44,14 @@ import {
Trash2,
TriangleAlert,
UnfoldVertical,
+ Upload,
} from 'lucide-react';
import { __iconNode as botIcon } from 'lucide-react/dist/esm/icons/bot';
import { __iconNode as link2Icon } from 'lucide-react/dist/esm/icons/link-2';
import { useTheme } from 'next-themes';
import {
type CSSProperties,
+ type DragEvent as ReactDragEvent,
type MouseEvent as ReactMouseEvent,
type ReactNode,
type Ref,
@@ -70,15 +73,21 @@ import {
docNameToTreePath,
documentsToTreePaths,
documentsTreePathSignature,
+ fileEntryFromUploadedPath,
fileEntryToTreePath,
+ filesFromExternalDrop,
folderPathToTreeDirectoryPath,
+ isExternalFileDrag,
normalizeTreePathForKind,
+ parentFolderPathForTreeItemDropTarget,
relativePathForTreeItem,
treeDirectoryPathToFolderPath,
treeFilePathToDocName,
treeItemToTarget,
treePathSignature,
treePathToAppPath,
+ uploadedPathForSidebarDrop,
+ uploadParentDocNameForFolderDrop,
} from '@/components/file-tree-adapter';
import {
applyExtensionBadges,
@@ -180,6 +189,7 @@ import {
ShowAllStreamError,
} from '@/lib/show-all-stream';
import { OK_SIDEBAR_DRAG_MIME, serializeSidebarDragPayload } from '@/lib/sidebar-drag';
+import { cn } from '@/lib/utils';
import { joinWorkspacePath } from '@/lib/workspace-paths';
import { mergeAndPruneRecentLocalAdds, spliceLazyFolderChildren } from './file-tree-merge';
import { OpenInAgentContextSubmenu } from './handoff/OpenInAgentContextSubmenu';
@@ -215,6 +225,39 @@ function focusEditorAfterRename(docName: string): void {
});
}
+interface ExternalFileDropTarget {
+ parentDir: string;
+ row: HTMLElement | null;
+ root: HTMLElement | null;
+ busyPath: string;
+}
+
+interface ExternalFileDropAffordanceRef {
+ current: {
+ row: HTMLElement | null;
+ root: HTMLElement | null;
+ };
+}
+
+function clearExternalFileDropAffordance(ref: ExternalFileDropAffordanceRef) {
+ const current = ref.current;
+ current.row?.removeAttribute(FILE_TREE_EXTERNAL_FILE_DROP_TARGET_ATTR);
+ current.root?.removeAttribute(FILE_TREE_EXTERNAL_FILE_DROP_ROOT_ATTR);
+ ref.current = { row: null, root: null };
+}
+
+function setExternalFileDropAffordance(
+ ref: ExternalFileDropAffordanceRef,
+ target: ExternalFileDropTarget,
+) {
+ const current = ref.current;
+ if (current.row === target.row && current.root === target.root) return;
+ clearExternalFileDropAffordance(ref);
+ target.row?.setAttribute(FILE_TREE_EXTERNAL_FILE_DROP_TARGET_ATTR, 'true');
+ target.root?.setAttribute(FILE_TREE_EXTERNAL_FILE_DROP_ROOT_ATTR, 'true');
+ ref.current = { row: target.row, root: target.root };
+}
+
async function copyToClipboard(text: string, kind: 'full' | 'relative'): Promise<void> {
try {
await navigator.clipboard.writeText(text);
@@ -283,6 +326,38 @@ const FILE_TREE_ROOT_DROP_CSS = `
}
`;
+const FILE_TREE_EXTERNAL_FILE_DROP_TARGET_ATTR = 'data-ok-external-file-drop-target';
+const FILE_TREE_EXTERNAL_FILE_DROP_ROOT_ATTR = 'data-ok-external-file-drop-root-target';
+const FILE_TREE_EXTERNAL_FILE_DROP_BUSY_PATH = '__external-file-drop__';
+const FILE_TREE_EXTERNAL_FILE_DROP_CSS = `
+ [data-type="item"][${FILE_TREE_EXTERNAL_FILE_DROP_TARGET_ATTR}="true"] {
+ background: color-mix(in oklab, var(--color-primary) 10%, transparent);
+ box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--color-primary) 72%, transparent);
+ }
+ [data-file-tree-virtualized-root][${FILE_TREE_EXTERNAL_FILE_DROP_ROOT_ATTR}="true"] {
+ position: relative;
+ }
+ [data-file-tree-virtualized-root][${FILE_TREE_EXTERNAL_FILE_DROP_ROOT_ATTR}="true"]::after {
+ content: "";
+ position: absolute;
+ inset: 0;
+ z-index: 20;
+ border-radius: 0.375rem;
+ box-shadow: inset 0 0 0 2px color-mix(in oklab, var(--color-primary) 80%, transparent);
+ background: color-mix(in oklab, var(--color-primary) 6%, transparent);
+ pointer-events: none;
+ }
+ @media (forced-colors: active) {
+ [data-type="item"][${FILE_TREE_EXTERNAL_FILE_DROP_TARGET_ATTR}="true"] {
+ outline: 2px solid Highlight;
+ outline-offset: -2px;
+ }
+ [data-file-tree-virtualized-root][${FILE_TREE_EXTERNAL_FILE_DROP_ROOT_ATTR}="true"]::after {
+ border: 2px solid Highlight;
+ }
+ }
+`;
+
const FILE_TREE_CREATION_CLEARED_ATTR = 'data-ok-creation-cleared';
const FILE_TREE_CREATION_CLEARED_CSS = `
:host([${FILE_TREE_CREATION_CLEARED_ATTR}]) [data-item-focused="true"] {
@@ -290,7 +365,7 @@ const FILE_TREE_CREATION_CLEARED_CSS = `
}
`;
-const FILE_TREE_UNSAFE_CSS = `${FILE_TREE_EXT_BADGE_CSS}\n${FILE_TREE_RENAME_CHIP_CSS}\n${FILE_TREE_ROOT_DROP_CSS}\n${FILE_TREE_CREATION_CLEARED_CSS}`;
+const FILE_TREE_UNSAFE_CSS = `${FILE_TREE_EXT_BADGE_CSS}\n${FILE_TREE_RENAME_CHIP_CSS}\n${FILE_TREE_ROOT_DROP_CSS}\n${FILE_TREE_EXTERNAL_FILE_DROP_CSS}\n${FILE_TREE_CREATION_CLEARED_CSS}`;
function createFileTreeStyle(resolvedTheme: string | undefined): CSSProperties {
return {
@@ -469,6 +544,7 @@ interface FileTreeMenuProps {
* (`appearance.sidebar.{showHiddenFiles,showAllFiles}`). */
mergedConfig: Config | null;
onStartCreating: (kind: 'file' | 'folder', parentDir: string) => void;
+ onUploadFiles: (parentDir: string) => void;
/** Inline create-from-template for the given parent dir + template name —
* same inline-rename fast path as `onStartCreating`, seeded from a template.
* Drives the folder menu's "New from template" hover submenu. */
@@ -529,6 +605,35 @@ function isEditableKeyboardTarget(target: EventTarget | null): boolean {
);
}
+function chooseSidebarUploadFiles(): Promise<readonly File[]> {
+ if (typeof document === 'undefined') return Promise.resolve([]);
+
+ return new Promise((resolve) => {
+ const input = document.createElement('input');
+ input.type = 'file';
+ input.multiple = true;
+ input.tabIndex = -1;
+ input.style.position = 'fixed';
+ input.style.inlineSize = '1px';
+ input.style.blockSize = '1px';
+ input.style.opacity = '0';
+ input.style.pointerEvents = 'none';
+
+ let settled = false;
+ const settle = (files: readonly File[]) => {
+ if (settled) return;
+ settled = true;
+ input.remove();
+ resolve(files);
+ };
+
+ input.addEventListener('change', () => settle(Array.from(input.files ?? [])), { once: true });
+ input.addEventListener('cancel', () => settle([]), { once: true });
+ document.body.append(input);
+ input.click();
+ });
+}
+
function collectTabsToCloseForDelete(
targets: readonly FileTreeTarget[],
documents: readonly FileEntry[],
@@ -586,6 +691,7 @@ function FileTreeMenu({
projectLocalBinding,
mergedConfig,
onStartCreating,
+ onUploadFiles,
onCreateFromTemplate,
onDuplicate,
onDelete,
@@ -748,6 +854,16 @@ function FileTreeMenu({
<FolderPlus aria-hidden="true" />
<Trans>New folder</Trans>
</DropdownMenuItem>
+ <DropdownMenuItem
+ disabled={anyActionBusy}
+ onSelect={() => {
+ closeForInlineSurface();
+ onUploadFiles(treeDirectoryPathToFolderPath(item.path));
+ }}
+ >
+ <Upload aria-hidden="true" />
+ <Trans>Upload file</Trans>
+ </DropdownMenuItem>
<DropdownMenuSeparator />
<RevealInFileManagerMenuItem item={item} workspace={workspace} onClose={close} />
<OpenInAgentContextSubmenu
@@ -1006,6 +1122,7 @@ function FileTreeMenu({
export interface FileTreeHandle {
startCreating(kind: 'file' | 'folder', parentDir: string): void;
+ uploadFiles(parentDir: string): void;
/** Open NewItemDialog at the given parentDir so the template picker is
* reachable. Used by the native macOS File menu's "New from Template…"
* item, where an inline hover-submenu of templates isn't expressible. */
@@ -1186,6 +1303,13 @@ export function FileTree({ ref }: { ref?: Ref<FileTreeHandle | null> }) {
const suppressSelectionRef = useRef(false);
const sidebarDragInProgressRef = useRef(false);
const sidebarDragClearTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
+ const externalFileDropTargetRef = useRef<{ row: HTMLElement | null; root: HTMLElement | null }>({
+ row: null,
+ root: null,
+ });
+ const uploadExternalFilesRef = useRef<
+ (files: readonly File[], parentDir: string, busyPath: string) => void
+ >(() => {});
const busyPathRef = useRef<string | null>(null);
const recentLocalAddsRef = useRef<Map<string, number>>(new Map());
const lazyLoadedDirTreePathsRef = useRef<Set<string>>(new Set());
@@ -1203,11 +1327,13 @@ export function FileTree({ ref }: { ref?: Ref<FileTreeHandle | null> }) {
const handleRenameErrorRef = useRef<(message: string) => void>((message) => toast.error(message));
const handleDropCompleteRef = useRef<(event: FileTreeDropResult) => void>(() => {});
const activeTargetRef = useRef(activeTarget);
+ const [emptyExternalFileDropActive, setEmptyExternalFileDropActive] = useState(false);
useEffect(() => {
if (loading || documents.length === 0) return;
const shadow = fileTreeHostRef.current?.querySelector(FILE_TREE_TAG_NAME)?.shadowRoot;
if (!shadow) return;
+ const shadowRoot = shadow;
function clearSidebarDragInProgressSoon() {
if (sidebarDragClearTimerRef.current !== null) {
@@ -1242,15 +1368,59 @@ export function FileTree({ ref }: { ref?: Ref<FileTreeHandle | null> }) {
event.dataTransfer?.setData(OK_SIDEBAR_DRAG_MIME, serializeSidebarDragPayload(payload));
}
+ function handleExternalFileDragOver(event: Event) {
+ if (!(event instanceof DragEvent)) return;
+ if (!isExternalFileDrag(event)) return;
+ const target = resolveExternalFileDropTarget(event);
+ if (!target) {
+ clearExternalFileDropAffordance(externalFileDropTargetRef);
+ return;
+ }
+ event.preventDefault();
+ event.stopPropagation();
+ if (event.dataTransfer) event.dataTransfer.dropEffect = 'copy';
+ setExternalFileDropAffordance(externalFileDropTargetRef, target);
+ }
+
+ function handleExternalFileDragLeave(event: Event) {
+ if (!(event instanceof DragEvent)) return;
+ if (!isExternalFileDrag(event)) return;
+ const related = event.relatedTarget;
+ if (related instanceof Node && shadowRoot.contains(related)) return;
+ clearExternalFileDropAffordance(externalFileDropTargetRef);
+ }
+
+ function handleExternalFileDrop(event: Event) {
+ if (!(event instanceof DragEvent)) return;
+ if (!isExternalFileDrag(event)) return;
+ const target = resolveExternalFileDropTarget(event);
+ const files = filesFromExternalDrop(event);
+ if (!target || files.length === 0) {
+ clearExternalFileDropAffordance(externalFileDropTargetRef);
+ return;
+ }
+ event.preventDefault();
+ event.stopPropagation();
+ clearExternalFileDropAffordance(externalFileDropTargetRef);
+ uploadExternalFilesRef.current(files, target.parentDir, target.busyPath);
+ }
+
shadow.addEventListener('dragstart', handleDragStart, { capture: true });
+ shadow.addEventListener('dragover', handleExternalFileDragOver, { capture: true });
+ shadow.addEventListener('dragleave', handleExternalFileDragLeave, { capture: true });
+ shadow.addEventListener('drop', handleExternalFileDrop, { capture: true });
shadow.addEventListener('dragend', clearSidebarDragInProgressSoon, { capture: true });
window.addEventListener('drop', clearSidebarDragInProgressSoon, true);
window.addEventListener('dragend', clearSidebarDragInProgressSoon, true);
return () => {
shadow.removeEventListener('dragstart', handleDragStart, { capture: true });
+ shadow.removeEventListener('dragover', handleExternalFileDragOver, { capture: true });
+ shadow.removeEventListener('dragleave', handleExternalFileDragLeave, { capture: true });
+ shadow.removeEventListener('drop', handleExternalFileDrop, { capture: true });
shadow.removeEventListener('dragend', clearSidebarDragInProgressSoon, { capture: true });
window.removeEventListener('drop', clearSidebarDragInProgressSoon, true);
window.removeEventListener('dragend', clearSidebarDragInProgressSoon, true);
+ clearExternalFileDropAffordance(externalFileDropTargetRef);
if (sidebarDragClearTimerRef.current !== null) {
clearTimeout(sidebarDragClearTimerRef.current);
sidebarDragClearTimerRef.current = null;
@@ -2188,6 +2358,141 @@ export function FileTree({ ref }: { ref?: Ref<FileTreeHandle | null> }) {
}
}
+ async function uploadExternalFilesToTarget(
+ files: readonly File[],
+ parentDir: string,
+ uploadBusyPath: string,
+ ) {
+ if (files.length === 0 || busyPathRef.current !== null) return;
+
+ const clearBusyState = () => {
+ busyPathRef.current = null;
+ setBusyPath(null);
+ };
+ busyPathRef.current = uploadBusyPath;
+ setBusyPath(uploadBusyPath);
+ setError(null);
+
+ const uploadedEntries: FileEntry[] = [];
+ let uploadedCount = 0;
+ let failedCount = 0;
+
+ for (const file of files) {
+ const formData = new FormData();
+ formData.append('file', file);
+ formData.append(
+ 'parentDocName',
+ uploadParentDocNameForFolderDrop(parentDir, file.name || 'upload'),
+ );
+
+ try {
+ const res = await fetch('/api/upload', { method: 'POST', body: formData });
+ const parsed = await parseServerResponse(res, t`Failed to upload file`);
+ if (!parsed.ok) {
+ failedCount += 1;
+ toast.error(parsed.title, { description: file.name });
+ continue;
+ }
+
+ const success = parseSuccessOrWarn(
+ UploadAssetSuccessSchema,
+ parsed.body,
+ 'upload:drop',
+ null,
+ );
+ if (success === null) {
+ failedCount += 1;
+ toast.error(t`Failed to upload file`, { description: file.name });
+ continue;
+ }
+ const uploadedPath = uploadedPathForSidebarDrop(parentDir, success);
+ if (success.deduped === true) {
+ failedCount += 1;
+ toast.error(t`File already exists`, { description: uploadedPath });
+ continue;
+ }
+ uploadedCount += 1;
+ const entry = fileEntryFromUploadedPath(uploadedPath, file);
+ if (entry) uploadedEntries.push(entry);
+ } catch (err) {
+ failedCount += 1;
+ console.warn('[FileTree] external file upload failed:', err);
+ toast.error(
+ err instanceof TypeError ? t`Network error — please try again` : t`Failed to upload file`,
+ {
+ description: file.name,
+ },
+ );
+ }
+ }
+
+ try {
+ if (uploadedEntries.length > 0) {
+ for (const entry of uploadedEntries) {
+ if (isDocumentEntry(entry)) addPage(entry.docName);
+ }
+ setDocuments((current) => {
+ const existing = new Set(current.map(fileEntryToTreePath));
+ let changed = false;
+ const next = [...current];
+ for (const entry of uploadedEntries) {
+ const treePath = fileEntryToTreePath(entry);
+ recentLocalAddsRef.current.set(treePath, Date.now());
+ if (existing.has(treePath)) continue;
+ existing.add(treePath);
+ next.push(entry);
+ changed = true;
+ }
+ if (!changed) return current;
+ resetModelToDocuments(next);
+ markNextDocumentsAsApplied(next);
+ return next;
+ });
+ }
+
+ if (uploadedCount > 0) {
+ emitDocumentsChanged(['files', 'backlinks', 'graph']);
+ refreshDocsScheduleRef.current?.();
+ toast.success(
+ plural(uploadedCount, {
+ one: 'Uploaded one file',
+ other: `Uploaded ${uploadedCount} files`,
+ }),
+ { description: parentDir || t`Project root` },
+ );
+ }
+
+ if (failedCount > 0) {
+ setError(
+ uploadedCount > 0
+ ? plural(failedCount, {
+ one: '1 file failed to upload',
+ other: `${failedCount} files failed to upload`,
+ })
+ : t`Failed to upload file`,
+ );
+ }
+ clearBusyState();
+ } catch (err) {
+ const message = t`Upload may have succeeded but the sidebar is out of date — refresh to resync`;
+ console.warn('[FileTree] upload post-upload reconciliation failed:', err);
+ toast.error(message);
+ setError(message);
+ clearBusyState();
+ }
+ }
+
+ async function uploadFilesToTargetFromPicker(parentDir: string) {
+ if (busyPathRef.current !== null) return;
+ const files = await chooseSidebarUploadFiles();
+ if (files.length === 0) return;
+ const uploadBusyPath =
+ parentDir === ''
+ ? FILE_TREE_EXTERNAL_FILE_DROP_BUSY_PATH
+ : folderPathToTreeDirectoryPath(parentDir);
+ await uploadExternalFilesToTarget(files, parentDir, uploadBusyPath);
+ }
+
function startCreatingFromTemplate(parentDir: string) {
setNewItemRequest({ parentDir });
}
@@ -2386,6 +2691,9 @@ export function FileTree({ ref }: { ref?: Ref<FileTreeHandle | null> }) {
detectLazyFolderExpansionsRef.current = detectLazyFolderExpansions;
revalidateExpandedLazyDirsRef.current = revalidateExpandedLazyDirs;
cleanupPendingCreateRef.current = cleanupPendingCreate;
+ uploadExternalFilesRef.current = (files, parentDir, uploadBusyPath) => {
+ void uploadExternalFilesToTarget(files, parentDir, uploadBusyPath);
+ };
handleSelectionChangeRef.current = (selectedPaths) => {
if (suppressSelectionRef.current || sidebarDragInProgressRef.current) return;
if (selectedPaths.length !== 1) return;
@@ -2526,9 +2834,11 @@ export function FileTree({ ref }: { ref?: Ref<FileTreeHandle | null> }) {
const startCreatingRef = useRef(startCreating);
const startCreatingFromTemplateRef = useRef(startCreatingFromTemplate);
+ const uploadFilesRef = useRef(uploadFilesToTargetFromPicker);
useEffect(() => {
startCreatingRef.current = startCreating;
startCreatingFromTemplateRef.current = startCreatingFromTemplate;
+ uploadFilesRef.current = uploadFilesToTargetFromPicker;
});
useImperativeHandle(
@@ -2537,6 +2847,9 @@ export function FileTree({ ref }: { ref?: Ref<FileTreeHandle | null> }) {
startCreating(kind, parentDir) {
void startCreatingRef.current(kind, parentDir);
},
+ uploadFiles(parentDir) {
+ void uploadFilesRef.current(parentDir);
+ },
startCreatingFromTemplate(parentDir) {
startCreatingFromTemplateRef.current(parentDir);
},
@@ -3044,6 +3357,30 @@ export function FileTree({ ref }: { ref?: Ref<FileTreeHandle | null> }) {
queueMicrotask(() => activateTreePath(path));
}
+ function handleEmptyExternalFileDragOver(event: ReactDragEvent<HTMLDivElement>) {
+ if (!isExternalFileDrag(event.nativeEvent)) return;
+ event.preventDefault();
+ event.stopPropagation();
+ event.dataTransfer.dropEffect = 'copy';
+ setEmptyExternalFileDropActive(true);
+ }
+
+ function handleEmptyExternalFileDragLeave(event: ReactDragEvent<HTMLDivElement>) {
+ const related = event.relatedTarget;
+ if (related instanceof Node && event.currentTarget.contains(related)) return;
+ setEmptyExternalFileDropActive(false);
+ }
+
+ function handleEmptyExternalFileDrop(event: ReactDragEvent<HTMLDivElement>) {
+ if (!isExternalFileDrag(event.nativeEvent)) return;
+ const files = filesFromExternalDrop(event.nativeEvent);
+ if (files.length === 0) return;
+ event.preventDefault();
+ event.stopPropagation();
+ setEmptyExternalFileDropActive(false);
+ void uploadExternalFilesToTarget(files, '', FILE_TREE_EXTERNAL_FILE_DROP_BUSY_PATH);
+ }
+
if (loading) {
return <FileTreeSkeleton />;
}
@@ -3057,7 +3394,16 @@ export function FileTree({ ref }: { ref?: Ref<FileTreeHandle | null> }) {
);
}
return (
- <div className="flex flex-1 flex-col items-center justify-center gap-3 py-8">
+ <section
+ aria-label={t`File drop zone`}
+ className={cn(
+ 'flex flex-1 flex-col items-center justify-center gap-3 rounded-md py-8',
+ emptyExternalFileDropActive && 'bg-primary/5 ring-2 ring-primary/70 ring-inset',
+ )}
+ onDragOver={handleEmptyExternalFileDragOver}
+ onDragLeave={handleEmptyExternalFileDragLeave}
+ onDrop={handleEmptyExternalFileDrop}
+ >
<span className="select-none text-sidebar-foreground/30 text-sm">
<Trans>No files yet.</Trans>
</span>
@@ -3069,7 +3415,18 @@ export function FileTree({ ref }: { ref?: Ref<FileTreeHandle | null> }) {
>
<Trans>Create your first file</Trans>
</Button>
- </div>
+ <Button
+ variant="link"
+ size="sm"
+ className="font-mono uppercase"
+ onClick={() => {
+ void uploadFilesToTargetFromPicker('');
+ }}
+ >
+ <Upload aria-hidden="true" />
+ <Trans>Upload file</Trans>
+ </Button>
+ </section>
);
}
@@ -3115,6 +3472,9 @@ export function FileTree({ ref }: { ref?: Ref<FileTreeHandle | null> }) {
projectLocalBinding={projectLocalBinding}
mergedConfig={merged}
onStartCreating={startCreating}
+ onUploadFiles={(parentDir) => {
+ void uploadFilesToTargetFromPicker(parentDir);
+ }}
onCreateFromTemplate={(parentDir, templateName) =>
startCreating('file', parentDir, { template: templateName })
}
@@ -3226,6 +3586,38 @@ function findTreeItemElement(event: MouseEvent): HTMLElement | null {
return null;
}
+function findTreeVirtualizedRootElement(event: MouseEvent): HTMLElement | null {
+ for (const entry of event.composedPath()) {
+ if (entry instanceof HTMLElement && entry.matches('[data-file-tree-virtualized-root]')) {
+ return entry;
+ }
+ }
+ return null;
+}
+
+function resolveExternalFileDropTarget(event: MouseEvent): ExternalFileDropTarget | null {
+ const item = findTreeItemElement(event);
+ if (item) {
+ const rawPath = item.dataset.itemPath;
+ if (!rawPath) return null;
+ const isFolder = item.dataset.itemType === 'folder';
+ const parentDir = parentFolderPathForTreeItemDropTarget(rawPath, isFolder);
+ return {
+ parentDir,
+ row: item,
+ root: null,
+ busyPath: isFolder ? folderPathToTreeDirectoryPath(parentDir) : rawPath,
+ };
+ }
+ if (!clickIsInTreeContentArea(event)) return null;
+ return {
+ parentDir: '',
+ row: null,
+ root: findTreeVirtualizedRootElement(event),
+ busyPath: FILE_TREE_EXTERNAL_FILE_DROP_BUSY_PATH,
+ };
+}
+
function clickIsInTreeContentArea(event: MouseEvent): boolean {
for (const entry of event.composedPath()) {
if (entry instanceof HTMLElement && entry.matches('[data-file-tree-virtualized-scroll]')) {
@@ -3265,9 +3657,10 @@ function FileTreeHeaderNotice({ kind, children }: { kind: 'error' | 'info'; chil
return (
<span
role={kind === 'error' ? 'alert' : 'status'}
- className={`mx-2 mb-1 flex items-start gap-1.5 rounded-md bg-muted/50 px-2 py-1.5 text-xs leading-snug ${
- kind === 'error' ? 'text-destructive' : 'text-muted-foreground'
- }`}
+ className={cn(
+ 'mx-2 mb-1 flex items-start gap-1.5 rounded-md bg-muted/50 px-2 py-1.5 text-xs leading-snug',
+ kind === 'error' ? 'text-destructive' : 'text-muted-foreground',
+ )}
>
<Icon aria-hidden="true" className="mt-0.5 size-3.5 shrink-0" />
<span className="min-w-0">{children}</span>
diff --git a/packages/app/src/components/file-tree-adapter.test.ts b/packages/app/src/components/file-tree-adapter.test.ts
index 21efb32e7..1a541b7e6 100644
--- a/packages/app/src/components/file-tree-adapter.test.ts
+++ b/packages/app/src/components/file-tree-adapter.test.ts
@@ -1,5 +1,6 @@
import { describe, expect, test } from 'bun:test';
import type { ContextMenuItem, FileTreeDropTarget } from '@pierre/trees';
+import { OK_SIDEBAR_DRAG_MIME } from '@/lib/sidebar-drag';
import {
collectTreeFolderPathsFromDocuments,
computeTreeAncestorPaths,
@@ -8,13 +9,19 @@ import {
createTreePlaceholder,
docNameToTreePath,
documentsToTreePaths,
+ fileEntryFromUploadedPath,
fileEntryToTreePath,
+ filesFromExternalDrop,
folderPathToTreeDirectoryPath,
+ isExternalFileDrag,
+ parentFolderPathForTreeItemDropTarget,
relativePathForTreeItem,
treeDirectoryPathToFolderPath,
treeFilePathToDocName,
treeItemToTarget,
treePathToAppPath,
+ uploadedPathForSidebarDrop,
+ uploadParentDocNameForFolderDrop,
} from './file-tree-adapter';
import { buildTrashAbsPath } from './file-tree-operations';
import type { DocEntry, FileEntry } from './file-tree-utils';
@@ -123,6 +130,71 @@ describe('file-tree-adapter', () => {
expect(computeTreeDropDestinationPath('archive/', root)).toBe('archive/');
});
+ test('resolves external file drop targets to upload parent doc names', () => {
+ expect(parentFolderPathForTreeItemDropTarget('docs/', true)).toBe('docs');
+ expect(parentFolderPathForTreeItemDropTarget('docs/guide.md', false)).toBe('docs');
+ expect(parentFolderPathForTreeItemDropTarget('assets/cat.png', false)).toBe('assets');
+ expect(parentFolderPathForTreeItemDropTarget('README.md', false)).toBe('');
+
+ expect(uploadParentDocNameForFolderDrop('docs', 'clip.pdf')).toBe('docs/clip.pdf');
+ expect(uploadParentDocNameForFolderDrop('docs/', 'clip.pdf')).toBe('docs/clip.pdf');
+ expect(uploadParentDocNameForFolderDrop('', 'clip.pdf')).toBe('clip.pdf');
+
+ expect(uploadedPathForSidebarDrop('docs', { src: 'clip.pdf' })).toBe('docs/clip.pdf');
+ expect(
+ uploadedPathForSidebarDrop('docs', { src: 'ignored.pdf', path: '/assets/clip.pdf' }),
+ ).toBe('assets/clip.pdf');
+ expect(uploadedPathForSidebarDrop('', { src: 'clip.pdf', deduped: true })).toBe('clip.pdf');
+ });
+
+ test('classifies uploaded sidebar files for optimistic entries', () => {
+ const md = fileEntryFromUploadedPath('docs/notes.md', new File(['hello'], 'notes.md'));
+ expect(md).toMatchObject({
+ kind: 'document',
+ docName: 'docs/notes',
+ docExt: '.md',
+ size: 5,
+ });
+
+ const mdx = fileEntryFromUploadedPath('docs/card.mdx', new File(['x'], 'card.mdx'));
+ expect(mdx).toMatchObject({
+ kind: 'document',
+ docName: 'docs/card',
+ docExt: '.mdx',
+ size: 1,
+ });
+
+ const asset = fileEntryFromUploadedPath('img/photo.png', new File(['image'], 'photo.png'));
+ expect(asset).toMatchObject({
+ kind: 'asset',
+ path: 'img/photo.png',
+ assetExt: 'png',
+ mediaKind: 'image',
+ size: 5,
+ });
+
+ expect(fileEntryFromUploadedPath('Makefile', new File(['build'], 'Makefile'))).toBeNull();
+ });
+
+ test('detects external file drags without swallowing sidebar drags', () => {
+ expect(isExternalFileDrag({ dataTransfer: { types: ['Files'] } })).toBe(true);
+ expect(isExternalFileDrag({ dataTransfer: { types: ['Files', OK_SIDEBAR_DRAG_MIME] } })).toBe(
+ false,
+ );
+ expect(isExternalFileDrag({ dataTransfer: { types: [OK_SIDEBAR_DRAG_MIME] } })).toBe(false);
+ expect(isExternalFileDrag({ dataTransfer: null })).toBe(false);
+ });
+
+ test('filters ghost file entries from external drops', () => {
+ const namedEmpty = new File([], 'empty.txt');
+ const namelessContent = { name: '', size: 10 } as File;
+ const ghost = { name: '', size: 0 } as File;
+
+ expect(
+ filesFromExternalDrop({ dataTransfer: { files: [ghost, namedEmpty, namelessContent] } }),
+ ).toEqual([namedEmpty, namelessContent]);
+ });
+
test('converts context menu items to sidebar targets and relative paths', () => {
const file = menuItem('docs/guide.md', 'file');
const folder = menuItem('docs/', 'directory');
diff --git a/packages/app/src/components/file-tree-adapter.ts b/packages/app/src/components/file-tree-adapter.ts
index 3711097d2..cca9b71fb 100644
--- a/packages/app/src/components/file-tree-adapter.ts
+++ b/packages/app/src/components/file-tree-adapter.ts
@@ -1,4 +1,9 @@
+import {
+ mediaKindForSidebarAssetExtension,
+ type UploadAssetSuccess,
+} from '@inkeep/open-knowledge-core';
import type { ContextMenuItem, FileTreeDropTarget } from '@pierre/trees';
+import { getFileExtension } from '@/components/file-tree-rename-validation';
import {
type DocumentEntry,
type FileEntry,
@@ -6,6 +11,7 @@ import {
isDocumentEntry,
isFolderEntry,
} from '@/components/file-tree-utils';
+import { OK_SIDEBAR_DRAG_MIME } from '@/lib/sidebar-drag';
const DEFAULT_TREE_EXTENSION = '.md';
const TREE_EXTENSION_PATTERN = /\.(md|mdx)$/i;
@@ -234,6 +240,85 @@ export function computeTreeDropDestinationPath(
return `${target.directoryPath}${getTreeBasename(sourcePath)}`;
}
+export function parentFolderPathForTreeItemDropTarget(treePath: string, isFolder: boolean): string {
+ if (isFolder) {
+ return treeDirectoryPathToFolderPath(folderPathToTreeDirectoryPath(treePath));
+ }
+ const appPath = treeFilePathToDocName(treePath);
+ const slash = appPath.lastIndexOf('/');
+ return slash === -1 ? '' : appPath.slice(0, slash);
+}
+
+export function uploadParentDocNameForFolderDrop(
+ parentFolderPath: string,
+ fileName: string,
+): string {
+ const parent = treeDirectoryPathToFolderPath(folderPathToTreeDirectoryPath(parentFolderPath));
+ return parent ? `${parent}/${fileName}` : fileName;
+}
+
+export function uploadedPathForSidebarDrop(
+ parentFolderPath: string,
+ success: UploadAssetSuccess,
+): string {
+ return (success.path ?? uploadParentDocNameForFolderDrop(parentFolderPath, success.src)).replace(
+ /^\/+/,
+ '',
+ );
+}
+
+interface ExternalFileDragLike {
+ dataTransfer?: {
+ types?: Iterable<string> | ArrayLike<string>;
+ } | null;
+}
+
+interface ExternalFileDropLike {
+ dataTransfer?: {
+ files?: Iterable<File> | ArrayLike<File>;
+ } | null;
+}
+
+export function isExternalFileDrag(event: ExternalFileDragLike): boolean {
+ const types = event.dataTransfer?.types;
+ if (!types) return false;
+ const list = Array.from(types);
+ return list.includes('Files') && !list.includes(OK_SIDEBAR_DRAG_MIME);
+}
+
+export function filesFromExternalDrop(event: ExternalFileDropLike): File[] {
+ return Array.from(event.dataTransfer?.files ?? []).filter(
+ (file) => file.name.length > 0 || file.size > 0,
+ );
+}
+
+export function fileEntryFromUploadedPath(
+ path: string,
+ file: Pick<File, 'size'>,
+): FileEntry | null {
+ const ext = getFileExtension(path).toLowerCase();
+ if (ext === '') return null;
+ const modified = new Date().toISOString();
+ if (ext === '.md' || ext === '.mdx') {
+ return {
+ kind: 'document',
+ docName: treeFilePathToDocName(path),
+ docExt: ext,
+ modified,
+ size: file.size,
+ };
+ }
+ const assetExt = ext.startsWith('.') ? ext.slice(1) : ext;
+ return {
+ kind: 'asset',
+ path,
+ assetExt,
+ mediaKind: mediaKindForSidebarAssetExtension(assetExt),
+ modified,
+ size: file.size,
+ };
+}
+
function getTreeBasename(path: string): string {
const stripped = stripTrailingSlash(path);
const slash = stripped.lastIndexOf('/');
diff --git a/packages/app/src/locales/en/messages.json b/packages/app/src/locales/en/messages.json
index 6a7de287c..1dc05c7ac 100644
--- a/packages/app/src/locales/en/messages.json
+++ b/packages/app/src/locales/en/messages.json
@@ -147,6 +147,7 @@
"4A3Yzu": ["Code block"],
"4BITzH": ["Error:"],
"4CfgPM": ["Project folder created, but git init failed. Try again."],
+ "4Gz2wC": ["Failed to upload file"],
"4KmEoC": ["Hotkeys"],
"4NC2Ym": ["Move to the next or previous table cell."],
"4PYsOz": ["Hide Files (", ["sidebarShortcutLabel"], ")"],
@@ -160,6 +161,7 @@
"4jDd0j": ["Anyone can see"],
"4niEzY": ["Sandboxed HTML embed — write HTML, see the rendered preview live."],
"4nj6n8": ["/api/config returned HTTP ", ["code"]],
+ "4sKwf6": ["File already exists"],
"4uNLmk": ["Pulling"],
"4v2Yyz": ["Select every visible file-tree row when focus is in the Files sidebar."],
"4xtLTl": ["Hidden folder “", ["basename"], "”"],
@@ -188,6 +190,7 @@
"5SwVv1": ["Not installed"],
"5Tk8Fb": ["Loading files"],
"5WDhAk": ["Link to a page or external URL."],
+ "5ZB7XC": ["File drop zone"],
"5gr_ev": [
"Becomes the document's content when someone creates a doc from this template. Type <0>",
["dateToken"],
@@ -937,6 +940,7 @@
"VZGh8G": ["Fold, unfold, fold all, or unfold all source ranges."],
"VZSBXL": ["Semantic ranking activates the first time an agent runs a search."],
"VbqhBI": ["Already at ", ["assetContentPath"], " — reusing."],
+ "VcqWBy": ["Upload may have succeeded but the sidebar is out of date — refresh to resync"],
"VdXv4D": ["Clone from GitHub"],
"Vlc75q": ["Keep file deleted"],
"VsBxkh": [
@@ -1740,6 +1744,13 @@
"uynXup": [["tokens", "plural", { "one": ["token"], "other": ["tokens"] }]],
"v-h2hx": ["Delete ", ["targetGitPath"]],
"v41fCm": ["File not found"],
+ "v75Em9": [
+ [
+ "uploadedCount",
+ "plural",
+ { "one": ["Uploaded one file"], "other": ["Uploaded ", ["uploadedCount"], " files"] }
+ ]
+ ],
"v7lbnC": ["Find next match"],
"vDXqVv": ["Insert a markdown hard break."],
"vEJDlt": ["The file is in your Trash; the file-watcher will reconcile."],
@@ -1822,6 +1833,16 @@
"The preview blocks resources that don't meet its security rules (for example plain http:// URLs, or code that uses eval). The content above may render incompletely."
],
"yFyZMJ": ["No pages matched \"", ["semanticQueryText"], "\" by meaning."],
+ "yH7T4q": [
+ [
+ "failedCount",
+ "plural",
+ {
+ "one": ["1 file failed to upload"],
+ "other": [["failedCount"], " files failed to upload"]
+ }
+ ]
+ ],
"yHikCO": ["Open CodeMirror's go-to-line prompt."],
"yKu_3Y": ["Restore"],
"yLq4w4": ["Separator"],
diff --git a/packages/app/src/locales/en/messages.po b/packages/app/src/locales/en/messages.po
index 6905d0248..d363b3dc6 100644
--- a/packages/app/src/locales/en/messages.po
+++ b/packages/app/src/locales/en/messages.po
@@ -234,6 +234,10 @@ msgstr "{diffMin}m ago"
msgid "{docName} is {0}. Open Knowledge currently opens files up to {1}."
msgstr "{docName} is {0}. Open Knowledge currently opens files up to {1}."
+#: src/components/FileTree.tsx
+msgid "{failedCount, plural, one {1 file failed to upload} other {{failedCount} files failed to upload}}"
+msgstr "{failedCount, plural, one {1 file failed to upload} other {{failedCount} files failed to upload}}"
+
#: src/components/ActivityModeContent.tsx
msgid "{fileCount, plural, one {# file} other {# files}}"
msgstr "{fileCount, plural, one {# file} other {# files}}"
@@ -341,6 +345,10 @@ msgstr "{tokens, plural, one {token} other {tokens}}"
msgid "{truncatedShownCount, plural, one {Showing the first item in one folder — the rest of that folder is hidden. Turn off Show all files for the filtered view.} other {Showing the first {formattedCount} items in one folder — the rest of that folder is hidden. Turn off Show all files for the filtered view.}}"
msgstr "{truncatedShownCount, plural, one {Showing the first item in one folder — the rest of that folder is hidden. Turn off Show all files for the filtered view.} other {Showing the first {formattedCount} items in one folder — the rest of that folder is hidden. Turn off Show all files for the filtered view.}}"
+#: src/components/FileTree.tsx
+msgid "{uploadedCount, plural, one {Uploaded one file} other {Uploaded {uploadedCount} files}}"
+msgstr "{uploadedCount, plural, one {Uploaded one file} other {Uploaded {uploadedCount} files}}"
+
#: src/presence/PresenceBar.tsx
msgid "{userName} · {tabCount, plural, one {# tab} other {# tabs}}"
msgstr "{userName} · {tabCount, plural, one {# tab} other {# tabs}}"
@@ -2308,6 +2316,10 @@ msgstr "Failed to reorder"
msgid "Failed to update property"
msgstr "Failed to update property"
+#: src/components/FileTree.tsx
+msgid "Failed to upload file"
+msgstr "Failed to upload file"
+
#: src/components/ActivityPanelBurstRow.tsx
msgid "Failed: {loadError}"
msgstr "Failed: {loadError}"
@@ -2329,6 +2341,14 @@ msgstr "Fetching"
msgid "File"
msgstr "File"
+#: src/components/FileTree.tsx
+msgid "File already exists"
+msgstr "File already exists"
+
+#: src/components/FileTree.tsx
+msgid "File drop zone"
+msgstr "File drop zone"
+
#: src/components/FileTree.tsx
msgid "File duplicated"
msgstr "File duplicated"
@@ -4258,6 +4278,7 @@ msgstr "Project"
msgid "Project folder created, but git init failed. Try again."
msgstr "Project folder created, but git init failed. Try again."
+#: src/components/FileTree.tsx
#: src/components/SeedDialog.tsx
msgid "Project root"
msgstr "Project root"
@@ -5831,10 +5852,16 @@ msgstr "Upload failed — please try again"
msgid "Upload failed: {message}"
msgstr "Upload failed: {message}"
+#: src/components/FileSidebar.tsx
+#: src/components/FileTree.tsx
#: src/editor/components/PropPanel.tsx
msgid "Upload file"
msgstr "Upload file"
+#: src/components/FileTree.tsx
+msgid "Upload may have succeeded but the sidebar is out of date — refresh to resync"
+msgstr "Upload may have succeeded but the sidebar is out of date — refresh to resync"
+
#: src/editor/image-upload/index.ts
msgid "Uploading {fileName}"
msgstr "Uploading {fileName}"
diff --git a/packages/app/src/locales/pseudo/messages.json b/packages/app/src/locales/pseudo/messages.json
index 639b95845..932c793cd 100644
--- a/packages/app/src/locales/pseudo/messages.json
+++ b/packages/app/src/locales/pseudo/messages.json
@@ -147,6 +147,7 @@
"4A3Yzu": ["Ćōďē ƀĺōćķ"],
"4BITzH": ["Ēŕŕōŕ:"],
"4CfgPM": ["ƤŕōĴēćţ ƒōĺďēŕ ćŕēàţēď, ƀũţ ĝĩţ ĩńĩţ ƒàĩĺēď. Ţŕŷ àĝàĩń."],
+ "4Gz2wC": ["Ƒàĩĺēď ţō ũƥĺōàď ƒĩĺē"],
"4KmEoC": ["Ĥōţķēŷś"],
"4NC2Ym": ["Ḿōvē ţō ţĥē ńēxţ ōŕ ƥŕēvĩōũś ţàƀĺē ćēĺĺ."],
"4PYsOz": ["Ĥĩďē Ƒĩĺēś (", ["sidebarShortcutLabel"], ")"],
@@ -160,6 +161,7 @@
"4jDd0j": ["Àńŷōńē ćàń śēē"],
"4niEzY": ["Śàńďƀōxēď ĤŢḾĹ ēḿƀēď — ŵŕĩţē ĤŢḾĹ, śēē ţĥē ŕēńďēŕēď ƥŕēvĩēŵ ĺĩvē."],
"4nj6n8": ["/àƥĩ/ćōńƒĩĝ ŕēţũŕńēď ĤŢŢƤ ", ["code"]],
+ "4sKwf6": ["Ƒĩĺē àĺŕēàďŷ ēxĩśţś"],
"4uNLmk": ["Ƥũĺĺĩńĝ"],
"4v2Yyz": ["Śēĺēćţ ēvēŕŷ vĩśĩƀĺē ƒĩĺē-ţŕēē ŕōŵ ŵĥēń ƒōćũś ĩś ĩń ţĥē Ƒĩĺēś śĩďēƀàŕ."],
"4xtLTl": ["Ĥĩďďēń ƒōĺďēŕ “", ["basename"], "”"],
@@ -188,6 +190,7 @@
"5SwVv1": ["Ńōţ ĩńśţàĺĺēď"],
"5Tk8Fb": ["Ĺōàďĩńĝ ƒĩĺēś"],
"5WDhAk": ["Ĺĩńķ ţō à ƥàĝē ōŕ ēxţēŕńàĺ ŨŔĹ."],
+ "5ZB7XC": ["Ƒĩĺē ďŕōƥ źōńē"],
"5gr_ev": [
"ßēćōḿēś ţĥē ďōćũḿēńţ'ś ćōńţēńţ ŵĥēń śōḿēōńē ćŕēàţēś à ďōć ƒŕōḿ ţĥĩś ţēḿƥĺàţē. Ţŷƥē <0>",
["dateToken"],
@@ -937,6 +940,7 @@
"VZGh8G": ["Ƒōĺď, ũńƒōĺď, ƒōĺď àĺĺ, ōŕ ũńƒōĺď àĺĺ śōũŕćē ŕàńĝēś."],
"VZSBXL": ["Śēḿàńţĩć ŕàńķĩńĝ àćţĩvàţēś ţĥē ƒĩŕśţ ţĩḿē àń àĝēńţ ŕũńś à śēàŕćĥ."],
"VbqhBI": ["Àĺŕēàďŷ àţ ", ["assetContentPath"], " — ŕēũśĩńĝ."],
+ "VcqWBy": ["Ũƥĺōàď ḿàŷ ĥàvē śũććēēďēď ƀũţ ţĥē śĩďēƀàŕ ĩś ōũţ ōƒ ďàţē — ŕēƒŕēśĥ ţō ŕēśŷńć"],
"VdXv4D": ["Ćĺōńē ƒŕōḿ ĜĩţĤũƀ"],
"Vlc75q": ["Ķēēƥ ƒĩĺē ďēĺēţēď"],
"VsBxkh": [
@@ -1740,6 +1744,13 @@
"uynXup": [["tokens", "plural", { "one": ["ţōķēń"], "other": ["ţōķēńś"] }]],
"v-h2hx": ["Ďēĺēţē ", ["targetGitPath"]],
"v41fCm": ["Ƒĩĺē ńōţ ƒōũńď"],
+ "v75Em9": [
+ [
+ "uploadedCount",
+ "plural",
+ { "one": ["Ũƥĺōàďēď ōńē ƒĩĺē"], "other": ["Ũƥĺōàďēď ", ["uploadedCount"], " ƒĩĺēś"] }
+ ]
+ ],
"v7lbnC": ["Ƒĩńď ńēxţ ḿàţćĥ"],
"vDXqVv": ["Ĩńśēŕţ à ḿàŕķďōŵń ĥàŕď ƀŕēàķ."],
"vEJDlt": ["Ţĥē ƒĩĺē ĩś ĩń ŷōũŕ Ţŕàśĥ; ţĥē ƒĩĺē-ŵàţćĥēŕ ŵĩĺĺ ŕēćōńćĩĺē."],
@@ -1822,6 +1833,16 @@
"Ţĥē ƥŕēvĩēŵ ƀĺōćķś ŕēśōũŕćēś ţĥàţ ďōń'ţ ḿēēţ ĩţś śēćũŕĩţŷ ŕũĺēś (ƒōŕ ēxàḿƥĺē ƥĺàĩń ĥţţƥ:// ŨŔĹś, ōŕ ćōďē ţĥàţ ũśēś ēvàĺ). Ţĥē ćōńţēńţ àƀōvē ḿàŷ ŕēńďēŕ ĩńćōḿƥĺēţēĺŷ."
],
"yFyZMJ": ["Ńō ƥàĝēś ḿàţćĥēď \"", ["semanticQueryText"], "\" ƀŷ ḿēàńĩńĝ."],
+ "yH7T4q": [
+ [
+ "failedCount",
+ "plural",
+ {
+ "one": ["1 ƒĩĺē ƒàĩĺēď ţō ũƥĺōàď"],
+ "other": [["failedCount"], " ƒĩĺēś ƒàĩĺēď ţō ũƥĺōàď"]
+ }
+ ]
+ ],
"yHikCO": ["Ōƥēń ĆōďēḾĩŕŕōŕ'ś ĝō-ţō-ĺĩńē ƥŕōḿƥţ."],
"yKu_3Y": ["Ŕēśţōŕē"],
"yLq4w4": ["Śēƥàŕàţōŕ"],
diff --git a/packages/app/src/locales/pseudo/messages.po b/packages/app/src/locales/pseudo/messages.po
index 920f2e512..0e315d1dc 100644
--- a/packages/app/src/locales/pseudo/messages.po
+++ b/packages/app/src/locales/pseudo/messages.po
@@ -234,6 +234,10 @@ msgstr ""
msgid "{docName} is {0}. Open Knowledge currently opens files up to {1}."
msgstr ""
+#: src/components/FileTree.tsx
+msgid "{failedCount, plural, one {1 file failed to upload} other {{failedCount} files failed to upload}}"
+msgstr ""
+
#: src/components/ActivityModeContent.tsx
msgid "{fileCount, plural, one {# file} other {# files}}"
msgstr ""
@@ -341,6 +345,10 @@ msgstr ""
msgid "{truncatedShownCount, plural, one {Showing the first item in one folder — the rest of that folder is hidden. Turn off Show all files for the filtered view.} other {Showing the first {formattedCount} items in one folder — the rest of that folder is hidden. Turn off Show all files for the filtered view.}}"
msgstr ""
+#: src/components/FileTree.tsx
+msgid "{uploadedCount, plural, one {Uploaded one file} other {Uploaded {uploadedCount} files}}"
+msgstr ""
+
#: src/presence/PresenceBar.tsx
msgid "{userName} · {tabCount, plural, one {# tab} other {# tabs}}"
msgstr ""
@@ -2303,6 +2311,10 @@ msgstr ""
msgid "Failed to update property"
msgstr ""
+#: src/components/FileTree.tsx
+msgid "Failed to upload file"
+msgstr ""
+
#: src/components/ActivityPanelBurstRow.tsx
msgid "Failed: {loadError}"
msgstr ""
@@ -2324,6 +2336,14 @@ msgstr ""
msgid "File"
msgstr ""
+#: src/components/FileTree.tsx
+msgid "File already exists"
+msgstr ""
+
+#: src/components/FileTree.tsx
+msgid "File drop zone"
+msgstr ""
+
#: src/components/FileTree.tsx
msgid "File duplicated"
msgstr ""
@@ -4253,6 +4273,7 @@ msgstr ""
msgid "Project folder created, but git init failed. Try again."
msgstr ""
+#: src/components/FileTree.tsx
#: src/components/SeedDialog.tsx
msgid "Project root"
msgstr ""
@@ -5826,10 +5847,16 @@ msgstr ""
msgid "Upload failed: {message}"
msgstr ""
+#: src/components/FileSidebar.tsx
+#: src/components/FileTree.tsx
#: src/editor/components/PropPanel.tsx
msgid "Upload file"
msgstr ""
+#: src/components/FileTree.tsx
+msgid "Upload may have succeeded but the sidebar is out of date — refresh to resync"
+msgstr ""
+
#: src/editor/image-upload/index.ts
msgid "Uploading {fileName}"
msgstr ""