ReviewOS

stacks/bench-review

discovery: practice-area filter on judges directory

#38
Closed glennmichael123 opened this 10 days ago ·
10 days ago

The Judge.practice_area column exists and is filterable in the model's useSearch trait, but /judges doesn't surface it as a filter UI, and /reviews has no way to narrow by practice area. Easy win — column's already there.

Scope

  • Filter pill on /judges: "All / Criminal / Civil / Family / Probate / Appellate / Bankruptcy / Other". URL-driven via ?practice_area=family.
  • Sidebar / topbar on /reviews for the same filter (filters down to reviews on judges with that practice area).
  • Each practice area gets a count badge ("Civil (24)") derived from the live data.

Acceptance

  • Selecting "Family" on /judges narrows the directory to family-court judges.
  • Counts reflect the actual seeded data.
  • Practice area is reflected in the URL so deep links and shares work.
  • Subsumed by the broader "search filters" issue, but small enough to ship standalone first.
  • Best done after Meilisearch migration so the filter uses index-level facets instead of SQL WHERE.
9 days ago

Shipped.

Frontend — resources/components/Bench/Judge/JudgeDirectory.stx:

  • Added a row of filter pills above the existing search panel: All / Criminal / Civil / Family / Probate / Appellate / Bankruptcy / Other, each with a live count of judges in that area (derived from the full roster, so the count reflects the directory, not the currently filtered view).
  • URL-driven via ?practice_area=family. Pill clicks replaceState (not push) so rapid taps don't bloat the back stack.
  • Initial state reads from URLSearchParams on mount, so deep links and shares preserve the filter.
  • Active pill renders solid black; inactive pills white with hover border. Same visual pattern as the status pills in MyReviewsView.

Filter composition — filteredJudges derived now applies practice-area first, then the existing text search on top. Both filters compose — e.g. ?practice_area=appellate + typing "Roberts" narrows to appellate judges named Roberts.

Server side — no API change needed; filtering happens client-side over the already-fetched judgesStore.judges(). This is fine at the current directory size; when we move to Meilisearch (#41), the pill state moves into the search filter expression for the same DX with server-backed scaling.

Tracked separately — the existing "All Courts / All States / Rating" <select> placeholders are unwired. They're part of the broader filter umbrella (#30). This issue just covered practice-area as a quick win.

Sign in to comment on this issue.