Repository navigation
Description
Summary
Replace the icon-only filter button in the drawer header with an explicit, labeled toolbar at the top of the event list. The Search results list gets a Filters button (opening the existing FilterView) plus a Sort by menu — Recommended (default), Closest, Soonest — persisted in the URL so a shared link keeps its sort. The root Countries list keeps a Filters-only button (sorting a browse index of countries has no meaning). This surfaces sorting — today a hardcoded relevance score with no UI — and turns filter access into a legible labeled control instead of a bare funnel glyph. Modeled on the Aesop "Filters / Sort: Featured ⌄" toolbar (screenshot in the discussion).
Proposed changes
Remove the header filter button
- Drop
<FilterButton />from the SearchView header (src/views/SearchView/SearchView.tsx:79) and the CountriesView header (src/views/CountriesView/CountriesView.tsx:79). The header keeps the search field + close/collapse controls only.
Add a list toolbar
- New molecule (e.g.
ListToolbar) at the top of the list — above theActiveFilterPillsrow — laying out a left-aligned Filters button and a right-aligned Sort by menu (ajustify-betweenflex row), mirroring the screenshot. - Filters button — a labeled ghost
Button(variant="ghost") that opens the FilterView by navigating to<current>/filters(the existingFilterButtonbehavior,src/views/shared.tsx:155-182), preserving the current query. Keep the active count in the label (e.g.Filters (2)) viaactiveFilterCount(useEventFilters()). - Sort menu — a ghost
Buttontrigger showingSort: <current label>with aDownArrowIconcaret, opening a menu of the three options with a check on the active one. Reuse the selectable-menu pattern fromSettingsMenu(src/components/molecules/SettingsMenu/SettingsMenu.tsx): RadixDropdownMenu.RadioGroup+RadioItem+ItemIndicator+CheckIcon. Do not use the floatingDropdownatom (no selection model) or theSelectatom (form-field look, no checkmark). - Render both controls on SearchView; render the Filters button only on CountriesView.
Sort orderings (applied client-side, no refetch)
- Store the selection in the URL as
?sort=(defaultrecommended, omitted). It is presentation, not a predicate: keep it out offiltersToParams/filtersFromParams, out offiltersKey(no refetch), out ofmatchesFilters, and out ofactiveFilterCount(never lights the badge). - Apply it at the existing re-sort step in
DynamicEventsList(src/components/organisms/EventsList/EventsList.tsx:66-71) by choosing a comparator:- Recommended (default) — current
calculateOrderrelevance score (src/components/organisms/EventsList/EventsList.tsx:32-43). - Closest — ascending
distance(a.distance ?? Infinity); placeless/online last. - Soonest — existing
byNextOccurrence(src/lib/shape/event.ts:32), keyed onschedule.upcomingDates[0]; undated last.
- Recommended (default) — current
- A small hook pair (e.g.
useSortOrder/useSetSortOrder) reads/writes?sort=with a{ replace: true }navigation that preserves all other params (mirroruseSetFilters, which starts from the previous params —src/hooks/use-filters.ts:33-37). - Carry
sortthrough the two query rebuilds that reconstruct the URL from the filter codec and would otherwise drop it:SearchField.handleSelectandNearbySuggestion.handleSelect(both insrc/views/shared.tsx) callfiltersToParams(filtersFromParams(searchParams))— searching a new place or accepting the nearby prompt must keep the current sort.
i18n
- Add new keys across all locales (not en-only) via
pnpm i18n:add: aSort:/ "Sort by" label and the three option labels. "Filters" already exists (common.json→filters.title). Derive from a sibling string where possible.
Recommended sort options
The three requested — Recommended / Closest / Soonest — already cover the meaningful axes (relevance, space, time) and each maps to an existing comparator, so no new data or API field is needed. An alphabetical (A–Z) option is possible but low-value for a nearby-events atlas — not recommended. Ship exactly the three.
Acceptance criteria
- The icon-only filter button is gone from both the Search and Countries drawer headers.
- SearchView shows a toolbar at the top of the list with a Filters button (left) and a Sort by menu (right), above the active-filter pills.
- The Filters button opens the FilterView and shows the active-filter count in its label; applying filters works exactly as before.
- CountriesView shows the same Filters button at the top of its list, and no sort menu.
- Both controls use the
Buttonatom withvariant="ghost"; the sort trigger shows aDownArrowIconcaret and the current selection. - The sort menu offers Recommended (default), Closest, Soonest, with a checkmark on the active option; selecting one re-sorts the visible list with no network refetch.
- Recommended = current relevance order; Closest = ascending distance; Soonest = next-occurrence order — verified against a seeded feed.
- Selection persists in
?sort=(default omitted); reload / shared link reopens with the same sort; searching a new place or accepting the nearby prompt keeps the current sort. - Sort never counts toward the filter badge and never triggers an events refetch (absent from
filtersKey/matchesFilters/activeFilterCount). - New sort/label keys exist in every
public/locales/*/common.json, not en-only. - Lint + typecheck +
test:run+ build pass. - Verified in the running widget.
Files affected
src/views/shared.tsx— labeled ghostFilterButton; carrysortthroughSearchField+NearbySuggestionrebuilds.src/views/SearchView/SearchView.tsx— drop header button; render Filters + Sort toolbar.src/views/CountriesView/CountriesView.tsx— drop header button; render Filters-only toolbar.src/components/molecules/…— newListToolbar+SortMenumolecule(s) + barrel update.src/components/organisms/EventsList/EventsList.tsx— comparator selection at the re-sort step.src/hooks/use-filters.ts(or a newuse-sort.ts) —useSortOrder/useSetSortOrder.src/lib/shape/— sort-key type + the?sort=param name (separate from the filter codec).public/locales/*/common.json— new labels viapnpm i18n:add.
References
- Screenshot: Aesop "Filters / Sort: Featured ⌄" list toolbar (discussion).
- Selectable-menu precedent:
src/components/molecules/SettingsMenu/SettingsMenu.tsx. - Current relevance sort:
src/components/organisms/EventsList/EventsList.tsx:32-71. - Soonest comparator:
src/lib/shape/event.ts:32(byNextOccurrence). - Filter URL codec / state:
src/hooks/use-filters.ts,src/lib/shape/filters.ts.
Metadata
Metadata
Assignees
Labels
Type
Fields
Hold Until
Activity
docs: document the URL-derived sort slice + new molecules
fix(list): align toolbar with list rows; add Countries search button
fix(list): CountriesView filters via a header icon, not the toolbar
docs: note CountriesView filters via a header icon, not the toolbar
feat(list): move filters to a list toolbar with a sort selector (#77)