refactor: compact pill-based filter toolbar
Merge the toggleable multi-line FilterBar and the separate ActiveFilterChips strip into a single always-visible row of pills. Each filter category is a pill that opens a small popover with its underlying control; when active, the pill shows its current value inline (so the chips strip is redundant). - New FilterPill primitive: outside-click + Escape to close, optional inline X to clear without opening the popover. - FilterBar rebuilt out of pills for Date/Type/Rating/Color/Flag/Tags/Sort, with a Clear-all pill on the right when any filter is active. - Drop filterBarOpen from filterStore, the SlidersHorizontal toggle from TopBar, the \\ shortcut from useKeyboardShortcuts, and the matching hint from KeyboardHints — the bar is always visible now. - Delete ActiveFilterChips; its information lives inside the pills. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -43,8 +43,6 @@ export interface FilterState {
|
||||
export const ALL_PHOTOS_SECTION = 'all-photos'
|
||||
|
||||
interface FilterStore extends FilterState {
|
||||
filterBarOpen: boolean
|
||||
|
||||
/** The active section id. Changes via navigateToSection. */
|
||||
currentSection: string
|
||||
/** Per-section snapshot of filter state, in-memory. Restored on return. */
|
||||
@@ -72,9 +70,6 @@ interface FilterStore extends FilterState {
|
||||
setSortOrder: (order: SortOrder) => void
|
||||
toggleSortOrder: () => void
|
||||
|
||||
setFilterBarOpen: (open: boolean) => void
|
||||
toggleFilterBar: () => void
|
||||
|
||||
/** Navigate to a section. Saves the current section's filter state into
|
||||
* the in-memory map under the OLD section id, then loads the saved
|
||||
* state for the destination — or, if none exists, applies the preset
|
||||
@@ -132,7 +127,6 @@ function snapshotFilters(s: FilterState): FilterState {
|
||||
|
||||
export const useFilterStore = create<FilterStore>((set) => ({
|
||||
...INITIAL_FILTERS,
|
||||
filterBarOpen: false,
|
||||
currentSection: ALL_PHOTOS_SECTION,
|
||||
sectionFilters: {},
|
||||
sectionPresets: { [ALL_PHOTOS_SECTION]: {} },
|
||||
@@ -165,9 +159,6 @@ export const useFilterStore = create<FilterStore>((set) => ({
|
||||
toggleSortOrder: () =>
|
||||
set((s) => ({ sortOrder: s.sortOrder === 'desc' ? 'asc' : 'desc' })),
|
||||
|
||||
setFilterBarOpen: (filterBarOpen) => set({ filterBarOpen }),
|
||||
toggleFilterBar: () => set((s) => ({ filterBarOpen: !s.filterBarOpen })),
|
||||
|
||||
navigateToSection: (sectionId, presetOverrides = {}) =>
|
||||
set((s) => {
|
||||
// Snapshot the current section's filters before switching.
|
||||
|
||||
Reference in New Issue
Block a user