feat(frontend): add Spotlight-style command palette with recent tracking

- Add CommandPalette component with keyboard navigation (arrows, Enter, Shift+Enter, Esc)
- Add useCommandPaletteStore Zustand store with localStorage-persisted recently viewed
- Show two distinct sections: Library results and TMDB Results (no duplicates)
- Exclude library entries from TMDB Results section by TMDB ID index
- Add "View all" links: Library section → /library, TMDB section → /search
- Persist non-library TMDB entries in localStorage for recently viewed support
- Register global Ctrl+P / Cmd+P / slash shortcuts in AppLayout
- Track entry visits in EntryDetailsPage for recently viewed
- Track TMDB preview visits in TmdbPreviewPage for recently viewed
- Updated related docs files

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
Mohammed AbadandCopilot committed 2026-05-04 08:33:27 +01:00
1 parent 4303b33677
commit 3448142242
9 files changed
+710 -3

No files matched your search

+41
View File
@@ -99,6 +99,47 @@ Uses Zustand `persist` middleware:
---
## useCommandPaletteStore
> [!info] File: `stores/useCommandPaletteStore.ts`
Manages [[Components#Command Palette|CommandPalette]] open/close state and recently viewed history.
### State
| Field | Type | Description |
|---|---|---|
| `isOpen` | `boolean` | Whether the palette is currently visible |
| `recentlyViewed` | `RecentItem[]` | Up to 10 recently visited entries (library + TMDB-only) |
### RecentItem Shape
```typescript
interface RecentItem {
id: string; // "lib-{id}" or "tmdb-{tmdbId}"
title: string;
type: 'movie' | 'tv';
poster_path: string | null;
libraryId?: number; // set for library entries
tmdbId?: number; // set for TMDB or library entries
}
```
### Actions
| Action | Description |
|---|---|
| `open()` | Open the palette |
| `close()` | Close the palette |
| `toggle()` | Toggle open/close |
| `addRecentlyViewed(item)` | Prepend to recents list (deduped by `id`, capped at 10) |
### Persistence
`recentlyViewed` is read from and written to `localStorage` key `showy-recent-viewed` on every `addRecentlyViewed` call (no Zustand persist middleware — manual).
---
## useLibraryFiltersStore
> [!info] File: `stores/useLibraryFiltersStore.ts`