diff --git a/src/components/FileBrowser.jsx b/src/components/FileBrowser.jsx index 21dd6b4..7ca4c3c 100644 --- a/src/components/FileBrowser.jsx +++ b/src/components/FileBrowser.jsx @@ -308,7 +308,13 @@ export default function FileBrowser({ initialPath = '/', rootPath = '/' }) { const toggleSelect = (name) => setSelected(prev => { const next = new Set(prev); next.has(name) ? next.delete(name) : next.add(name); return next; }); - const openCtxMenu = (e, entry, childPath) => { e.preventDefault(); e.stopPropagation(); setCtxMenu({ x: e.clientX, y: e.clientY, entry, childPath }); }; + const openCtxMenu = (e, entry, childPath) => { + e.preventDefault(); e.stopPropagation(); + const menuW = 180, menuH = 320; + const x = e.clientX + menuW > window.innerWidth ? window.innerWidth - menuW - 8 : e.clientX; + const y = e.clientY + menuH > window.innerHeight ? e.clientY - menuH : e.clientY; + setCtxMenu({ x: Math.max(4, x), y: Math.max(4, y), entry, childPath }); + }; return (
0 ? 260 : 0 }}> -
+
Files
-
- {uploadProgress !== null && Uploading {uploadProgress}%} - {clipboard && ( - - )} - {!readOnly && (showFolderInput ? ( -
- setFolderName(e.target.value)} placeholder="Folder name" disabled={Boolean(working)} style={{ fontSize: 12, padding: '3px 8px', borderRadius: 4, border: '1px solid var(--border)', background: 'var(--card-bg-2)', color: 'var(--text-primary)', width: 140 }} /> - Create - -
- ) : ( - - ))} - {!readOnly && ( - <> - uploadFolder(e.target.files)} {...{ webkitdirectory: '' }} /> - uploadFiles(e.target.files)} /> - folderInputRef.current?.click()}>↑ Folder - fileInputRef.current?.click()}>↑ Files - - )} - loadFiles(currentPath)}>⟳ -
+ {uploadProgress !== null && Uploading {uploadProgress}%} + {!readOnly && ( + <> + uploadFolder(e.target.files)} {...{ webkitdirectory: '' }} /> + uploadFiles(e.target.files)} /> + + )}
Drag and drop files or folders here. @@ -413,20 +402,6 @@ export default function FileBrowser({ initialPath = '/', rootPath = '/' }) { - {canGoUp && currentPath !== rootPath && ( - loadFiles(parentPath)}> - - -
-
- -
- Up one folder -
- - - - )} {sortedEntries.map((entry, idx) => { const isDir = entry.type === 'dir'; const childPath = entry.path;