Skip to content

feat(palette): command palette overlay bound to cmd/ctrl+k on home#38

Merged
srfwb merged 12 commits into
mainfrom
feat/command-palette
Apr 25, 2026
Merged

feat(palette): command palette overlay bound to cmd/ctrl+k on home#38
srfwb merged 12 commits into
mainfrom
feat/command-palette

Conversation

@srfwb
Copy link
Copy Markdown
Owner

@srfwb srfwb commented Apr 24, 2026

Summary

Turns the inert search bar on Home into a real command palette. Cmd+K / Ctrl+K (⌘K on macOS, Ctrl K elsewhere) or a click on the Home search bar opens a backdropped overlay with grouped results. Lives behind a partial scaffold that was sitting untracked in src/palette/ — this PR plugs the sources, filter, renderer, shortcut listener and styles around it.

Scope for v1: Home only. The IDE toolbar placeholder is untouched — a follow-up PR can decide whether to bridge it or drop it.

Groups shown:

  • Reprendre — top 5 projects by lastOpenedAt, minus the active one
  • Fichiers — files from the active project's VFS (empty when no project is active)
  • Commandes — typed registry (v1: "Nouveau projet")
  • Leçons — single placeholder row that toasts "Bientôt disponible" on select

What changed

User-facing

  • On Home, Cmd+K / Ctrl+K opens the palette. The badge next to the Home search bar adapts to the host OS (⌘K on Mac, Ctrl K elsewhere).
  • Clicking the Home search bar also opens the palette — no more dead input.
  • Typing filters live with case-insensitive substring match; the matched substring is highlighted with a <mark> amber tint.
  • ↑ / ↓ navigate, Enter runs the selected row, Escape closes (focus returns to where it was via useModalA11y).
  • Choosing a file switches the view to IDE and opens that file in one step.
  • Choosing a project opens it (same path as clicking a project card).
  • On IDE view the shortcut does nothing — the existing IDE shortcuts (Ctrl+N, Ctrl+W, Ctrl+Tab) stay untouched.

Internal

  • src/palette/ — new module. types.ts grows PALETTE_GROUP_ORDER and PALETTE_GROUP_LABELS; paletteStore.ts (open/query singleton), formatShortcut.ts (OS-adaptive modifier), commands.ts (typed registry), sources.ts (aggregator reading live stores), filterPaletteItems.ts (pure substring matcher with title/subtitle ranking), highlightMatch.tsx (wraps the matched slice in <mark>), iconForFile.ts (path → glyph + tone), CommandPalette.tsx (overlay with grouped results, keyboard nav, useModalA11y), useCommandPaletteShortcut.ts (window keydown listener with view === "home" guard).
  • src/App.tsx — renders <CommandPalette /> next to <Toasts /> and binds the shortcut hook.
  • src/home/sections/HomeSearch.tsx — no more disabled input, now a clickable trigger that opens the palette. shortcutLabel("K") replaces the hardcoded Ctrl K.
  • src/styles/global.css — new .palette-* class family (~300 lines). All token-based — new oklch values only for the per-type icon tones.
  • Vitest coverage grows by 34 tests (130 total): helpers, registry, filter, highlight, format-shortcut, CommandPalette smoke.

@srfwb srfwb merged commit 34a743e into main Apr 25, 2026
2 checks passed
@srfwb srfwb deleted the feat/command-palette branch April 25, 2026 04:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant