feat(FileManager): improve entry action handling for files and folders
This commit is contained in:
parent
435a1b38c0
commit
30e9c0949a
|
|
@ -760,7 +760,11 @@ export default function FileManager({ initialPath = '/', config, setConfig, onBa
|
||||||
className="w-4 h-4 flex-shrink-0"
|
className="w-4 h-4 flex-shrink-0"
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
onClick={() => void openEntry(entry)}
|
onClick={() => {
|
||||||
|
if (renameEntry !== null) return;
|
||||||
|
if (entry.type === 'folder') navigateTo(joinPath(path, entry.name));
|
||||||
|
else setMountEntry(entry);
|
||||||
|
}}
|
||||||
className="flex-1 flex items-center gap-3 text-left min-w-0"
|
className="flex-1 flex items-center gap-3 text-left min-w-0"
|
||||||
>
|
>
|
||||||
<EntryIcon entry={entry} />
|
<EntryIcon entry={entry} />
|
||||||
|
|
@ -835,19 +839,39 @@ export default function FileManager({ initialPath = '/', config, setConfig, onBa
|
||||||
</DialogDescription>
|
</DialogDescription>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
<div className="flex flex-col gap-2">
|
<div className="flex flex-col gap-2">
|
||||||
{/* Default open */}
|
{/* Folder: open */}
|
||||||
<button
|
{actionEntry?.type === 'folder' && (
|
||||||
onClick={() => { const e = actionEntry; setActionEntry(null); if (e) void openEntry(e); }}
|
<button
|
||||||
className="w-full text-left px-4 py-3 rounded border border-neutral-200 hover:bg-blue-50 hover:border-blue-300 inline-flex items-center gap-3"
|
onClick={() => { const e = actionEntry; setActionEntry(null); if (e) void openEntry(e); }}
|
||||||
>
|
className="w-full text-left px-4 py-3 rounded border border-neutral-200 hover:bg-blue-50 hover:border-blue-300 inline-flex items-center gap-3"
|
||||||
{actionEntry?.type === 'folder'
|
>
|
||||||
? <Folder className="w-4 h-4 text-blue-600" />
|
<Folder className="w-4 h-4 text-blue-600" />
|
||||||
: <Eye className="w-4 h-4 text-blue-600" />}
|
<span>Open folder</span>
|
||||||
<span className="flex-1">{actionEntry?.type === 'folder' ? 'Open folder' : 'Open / View'}</span>
|
</button>
|
||||||
{actionEntry?.type === 'file' && (
|
)}
|
||||||
|
|
||||||
|
{/* File: mount (primary default) */}
|
||||||
|
{actionEntry?.type === 'file' && (
|
||||||
|
<button
|
||||||
|
onClick={() => { const e = actionEntry; setActionEntry(null); if (e) setMountEntry(e); }}
|
||||||
|
className="w-full text-left px-4 py-3 rounded border border-neutral-200 hover:bg-blue-50 hover:border-blue-300 inline-flex items-center gap-3"
|
||||||
|
>
|
||||||
|
<HardDrive className="w-4 h-4 text-amber-600" />
|
||||||
|
<span>Mount on virtual drive</span>
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* File: open/view */}
|
||||||
|
{actionEntry?.type === 'file' && (
|
||||||
|
<button
|
||||||
|
onClick={() => { const e = actionEntry; setActionEntry(null); if (e) void openEntry(e); }}
|
||||||
|
className="w-full text-left px-4 py-3 rounded border border-neutral-200 hover:bg-neutral-50 inline-flex items-center gap-3"
|
||||||
|
>
|
||||||
|
<Eye className="w-4 h-4 text-blue-600" />
|
||||||
|
<span className="flex-1">Open / View</span>
|
||||||
<span className="text-xs text-neutral-400">{VIEWER_LABEL[defaultViewMode(actionEntry)]}</span>
|
<span className="text-xs text-neutral-400">{VIEWER_LABEL[defaultViewMode(actionEntry)]}</span>
|
||||||
)}
|
</button>
|
||||||
</button>
|
)}
|
||||||
|
|
||||||
{/* Alternate viewers */}
|
{/* Alternate viewers */}
|
||||||
{actionEntry?.type === 'file' && availableViewers(actionEntry)
|
{actionEntry?.type === 'file' && availableViewers(actionEntry)
|
||||||
|
|
@ -875,15 +899,6 @@ export default function FileManager({ initialPath = '/', config, setConfig, onBa
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{actionEntry?.type === 'file' && (
|
|
||||||
<button
|
|
||||||
onClick={() => { const e = actionEntry; setActionEntry(null); if (e) setMountEntry(e); }}
|
|
||||||
className="w-full text-left px-4 py-3 rounded border border-neutral-200 hover:bg-neutral-50 inline-flex items-center gap-3"
|
|
||||||
>
|
|
||||||
<HardDrive className="w-4 h-4 text-amber-600" /> <span>Mount on virtual drive</span>
|
|
||||||
</button>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<div className="border-t border-neutral-100" />
|
<div className="border-t border-neutral-100" />
|
||||||
|
|
||||||
<button
|
<button
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user