Skip to content

feat(filters): apply each tap, close onto the matching classes, open at the content's height - #528

Merged
Ardnived merged 9 commits into
mainfrom
feat/filters-sheet
Nov 27, 2026
Merged

Ardnived merged 9 commits into
mainfrom
feat/filters-sheet

Conversation

@Ardnived

Copy link
Copy Markdown
Contributor

Summary

  • Filters apply on each tap, and the X, a swipe, Esc and "Show N classes" all close onto the matching classes. When nothing matches, the filters offer the one change that brings the most classes back.
  • On a phone the sheet opens just tall enough for its questions. Each time of day shows its hours, and Night appears only where classes start then. This applies on every device.
  • Joined by review: time-of-day rows to the design, no rule above More filters, inactive listings counted in every time of day, "(1)" instead of "①" on the Filters button, and a Night story case.

Change outline

Flow — closing the filters (backStep, src/lib/shape/navigation.ts; DrawerStack.tsx)

X, swipe, Esc and "Show N classes" run one decision. The filters keep no draft, so closing shows the answers rather than undoing them.

 dismiss()                                              DrawerStack.tsx
   backStep(location)
+    top entry is `filters` →
+      over /search or /calendar  → to = that view + current query
+      over another view, answered → to = /search?answers&region=<place opened over>
+      nothing answered            → to = the view beneath
+      `from` stamp on the same path as `to` → how: 'history'
+      answered, otherwise          → how: 'replace'   (keeps depth/from; never pops the host)
+      otherwise                    → how: 'climb'
-  step.history ? navigate(-1) : navigate(step.to)
+  'history' → navigate(-1), then a layout effect rewrites the landed entry's query to `to`
+  'replace' → navigate(to, { replace, state })
+  'climb'   → navigate(to, { climbedFrom })
+showResults() → dismiss(), and the results open at the near-full stop

Components — FilterView (src/views/FilterView/)

 FilterView
-  draft state, Apply (N), commit on Apply
+  filters = URL filters + the region it was opened over; each tap writes the URL (replace)
+  footer, pinned to the phone sheet's bottom edge:
+    nothing picked  → Close
+    answered        → Clear all + "Show N classes"
+    no match        → "No classes match" + Clear all + RecoveryButton ("Remove Sunday (37 classes)")
+    no single way out → Clear all becomes the main button
+  fresh link (depth 0) → frames its region, or its searched place, once

Behaviour — counts and times (src/lib/shape/filters.ts, facets.ts)

 TIME_PERIOD_HOURS
-  evening 17–21, night 21–24 + 0–6
+  evening 17–24, night 0–6
 matchesFilters
+  a timeless listing (inactive, no schedule, no session left) passes any time of day; day and date still need a session
+bestRecovery(events, filters) → the answered question whose removal brings back the most, or null
 FacetCounts
+  timeless: how many timeless listings each time count includes (Night is offered only when night − timeless > 0)

Behaviour — the phone sheet (use-fit-snap.ts, DrawerStack.tsx)

 fitsContent = class | share
+            | filters (not the calendar's overlay, which stays full height)
 measure
-  sum of the children's heights
+  contentExtent: the body's top edge to the last in-flow child's bottom margin, plus bottom padding
+sheet-top loop → sheetTall when less than MIN_MAP_STRIP_PX (160) of map is left above
+  → the map's control column hides; the filters also dim the map (z-30)

Preview

  • Preview pending. The Workers alias for the app and Ladle is posted once CI publishes it.
  • Ladle story: Views / Filter, with the Example control set to Nothing picked, A pick, No match, No single way out, or Night classes.

Test results

  • Lean gate (.claude/skills/pr-prep/check.sh): ✓ lint, typecheck, unit lane
  • New specs: the filters' cases in backStep, sameRoute, bestRecovery, timeless counts, contentExtent, parseBounds, FilterView's footer states, and the times of day in SearchFilters
  • Security review: ran (path.ts and globals.css trigger it), no findings
  • Local adversarial review: 2 should-fix and 4 consider, all adopted (see Notes)

Manual verification

  1. At 390×844, open /gb/filters and tap Tue. The URL, the markers and the button change at once ("Show 8 classes").
  2. Open /gb, then Filters, tap Tue, and close with X, then a downward swipe, then Esc on desktop. Each lands on /search?days=2&region=gb, and Back returns to /gb.
  3. Open /gb/filters?days=7&time=evening. It shows "No classes match" with "Remove Sunday (37 classes)".
  4. Open /calendar/filters. The overlay stays full height and reads Close.
  5. On a real iPhone: the sheet grows when More filters opens, and the keyboard over the sheet (untested).

Notes for reviewer

Detail
  • parseBounds moved to path.ts, and MIN_MAP_STRIP_PX to config/responsive.ts, because each now has a second caller.
  • The time-of-day icons are Lucide's Sunrise, Sun, Moon and MoonStar (chosen in review).
  • Rethink Sans draws "(1)" to "(20)" as circled digits through liga. The literal-count utility turns that off on the Filters button only.

🤖 Generated with Claude Code

Ardnived and others added 9 commits November 26, 2026 17:32
…at the content's height

The filters keep no draft. Each tap writes the URL, so the markers behind the
sheet and the bottom button's count change at once. The button reads Close
with nothing picked and "Show N classes" with an answer, beside Clear all.
When nothing matches, the filters say so and offer the one removal that brings
the most classes back (bestRecovery), or make Clear all the way out.

Closing by X, swipe, Esc or "Show N classes" runs one decision, backStep: over
the search or the calendar it steps back there and rewrites the landed entry's
query to the answers; over any other view, answers replace the filters' own
entry with the search scoped to that place. It never pops the host's history.

On a phone the sheet opens just tall enough for its questions, with the bar
pinned to the bottom edge, and grows as More filters opens. The fit measure now
runs from the body's top to the last child's bottom margin, so gaps count. A
sheet leaving less than the map strip hides the control column, and the
filters dim what is left. A fresh link frames its place once.

Each time of day shows its hours through the shared formatter. Evening runs
17-24 and Night 0-6, offered only while classes in view start then.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rs and a count; no rule above More filters

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Inactive listings ("Contact host for timings") name no session, so no time of day can rule
them out. Night still shows only where a class really starts then.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Rethink Sans draws "(1)" to "(20)" as circled digits through a standard ligature; the
literal-count utility turns common ligatures off for the Filters button's count only.

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

sydevs-dispatcher Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

🤖 no session running

recent dispatches
  • 12:52Z review-pr · attempt 3 · session · done
  • 12:52Z review-pr · attempt 3 · session
  • 03:22Z review-pr · attempt 2 · session · timed out
  • 03:22Z review-pr · attempt 2 · session
  • 00:49Z review-pr · 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 27, 2026
@sydevs-dispatcher sydevs-dispatcher Bot moved this from Pending to Working in SYDevelopers Technical Roadmap Nov 27, 2026
@Ardnived
Ardnived merged commit f7f2dd1 into main Nov 27, 2026
13 checks passed
@Ardnived
Ardnived deleted the feat/filters-sheet branch November 27, 2026 00:49
@sydevs-dispatcher sydevs-dispatcher Bot moved this from Working to Done in SYDevelopers Technical Roadmap Nov 27, 2026
@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