mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-23 13:23:04 +00:00
fix(roadtrip): a stop added by hand opens on the kind being looked for
The button carried nothing and the form hard-wired the kind, so the categories sitting directly above it had no way through and every manual stop started life as a fuel stop with ten minutes on it. The click now carries what the corridor is looking for, dwell included. The picker is multi-select, so the first kind the panel lists wins rather than a fallback nobody switched on; with nothing selected the form falls back on its own, because a stop without a kind is a numbered destination that counts in every total. This also closes the case it was noticed on: an electric car seeds the panel to charging, so the picker said Charging over a form that said Fuel.
This commit is contained in:
@@ -254,10 +254,15 @@ function usePlaceFormModal(props: PlaceFormModalProps) {
|
||||
// path exists to avoid. Read out of the closure rather than watched, because the
|
||||
// mode is fixed for the life of one opening and a rebuilt drive must not reset a
|
||||
// half-filled form.
|
||||
// What the corridor panel was looking for when the button was pressed, because
|
||||
// that is the traveller's own answer to what they are adding; only a panel with
|
||||
// nothing selected falls back to the constant. The dwell follows the kind, the
|
||||
// same way picking one by hand moves it.
|
||||
const kind = serviceStop.defaultKind ?? DEFAULT_SERVICE_KIND
|
||||
setForm({
|
||||
...DEFAULT_FORM,
|
||||
stop_type: DEFAULT_SERVICE_KIND,
|
||||
duration_minutes: STOP_KIND_BY_KEY[DEFAULT_SERVICE_KIND].defaultMinutes,
|
||||
stop_type: kind,
|
||||
duration_minutes: STOP_KIND_BY_KEY[kind].defaultMinutes,
|
||||
})
|
||||
} else {
|
||||
setForm(DEFAULT_FORM)
|
||||
|
||||
Reference in New Issue
Block a user