Skip to content

Unified Search Bar#97

Merged
f3-jolt merged 1 commit intostagingfrom
search-updates
Mar 25, 2026
Merged

Unified Search Bar#97
f3-jolt merged 1 commit intostagingfrom
search-updates

Conversation

@f3-jolt
Copy link
Copy Markdown
Collaborator

@f3-jolt f3-jolt commented Mar 25, 2026

👋 TL;DR

Replaces the multi-field navbar search (separate Region, PAX filter, and PAX autocompletes) with a unified command-palette style search modal that searches PAX, Regions, and AOs in one place.

🔎 Details

New: Unified Search Modal (src/components/search-modal.tsx)

  • Single input field, debounced at 600ms, fires 3 parallel searches on each keystroke
  • Results grouped into labeled sections: REGIONS → AOs → PAX (sections only render when they have results)
  • PAX results show home region as a subtitle — making duplicate PAX names across regions immediately distinguishable
  • Jump-to-section links appear above results when 2+ sections have results (e.g., Jump to: Regions · AOs · PAX)
  • Clear dividers between sections
  • Keyboard navigation: / to move, to select, esc to close
  • Footer note about duplicate PAX results with a link to the FAQ merge guide [closes issue Duplicate Profiles? #85]
  • Cmd+K / Ctrl+K opens the modal from anywhere in the app

New: AO Search backend

  • src/lib/bq/aos.ts — added searchAOsByName() querying pv_aos by name (mirrors PAX/region pattern)
  • src/app/api/ao/list/route.ts — new GET endpoint, auth-gated, min 2 chars, returns 500 + error body on failure (no silent failures)

Updated: PAX search supports optional region filter

  • src/lib/bq/pax.tssearchUsersByName() accepts optional regionId to scope results by home_region_id
  • src/app/api/pax/list/route.ts — parses optional region_id query param and passes through

Simplified: Navbar (src/components/navbar.tsx)

  • Removed 3 separate Autocomplete fields, all associated search state, and the mobile Drawer
  • Single SEARCH button on both desktop and mobile, same on both breakpoints
  • Cmd+K global listener added

✅ How to Test

  • Basic search: Click SEARCH (or press Cmd+K) → type at least 2 chars → confirm results appear in Regions / AOs / PAX sections
  • Jump links: Search a term that returns all 3 section types → confirm Jump to: bar appears with links → click each and confirm it scrolls to the correct section
  • Navigation: Use / to move through results across sections → to navigate → confirm it routes to the correct page and closes the modal
  • Disambiguation: Search a common PAX name (e.g. one that exists in multiple regions) → confirm each result shows a different region subtitle
  • Keyboard shortcut: Press Cmd+K from any page → confirm modal opens
  • Mobile: On a small viewport, confirm the SEARCH button opens the same modal (no drawer)
  • Error handling: If a search API returns a 500, confirm the affected section shows an inline error (not a silent empty result)
  • Duplicate PAX note: Confirm the footer note and FAQ link are visible at the bottom of the modal

🥜 GIF

lack-of-hustle

@f3-jolt f3-jolt merged commit 51ec945 into staging Mar 25, 2026
6 checks passed
@f3-jolt f3-jolt deleted the search-updates branch March 25, 2026 15:53
@taterhead247
Copy link
Copy Markdown
Contributor

@f3-jolt this sounds amazing! One question on "Single input field, debounced at 600ms, fires 3 parallel searches on each keystroke". Does that mean it's making 3 BQ queries every key stroke? Or is it hitting a local cache?

@taterhead247
Copy link
Copy Markdown
Contributor

I just checked it out in staging. It is amazing!!

@f3-jolt f3-jolt mentioned this pull request Apr 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants