feat(ui): add 'open parent directory' in recent and favorite section

This commit is contained in:
Edouard Vanbelle
2026-07-20 01:21:48 +02:00
parent 63589e595e
commit 7ffb7bf0ae
4 changed files with 182 additions and 1 deletions
@@ -50,6 +50,16 @@
label: string;
icon: string;
danger?: boolean;
/**
* Optional per-item visibility gate. Called at menu-open time
* with the target item + context; return `false` to hide the
* entry for that row. Synchronous by contract — pages that need
* an async check (e.g. "does the caller have Read on the parent
* folder?") should pre-warm a cache when items load so the
* answer is already resolved by the time this runs. See
* `$lib/utils/folderAccess.ts` for the reference pattern.
*/
visible?: (item: FileItem | FolderItem, ctx?: ItemContext) => boolean;
run: (item: FileItem | FolderItem, ctx?: ItemContext) => void;
}
@@ -1261,6 +1271,9 @@
{/snippet}
{#if ctxOpen && ctxItem && contextActions}
{@const visibleActions = contextActions.filter(
(a) => a.visible?.(ctxItem!, ctxOf(ctxItem!.id)) !== false
)}
<div
class="rl-ctx-scrim"
role="presentation"
@@ -1274,7 +1287,7 @@
role="menu"
data-testid="resource-list-context-menu"
>
{#each contextActions as action (action.key)}
{#each visibleActions as action (action.key)}
<button
class="rl-ctx-item"
class:rl-ctx-item--danger={action.danger}