diff options
| author | Fuwn <[email protected]> | 2025-05-15 03:16:29 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2025-05-15 03:16:29 -0700 |
| commit | 4f0657aa8d12fb4dd075bdd3c947160f823b0ad8 (patch) | |
| tree | 9870f421ccd5a65d0dfa6f101aa6672c89bef388 /src | |
| parent | feat(CommandPalette): Add nested action support (diff) | |
| download | due.moe-4f0657aa8d12fb4dd075bdd3c947160f823b0ad8.tar.xz due.moe-4f0657aa8d12fb4dd075bdd3c947160f823b0ad8.zip | |
feat(CommandPalette): Enhanced nested visual indicators
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/CommandPalette/CommandPalette.svelte | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/lib/CommandPalette/CommandPalette.svelte b/src/lib/CommandPalette/CommandPalette.svelte index d0e015a5..f493bcac 100644 --- a/src/lib/CommandPalette/CommandPalette.svelte +++ b/src/lib/CommandPalette/CommandPalette.svelte @@ -28,20 +28,24 @@ items.forEach((action, idx) => { const actionMatches = doesActionMatch(action); + let matchedParent = false; - if (actionMatches) filtered.push({ ...action, id: `action-${idx}` }); + if (actionMatches) { + filtered.push({ ...action, id: `action-${idx}` }); - if (action.actions) { + matchedParent = true; + } + + if (action.actions) action.actions.forEach((nestedAction, nestedIdx) => { if (doesActionMatch(nestedAction)) { filtered.push({ ...nestedAction, id: `action-${idx}-nested-${nestedIdx}`, - name: `↳ ${nestedAction.name}` + name: `${matchedParent ? '↳' : `${action.name} >`} ${nestedAction.name}` }); } }); - } }); } |