mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-18 21:16:47 +00:00
accdd5905e
Four things testers asked for in the "Along the route" panel. Add manually. The corridor search reads OpenStreetMap, and a good share of the chargers standing at a motorway junction are not in it, Tesla Superchargers among them. The way round it was to leave road trip mode, add the place under Days, drag it onto the right day, come back and mark it a charging stop. The Search button now shares its row with a second one that asks the two questions those four steps answered: which place, and where on the drive. The place comes from a debounced typeahead over the place search; the position from anchorFor, the same projection a via is placed with, and it is offered as a dropdown of every leg of every routed day so it can be overridden. Unlike a via, a place far from the drawn line is not refused, only flagged: that place is the reason this dialog exists. From there it hands over to the stop popup a corridor hit already goes through, so the kind and the dwell are decided once for both paths and the write stays saveStopDraft. Clear results. A search that turned up the wrong thing left its hits in the list and its pins on the map, and the only way out was switching to the day plan and back. The search hook has exposed a clear() since it was written and nothing ever called it. A control in the results header does now, and takes the four narrowing states with it, because they were set for a question that no longer has an answer. Charging as the default for an electric car. "Looking for" opened on Fuel whatever the vehicle. It opens on Charging when the trip's vehicle is electric, and is unchanged for combustion, for an empty value and for a vehicle nobody set, so nothing moves for anybody who never opened the dialog. Seeded once, never over a category the traveller picked or a search in flight. Clicking a result moves the map to it. The row had no click handler at all; only the trailing Add button did anything. The badge and the text are one activatable target with that button as its sibling, which keeps the li a list item and avoids a button inside a button, and it goes through the same focusRoadtripPoint the rail uses, which closes the refuel and alternatives panels first because those outrank the camera.
31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
/**
|
|
* What the manual-add dialog and the planner agree on.
|
|
*
|
|
* Their own module rather than the dialog's, so the planner hook can take the shapes
|
|
* without importing a component: the file stays free of React and of the api client, the
|
|
* way `roadtripModel` and `corridor` do.
|
|
*/
|
|
|
|
/** Where a stop added by hand goes: a card of the rail, and the position in its chain. */
|
|
export interface ManualStopTarget {
|
|
dayId: number
|
|
/** Counted along the card's stops, the same index space a corridor hit is placed at. */
|
|
position: number
|
|
/** How far the place sits from the road being driven; zero when nothing has routed. */
|
|
offRouteKm: number
|
|
}
|
|
|
|
/** A place chosen by hand, in the shape the stop popup and the place write want. */
|
|
export interface ManualStopPlace {
|
|
name: string
|
|
lat: number
|
|
lng: number
|
|
address: string | null
|
|
website: string | null
|
|
phone: string | null
|
|
/** Empty for a provider with no id of its own, which is what the rest of TREK does. */
|
|
osm_id: string
|
|
/** The kind the popup starts on, when the provider named one. */
|
|
category: string | null
|
|
}
|