mirror of
https://github.com/zvx-echo6/navi.git
synced 2026-08-26 17:31:37 +00:00
Merge pull request #6 from zvx-echo6/feat/directions-origin-row
fix(navi/ui): always render origin + destination rows in directions panel
This commit is contained in:
commit
777a311c2c
1 changed files with 4 additions and 6 deletions
|
|
@ -98,15 +98,13 @@ export default function DirectionsPanel({ onClose }) {
|
||||||
// Each item has: { id, type, data }
|
// Each item has: { id, type, data }
|
||||||
const unifiedList = useMemo(() => {
|
const unifiedList = useMemo(() => {
|
||||||
const items = []
|
const items = []
|
||||||
if (routeStart) {
|
// Always render origin first and destination last, even when unset (data:null);
|
||||||
items.push({ id: "origin", type: "origin", data: routeStart })
|
// LocationInput shows its placeholder for value={null}. Stops sit in between.
|
||||||
}
|
items.push({ id: "origin", type: "origin", data: routeStart })
|
||||||
stops.forEach((stop) => {
|
stops.forEach((stop) => {
|
||||||
items.push({ id: stop.id, type: "stop", data: stop })
|
items.push({ id: stop.id, type: "stop", data: stop })
|
||||||
})
|
})
|
||||||
if (routeEnd) {
|
items.push({ id: "destination", type: "destination", data: routeEnd })
|
||||||
items.push({ id: "destination", type: "destination", data: routeEnd })
|
|
||||||
}
|
|
||||||
return items
|
return items
|
||||||
}, [routeStart, stops, routeEnd])
|
}, [routeStart, stops, routeEnd])
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue