From 4f0657aa8d12fb4dd075bdd3c947160f823b0ad8 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Thu, 15 May 2025 03:16:29 -0700 Subject: feat(CommandPalette): Enhanced nested visual indicators --- src/lib/CommandPalette/CommandPalette.svelte | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/lib') 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}` }); } }); - } }); } -- cgit v1.2.3