Skip to content

feat(filters): ask only what can narrow the classes here, with live counts - #514

Merged
Ardnived merged 19 commits into
mainfrom
ux/filters-rebuild
Nov 26, 2026
Merged

Ardnived merged 19 commits into
mainfrom
ux/filters-rebuild

Conversation

@Ardnived

@Ardnived Ardnived commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Filters opens straight on Where, Online or in person, Day, Time of day and Language, with Frequency and Dates under "More filters". Each option shows how many classes it leaves, and a question that can't change the results in this place isn't asked.
  • The region list and town field are gone. The place in scope is a removable tag beside Near me, which asks for a location only when pressed and rounds it before it reaches the URL.
  • SearchFilters becomes an organism built on the form kit (feat(forms): one form kit — field wiring, group fields, choice cards, one field height #501). FormField gains an optional per-field Clear.

Change outline

Behaviour — which questions the form asks

Counting goes through the one predicate the list and the map apply, so the numbers can't drift from what Apply shows.

 FilterView                                       src/views/FilterView/FilterView.tsx
+  useFilterFacets(draft)                         src/hooks/use-filter-facets.ts
+    scope = searched place's nearby area + online (the list's own isNearby), else region, else world
+    scopeFacets(scope)   → relevance, judged with nothing picked, so answering never hides a question
+    facetCounts(scope, draft) → per option: that option alone, every other group applied
+      matchesFilters(...)                         src/lib/shape/filters.ts (now caches each class's local occurrences)
   SearchFilters                                  src/components/organisms/SearchFilters/ (was molecules/)
+    shownGroups(draft, facets)                   src/lib/shape/facets.ts
+      a question shows if it can narrow this scope, or is already answered
+      Language shows wherever the classes have one, even only one
+    Where           → WhereFilter: Near me + the place/region as a Chip with ×
+    Online or in person · Day · Time of day · Language → FormField fieldset over Choices (ToggleGroup size="md")
+      an option with count 0 is disabled unless chosen; a chosen language the place lacks stays, at 0
+    Disclosure "More filters" → Frequency · Dates (opens by itself when either is set)
-    Region combobox

Flow — Near me and the place tag

Both move the URL under the open drawer, so a moved place counts as a change to apply.

 WhereFilter                                       src/views/FilterView/WhereFilter.tsx
+  Near me → useNearMe                             src/hooks/use-near-me.ts
+    navigator.geolocation (30s, LOCATE_POSITION_OPTIONS)
+    locatedPlace(coords, feed, { naming })        src/lib/geolocation.ts (shared with the map's find-me)
+      point and frame rounded to 3 decimals; name + country from reverseGeocode, only when the map is on
+    useNearMeState.center = point                 src/config/store.ts (never in the URL)
+    FilterView.pickPlace → /search/filters?center=…&q=…  (draft kept, region dropped)
+  failed → Alert (danger) with the existing message; tapping it sets useSearchFocus and closes the drawer
+    SearchField focuses its input when it next mounts (MutationObserver for the geocoder's late input)
+  × on the tag → FilterView.clearWhere → <origin>/filters with no place and no region
 DrawerStack                                       src/views/DrawerStack/DrawerStack.tsx
+  viewLayerKey(top): the filters layer keeps one key across /filters → /search/filters, so the form doesn't crossfade

Components — the form kit

 FormField                                        src/components/molecules/FormField/FormField.tsx
+  clear?: { label, active, onClear }             absent by default
+    a Clear at the end of the label row, in flow; a fieldset names itself with an off-screen legend
+    hidden but in place while inactive, so the row never moves
 ToggleGroup                                      src/components/atoms/ToggleGroup/ToggleGroup.tsx
-  resting label text-gray-11
+  resting label text-foreground                  # every consumer, as the ticket asks

Contract — strings and the embed guide

The five new strings came from SahajCloud (sydevs/SahajCloud#1285, deployed) and were added from production. The six now-unread keys are in RETIRING_KEYS against sydevs/SahajCloud#1286.

 src/config/translations.en.json
+  filters.where.label · filters.where.near_me · filters.format.question · filters.days.short_label · filters.more.label
 docs/embedding.md § Permissions Policy
-  geolocation: the map's "find my location" control
+  geolocation: the map's "find my location" control and the filters' Near me (map-less embeds too)

Preview

Preview pending: Cloudflare publishes the branch aliases once this push builds. Routes to open at 390×844:

  • /filters shows Where (Near me), Online or in person, Day, Time of day, Language and More filters
  • /gb/filters shows counts, zero options greyed out, and the United Kingdom tag. Its × moves the form onto the unscoped search
  • /cz/filters asks no format question
  • /gb/filters?cadence=WEEKLY opens More filters with Weekly selected
  • /calendar/filters has no Where heading
  • Ladle: Organisms / Search Filters, with and without counts

Contract impact

Test results

  • Lean gate: ✓ lint, typecheck, unit lane (2621 passed, 1 skipped)
  • New specs: facets.test.ts (counts against matchesFilters, relevance, shownGroups), SearchFilters.test.tsx (hidden questions, disabled options, a kept language, the dropdown, More filters opening by itself), FormField.test.tsx (the optional Clear)
  • Security review: ran because src/lib/shape/path.ts matched the trigger pattern. No findings.
  • Build: N/A locally, CI builds it

Manual verification

  1. At 390×844, /gb/filters: tap Near me (DevTools > Sensors > London). The URL's center= has 3 decimals and Apply appears. Reload, and the tag shows the place name.
  2. Block location and tap Near me, then tap the message. The drawer closes onto the list's search box, focused.
  3. At 375×667, open More filters. From and To both sit inside the sheet.
  4. /search?region=gb lists only UK classes.

Notes for reviewer

  • Checked in headless Chromium only. The date fix and the small-phone form have not been tried on a real iPhone.

  • Only the five strings were added, not a full translation sync. A full sync still carries compact.open's removal, which breaks CompactEmbedView until feat(widget): open every embed inline; expand the map over the page #466. The five values are copied exactly from production.

  • Applying each tap at once is not in this PR. The draft-and-Apply model stays; that change is the g-filters-phone ticket. A moved place now counts as a change, so Apply survives Near me; X still discards everything, the place included.

  • Two copies of origin/main were merged in (feat(forms): one form kit — field wiring, group fields, choice cards, one field height #501 form kit, feat(a11y): one focus outline, and forms that start in their first field #510 focus outline). Only ToggleGroup conflicted: I took main's line with the new label colour.

  • Dismissed review findings:

    • "Near me's on-state could match a place reached another way": only a typed search landing on the identical 3-decimal point, and geocoder results aren't rounded.
    • "Wire the language dropdown to the legend": it is named by the same filters.language.label text.
    • "Generic action slot instead of clear": the per-field Clear was asked for as a FormField parameter.
    • "Cache weekday/hour instead of DateTime": a few MB at the current feed size.
  • Local adversarial review (a fresh sub-agent, review-pr method). Adopted:

    • matchesFilters had lost its docblock to the new cache.
    • The cache now records its measurement: 50 ms → 3 ms per tap over 460 classes.
    • One locatedPlace is shared by find-me and Near me.
    • The useSearchFocus request replaces the polling.
    • FormField's Clear sits in the label row's flow.
    • viewLayerKey is named and specced, and the place-path helpers are specced.
    • The CSP row names Near me's reverse lookup.
    • A stray indent edit in the guide is reverted.
    • nearbyLimitKm is now private.

    Answered without a change:

    • The region-name lookup matches ActiveFilterPills:53.
    • The language dropdown past 4 is the ticket's proposal.
    • The Near me store needs no clearing, since only an identical 3-decimal point could match.
    • On the calendar, × moves the form to /calendar/filters with no place, which is intended.

🤖 Generated with Claude Code

Ardnived and others added 10 commits November 26, 2026 12:08
…ounts

Filters opens straight on Where, Online or in person, Day, Time of day and
Language, with Frequency and Dates under "More filters" (open by itself when
either is set). A question that cannot change the results in this place is
not asked (shownGroups); every option shows how many classes it leaves, and
one that leaves none is disabled unless selected. The region combobox is
gone: the place in scope is a removable tag beside Near me, which asks for a
position only when pressed and rounds it before it reaches the URL.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	src/components/atoms/ToggleGroup/ToggleGroup.tsx
#	src/config/translations.test.ts
Each question is a FormField fieldset over a size="md" ToggleGroup, and
Frequency and Dates sit in the Disclosure atom. FormField gains an optional
Clear at the end of its label row, outside the legend, so a group keeps the
question as its name; it is hidden but keeps its place while the field is
empty.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Only the five keys sydevs/SahajCloud#1285 shipped: a full sync still carries
other tickets' drift (compact.open) until #466.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	src/components/atoms/ToggleGroup/ToggleGroup.tsx
Review findings:
- Near me and the place tag move the URL under the drawer, so a moved place
  now counts as a change to apply; Apply no longer vanishes after Near me.
- Removing the place tag over a region's page moves the drawer onto the
  unscoped search, so the list behind it stops naming that region.
- A chosen language the place lacks stays in the options (count 0), so it can
  still be undone; a location fix no longer drops answers tapped meanwhile.

Simplify:
- One predicate: the occurrence cache moves into matchesFilters, so facet
  counts call it directly; EVENT_CADENCES and FilterableEvent are shared.
- The facet scope uses the list's own nearby rule (isNearby, now exported
  from reveal.ts), useSearchCountry and isOnline.
- coarsePoint and LOCATE_POSITION_OPTIONS live in lib/geolocation for both
  the map's find-me and Near me.
- One Choices component for every question's options; the place tag is the
  Chip atom with the short place name.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sydevs-dispatcher

sydevs-dispatcher Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

🤖 no session running
CI fix 1

recent dispatches
  • 12:51Z fix-ci · attempt 3 · session · done
  • 12:51Z fix-ci · attempt 3 · session
  • 03:21Z fix-ci · attempt 2 · session · timed out
  • 03:21Z fix-ci · attempt 2 · session
  • 21:52Z fix-ci · attempt 1 · session · timed out

Written by the sydevs dispatcher. Sessions never edit this comment.

@sydevs-dispatcher sydevs-dispatcher Bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 26, 2026
@sydevs-dispatcher sydevs-dispatcher Bot moved this from Pending to Working in SYDevelopers Technical Roadmap Nov 26, 2026
Ardnived and others added 9 commits November 26, 2026 14:54
Both ways to locate the visitor now share how a fix becomes a place: the
point and its frame rounded, then the name and country from the reverse
lookup. Each keeps its own timing. The map's find-me frame is now rounded
as well.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A one-shot useSearchFocus request, honoured by SearchField when it mounts,
replaces polling the widget root for the input.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
No absolute position or reserved padding: a longer label or a translated
Clear wraps instead of colliding. A fieldset with a Clear names itself with
an off-screen legend beside the visible row.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
viewLayerKey holds the filter drawer's one identity across /filters and
/search/filters, with a spec; placeFiltersPath and noPlaceSearch get theirs;
nearbyLimitKm is private to reveal.ts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Seven gapped days measured 39px wide in the accessibility gate. The strip is
now one segmented control, and its story renders at the sheet's width.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Ardnived
Ardnived merged commit eda30e1 into main Nov 26, 2026
14 checks passed
@Ardnived
Ardnived deleted the ux/filters-rebuild branch November 26, 2026 22:25
@sydevs-dispatcher sydevs-dispatcher Bot moved this from Working to Done in SYDevelopers Technical Roadmap Nov 26, 2026
Ardnived added a commit that referenced this pull request Nov 26, 2026
* chore(ui): remove the Combobox atom, cmdk and Radix Popover

Nothing has rendered the Combobox since the filter form dropped its region
list (#514), and it was cmdk's and Radix Popover's only user. The panel
recipe it shared with Select folds back into Select, and the Search glyph
leaves the Icons gallery with its last call site.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(ui): the popper spec now guards the menu skin alone

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Ardnived added a commit to sydevs/SahajCloud that referenced this pull request Nov 26, 2026
…no longer reads (#1291)

* chore(translations): drop the six atlas filter keys the rebuilt form no longer reads

filters.region (all four keys, so the whole group and its column),
filters.days.label and filters.language.empty leave sy-atlas-translations:
the widget's filter form reads none of them since sydevs/SahajAtlasWeb#514.
A generated migration drops the region columns; a data-only one sweeps the
two keys from every locale and version row, as #1284 did.

Closes #1286

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* style: format the schema spec

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
@sydevs-dispatcher sydevs-dispatcher Bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 27, 2026
@sydevs-dispatcher sydevs-dispatcher Bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Nov 27, 2026
@sydevs-dispatcher sydevs-dispatcher Bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 27, 2026
@Ardnived Ardnived removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

1 participant