mirror of
https://github.com/zvx-echo6/navi.git
synced 2026-05-20 22:54:42 +02:00
feat(search): add viewport bias for location-aware geocoding
- Add mapCenter state to store (lat/lon/zoom) - Track map center on moveend in MapView - Pass mapCenter to searchGeocode from SearchBar - Update searchGeocode API call to include viewport params Search results now prioritize locations near the current map view. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
ec6f4254b9
commit
b12ebe672e
4 changed files with 158 additions and 3 deletions
|
|
@ -52,6 +52,7 @@ const SearchBar = forwardRef(function SearchBar(_, ref) {
|
|||
const setSelectedPlace = useStore((s) => s.setSelectedPlace)
|
||||
const setEditingContact = useStore((s) => s.setEditingContact)
|
||||
const clearPendingDestination = useStore((s) => s.clearPendingDestination)
|
||||
const mapCenter = useStore((s) => s.mapCenter)
|
||||
|
||||
useEffect(() => {
|
||||
inputRef.current?.focus()
|
||||
|
|
@ -98,7 +99,7 @@ const SearchBar = forwardRef(function SearchBar(_, ref) {
|
|||
setSearchLoading(true)
|
||||
|
||||
try {
|
||||
const data = await searchGeocode(q.trim(), 6, ctrl.signal)
|
||||
const data = await searchGeocode(q.trim(), 6, ctrl.signal, mapCenter)
|
||||
const combined = [...contactResults, ...(data.results || [])]
|
||||
setResults(combined)
|
||||
setAutocompleteOpen(combined.length > 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue