Repository navigation
feat(search): event filters — drawer, shared predicate, pills, distance cap - #39
Merged
Merged
Conversation
Wrap @radix-ui/react-slider (range, one thumb per value) and @radix-ui/react-toggle-group (pill-style single/multi-select) on the brand tokens, with stories. Building blocks for the event-filters panel (#38). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Extract the drawer header's icon-button chrome from views/shared into an IconButton atom so the close, list-toggle, and new filter buttons render identically side by side. Migrate CloseButton/CollapseToggle. Add a funnel FilterIcon for the filters trigger (#38). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The single pure predicate the events list and the map both apply, so a filtered list and the filtered pins/clusters agree. Day + time evaluate together per upcomingDates occurrence in the event's own timezone (viewer's for online, UTC fallback); events without occurrences are excluded only while a day/time filter is active. Includes DEFAULT_FILTERS, active-filter helpers, and a stable filtersKey for the query cache. Fully unit-tested. Part of #38. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
useSearchState now holds the full EventFilters model (format, timeOfDay, daysOfWeek, languages, cadence) with granular setters and clearFilters, seeded from DEFAULT_FILTERS. Day/language arrays are kept sorted for stable identity. Part of #38. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
A drawer-header filter button (IconButton + active-count badge) opening the filter panel: Format, Frequency, Day-of-week, Time-of-day (two-handle range), and Language. Desktop renders a floating-ui popover anchored to the button; below md the same panel is a Radix Dialog bottom-sheet. Language options derive from the cached geojson feed, labelled per locale; the time slider commits to the store only on release. English strings under `filters.*`. Part of #38. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Render SearchFilters between the search field and the close/collapse control in CountriesView and SearchView. Part of #38. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
getEvents applies the shared matchesFilters predicate to the feed before the nearest-N slice (no starvation), keyed by the filter state. Map.tsx derives a useMemo-filtered FeatureCollection from the same filters so pins AND cluster counts track the list. SearchView wraps the list in a local Suspense boundary so a filter change reloads only the list, keeping the header + open filter panel mounted. Closes #38. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Add the `filters.*` block to all 10 locales (en + 9 translations) in key-sync, and retire the now-unused show_online_classes / showing_online_classes keys that the removed onlineOnly toggle used. Part of #38. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
- Export a shared useEventFilters() selector hook from the store; the events list and the map both use it instead of duplicating the useShallow slice. - FilterPanel reads the (filter-only) store directly instead of projecting an identical slice, and passes it straight to hasActiveFilters. - Export isTimeRestricted from the shape layer; FilterPanel reuses it. - clearFilters resets with set(DEFAULT_FILTERS); the map reuses the feed as-is when no filter is active (skips the filtered copy in the common case). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
- Freeze DEFAULT_FILTERS (and its arrays) so store state seeding/clearing can safely alias them (removes a latent mutation hazard). - Cadence 'once' now requires a schedule — a schedule-less event is unknown cadence, not one-time (+ test). - Fold the active-filter count into the trigger's accessible name so assistive tech knows filters are active. - Soften comments that overstated list/map parity (online events have no map geometry; the list is capped at NEAREST_LIMIT) and document the null-tz→UTC fallback in matchesFilters. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Deploying atlas-legacy with
|
| Latest commit: |
1d81e62
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://e788b961.syatlas.pages.dev |
| Branch Preview URL: | https://feat-search-filters.syatlas.pages.dev |
Address filter-panel feedback by treating filters as a first-class drawer, consistent with the URL-driven drawer stack: - Add a routed `filters` stack entry; the header button navigates to `/filters` (or `/search/filters`, preserving the search query so closing returns to the same search) instead of opening a bespoke popover/dialog. - New FilterView drawer with the standard header + close chrome and stacking, so it has an obvious close affordance and reads as clearly distinct from the panel beneath it (fixes the "no close" + "not distinguished" feedback). - Gut SearchFilters to just the filter form (deletes the floating-ui popover + Radix Dialog dual-shell the reviewers flagged as duplicating Drawer/Dropdown). - Language filter is now a multi-select Dropdown (scales as more languages appear) instead of an inline checkbox list. - Drop the SearchView inner Suspense (filter changes happen in FilterView now, not in the search header). Preserve `/search` query on stack pop-navigation. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
- ToggleGroup renders one Radix Root by spreading the discriminated props union (assignable to Radix's own overloads) instead of per-type arms. - Add a `joined` segmented-control variant (flush, shared borders, rounded outer corners) via a small context; apply it to the single-select Format/Frequency filters. Day-of-week stays separate pills. - Language dropdown trigger shows the selected language names (truncated) instead of an opaque count. - Align the settings cog's top with the drawer's floated top edge at >= lg (lg:top-4), unchanged on mobile/tablet. - Theme options now read "Light Theme" / "Dark Theme" / "System (Auto)". Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…days - Joined segmented items use natural width per item (a single row) instead of stretching to equal full-width parts. - Each filter group shows a small "Clear" link after its label when active, resetting just that filter (adds setLanguages to the store for the language reset). "Clear all" stays in the drawer footer. - Slightly reduce the toggle-group item size (h-8 / px-2) so the seven 3-char weekday pills fit on one line, applied uniformly across all filter groups for consistency. The full weekday name is each pill's accessible label. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…er pills - Filters no longer apply live. The FilterView form is now a controlled component editing a local draft; the footer's primary "Apply (N)" button — N = events matching the draft — commits it to the store (setFilters) and closes the drawer. "Clear all" and per-filter clears stay draft-only until Apply. - Add a "Daily" frequency option (EventCadence gains DAILY; predicate already matched it). - The events list shows an alert when nothing matches, with a "clear all filters" link when active filters are the cause. - ActiveFilterPills renders the applied filters as removable pills above the search results; each pill's X clears that filter immediately. - New i18n across all locales (apply / apply_count / cadence.daily / no_results / no_events / remove). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…apply_count - Add a `radius` (sm | full) variant and an `onClose` remove button to the Chip atom (+ stories); ActiveFilterPills now uses Chip instead of a bespoke pill. - Collapse the day-of-week and language selections into a single pill each (e.g. "Mon, Wed, Fri"), so stacking many no longer floods the row; the pill's X clears that whole filter. - Rename the Apply button's interpolation variable from `count` to `total` so i18next doesn't treat it as a pluralization trigger (which logged missing-key warnings for apply_count_one/_other). `filters.cadence.daily` was already present in every locale. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…, stories
- Apply button now shows only when the draft differs from the applied filters.
- "Clear all" resets AND applies + closes the drawer (like Apply, with defaults).
- Build the Apply label in code (`Apply (N)`) instead of an i18n interpolation
so it can never show a raw `%{...}` placeholder; drop the now-unused
apply_count key from all locales.
- Active-filter chips use the neutral/default colour.
- Chip story now covers every configuration (colour x variant, emphasis, size,
radius, removable) in dedicated sections, not just the in-context examples.
- Add a story for ActiveFilterPills.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
- FilterView Apply/Clear-all always navigate to /search (preserving the query) so the filtered results show — even when the drawer was opened over the country list, rather than returning to the countries. - Move ActiveFilterPills into its own molecule folder and render it from the events list (DynamicEventsList), so the pills are list chrome. Extract the shared formatHour helper to @/lib. - Add a dismissable "< 500 km" cap on the search results: when a place has been searched (a geocoded center) and the matching in-person events include farther ones, the list is capped to nearby and a "< 500 km" pill appears. Dismissing it reveals the far events; online events (no location) are never distance-excluded. The cap is list-only (the map still shows all matching pins). - MapSearch placeholder → "Search for events near…". - New i18n (filters.nearby, search_placeholder) across all locales. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Drop the Geocoder theme's base font unit 16px→14px so the input and placeholder text are smaller and the "Search for events near…" hint fits without truncation. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
- Collapse the cadence value→i18n-key maps (both were just `.toLowerCase()`) — flat CADENCE_OPTIONS array; the pill uses cadence.toLowerCase() directly. - Remove the dead `toggleLanguage` store action (no callers; setLanguages covers every path) + its test. - Add a guarded `languageLabel` to useLocale and reuse it in the form + pills (was copy-pasted try/catch in both). - Extract `selectTriggerClass` from the Select atom; the language multi-select trigger reuses it (dedup + the focus-ring/transition it was missing). - Move the "< 500 km" cap dismissal to a URL `?all` param so it survives the drawer stack's remount-on-navigation and the filter round-trip (was local useState, silently reset on every remount); reset on a new search; only re-frame the map on center/bbox changes. - Efficiency: sort the events list via decorate-sort-undecorate (compute each order once, not O(n log n) luxon builds); short-circuit FilterView's live count when the draft is all-default. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
- Distance-cap empty state: show a distance-specific message ("No events within
N km.") when the < 500 km cap — not the filters — is what emptied the list,
instead of the misleading generic "No events found." (the "< N km" pill above
remains the way to reveal the far events). New filters.no_nearby string.
- Sort fallback: use `event.distance ?? 100` so a genuine 0 km distance isn't
treated as the online/undistanced fallback.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
14 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds event filtering to the widget: a filter button beside the map search opens a
dedicated filter drawer whose settings narrow the events shown in the search list and
the pins/cluster counts on the map — via one shared predicate, so the two never disagree.
one-time), Day-of-week, Time-of-day (a two-handle range), and Language (multi-select,
options derived from the live feed). Replaces the unused
onlineOnlytoggle./filters, or/search/filtersover a search) — standardclose/stacking chrome — not a popover. Editing is deferred: an "Apply (N)" button
(N = matching events) commits and shows the results; "Clear all" resets and applies.
searched place has only far results (dismissable → shows the far ones). A no-results
alert with a clear-filters link. Search hint → "Search for events near…".
Changes
src/lib/shape/filters.ts—EventFiltersmodel + the pure, unit-testedmatchesFilterspredicate (day+time evaluated per
upcomingDatesoccurrence in the event's own timezone),activeFilterCount,filtersKey.src/config/store.ts—useSearchStateholds the applied filters;useEventFiltersis theshared selector the list + map read.
filtersis a routed drawer entry (src/lib/shape/path.ts+DrawerStack);src/views/FilterView/is the drawer,src/components/molecules/SearchFilters/thecontrolled form,
ActiveFilterPills/the pills.Slider,ToggleGroup(segmented single-select),Button/IconButton;Chipgains a
radius/onClose(removable) variant.?all=1) so it survives drawer remounts.public/locales/*— newfilters.*/search_placeholderstrings across all 10 locales.Verification
pnpm lint) · Types: ✓ (pnpm typecheck)matchesFilters+ the store(
pnpm test:run)pnpm build) +pnpm ladle:build(stories for the new atoms, the form, and thepills)
Manual / visual verification
Verified in the running widget: the filter drawer (desktop + the segmented controls),
deferred Apply →
/search(incl. from the country list), the removable pills, the neutralchip styling, the no-results alert, the smaller search placeholder, and the theme/cog tweaks.
Still needs a data-backed check: the "< 500 km" distance cap couldn't be exercised
live — the remote backend's
/events/geojsonis CORS-blocked from the browser, so there wasno distance data to trigger it. Please confirm against a local backend with seeded events.
Notes for reviewer
This PR grew well beyond the original "filter button" scope through the Adjust phase (deferred
Apply, the filter drawer, pills, the distance cap). Design decisions:
matchesFilters. The "< 500 km" cap islist-only (the map still shows all matching pins — consistent with the existing
list-is-nearest-N / map-is-all model); online events (no location) are never
distance-excluded.
SearchFiltersdoesn't use theDropdownatom for a shell (it's adrawer now); the language multi-select can't use the single-select
Selectcomponent butreuses its extracted
selectTriggerClass.eventCountbadges don't react tofilters; no
?filters=URL persistence of the filter values (drawer-open state is URL-driven,values are zustand); the
toStackTargetroute-preservation rule could be lifted out ofDrawerStack for FilterView to share.
Commits are unsigned (SSH/1Password agent cache expired mid-session — a known issue); GitHub
shows them "Unverified" but they're otherwise fine on a feature branch.
Closes #38
🤖 Generated with Claude Code