mirror of
https://github.com/zvx-echo6/navi.git
synced 2026-08-26 17:31:37 +00:00
feat(navi/ui): wire place.category from osm key:value at all place-creation sites
Populate place.category = osm_key:osm_value (else null) where geocoder results become routable places, so Auto mode can take the type-hint fast path instead of the spatial /locate probe: - LocationInput.selectResult (direct setRouteStart/End) - SearchBar.setSelectedPlace (preview -> PlaceCard -> startDirections) + pending addStop - DirectionsPanel.handleDragEnd now preserves category through origin/dest reconstruction Coord-only pins (radial menu, GPS, dropped pins) and basemap-label features carry no osm_key:value, so category is null and Auto falls back to the spatial check. setRouteStart/ setRouteEnd store places wholesale (category preserved); startDirections already preserves it. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
91d03f3fe7
commit
a6b12b2588
3 changed files with 7 additions and 1 deletions
|
|
@ -166,6 +166,7 @@ export default function DirectionsPanel({ onClose }) {
|
|||
lon: newOriginItem.data.lon,
|
||||
name: newOriginItem.data.name,
|
||||
source: newOriginItem.data.source,
|
||||
category: newOriginItem.data?.category ?? null,
|
||||
} : null
|
||||
|
||||
const newDest = newDestItem?.data ? {
|
||||
|
|
@ -173,6 +174,7 @@ export default function DirectionsPanel({ onClose }) {
|
|||
lon: newDestItem.data.lon,
|
||||
name: newDestItem.data.name,
|
||||
source: newDestItem.data.source,
|
||||
category: newDestItem.data?.category ?? null,
|
||||
} : null
|
||||
|
||||
const newStops = newStopItems.map((item) => ({
|
||||
|
|
|
|||
|
|
@ -167,6 +167,8 @@ export default function LocationInput({
|
|||
name: result.name,
|
||||
source: result.source,
|
||||
matchCode: result.match_code,
|
||||
// OSM key:value hint for Auto mode's type-hint fast path (null -> spatial fallback)
|
||||
category: (result.raw?.osm_key && result.raw?.osm_value) ? `${result.raw.osm_key}:${result.raw.osm_value}` : null,
|
||||
})
|
||||
setQuery(result.name)
|
||||
setResults([])
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ const SearchBar = forwardRef(function SearchBar(_, ref) {
|
|||
}
|
||||
|
||||
if (pending) {
|
||||
addStop({ lat: result.lat, lon: result.lon, name: result.name, source: result.source, matchCode: result.match_code })
|
||||
addStop({ lat: result.lat, lon: result.lon, name: result.name, source: result.source, matchCode: result.match_code, category: (result.raw?.osm_key && result.raw?.osm_value) ? `${result.raw.osm_key}:${result.raw.osm_value}` : null })
|
||||
addStop({ lat: pending.lat, lon: pending.lon, name: pending.name, source: pending.source, matchCode: pending.matchCode })
|
||||
clearPendingDestination()
|
||||
toast(`Routing from ${result.name} to ${pending.name}`, { icon: '\u{1F9ED}' })
|
||||
|
|
@ -208,6 +208,8 @@ const SearchBar = forwardRef(function SearchBar(_, ref) {
|
|||
source: result.source,
|
||||
matchCode: result.match_code,
|
||||
raw: result.raw || {},
|
||||
// OSM key:value hint for Auto mode (null -> spatial fallback)
|
||||
category: (result.raw?.osm_key && result.raw?.osm_value) ? `${result.raw.osm_key}:${result.raw.osm_value}` : null,
|
||||
})
|
||||
// Set click marker for two-click model consistency
|
||||
setClickMarker({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue