Skip to content

Add map search for elements, trips, and places#14

Merged
dfalling merged 1 commit into
mainfrom
add-searching
May 31, 2026
Merged

Add map search for elements, trips, and places#14
dfalling merged 1 commit into
mainfrom
add-searching

Conversation

@dfalling
Copy link
Copy Markdown
Owner

Summary

Adds a search overlay on the map that queries elements, trips, and places in a single request, with type-specific behavior on select:

  • Element → fly to it + show the preview card. Location-less elements (no coordinates) open their detail modal directly instead of pinning a card over an unrelated map view.
  • Trip → filter the map to that trip's elements only, fit the camera to their extent, show a clearable filter chip.
  • Place → recenter at a zoom matched to the place's size (country → 4city → 11), via placeSearch(granularity: REGIONS).

UX details

  • Search runs on submit (not typeahead).
  • Collapsed to a top-left icon; tapping out anywhere dismisses it.
  • The query + results persist across dismiss, so reopening shows the last search, editable. The field's × clears for a fresh search.
  • Results are grouped into Elements / Trips / Places, each styled distinctly.

Implementation

  • New Search GraphQL operation; the existing Elements query gained an optional $tripId so one hook + Apollo cache serves both the viewport and trip-filtered views.
  • New components: SearchOverlay, TripFilterChip; pure helper placeZoom (with unit tests).
  • MapScreen swaps query variables (bounds ↔ tripId) and the displayed-element source based on the active trip filter.

Verification

  • tsc, biome, and jest (5 tests) pass.
  • All four flows driven manually on an emulator: submit-only search, element fly-to + preview, location-less → detail modal, trip filter + chip clear, place recenter, plus the dismiss/persist/clear behaviors.

Users had no way to find something not already in the current viewport.
This adds a search overlay that queries elements, trips, and places in a
single request and lets the user jump to a result:

- Element with a location: fly to it and show the preview card. One with
  no coordinates can't be placed on the map, so its detail modal opens
  directly instead of a card pinned over an unrelated view.
- Trip: filter the map to that trip's elements only, fit the camera to
  their extent, and show a clearable filter chip.
- Place: recenter at a zoom matched to the place's size (country vs city).

Search runs on submit (not typeahead); the query and results persist
across dismiss so reopening shows the last search, editable. The single
Elements query gained an optional tripId so one hook/cache serves both
the viewport and trip-filtered views.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dfalling dfalling enabled auto-merge (squash) May 31, 2026 19:12
@dfalling dfalling merged commit ad5f942 into main May 31, 2026
2 checks passed
@dfalling dfalling deleted the add-searching branch May 31, 2026 19:13
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.

1 participant