Skip to content

feat(web): two-row route form, source always editable#80

Draft
cafca wants to merge 1 commit into
mainfrom
claude/elegant-chebyshev-608014
Draft

feat(web): two-row route form, source always editable#80
cafca wants to merge 1 commit into
mainfrom
claude/elegant-chebyshev-608014

Conversation

@cafca
Copy link
Copy Markdown
Owner

@cafca cafca commented May 7, 2026

Summary

Reshape the web route input to mirror the mobile RouteCard so the user can change source or destination at any time without first cancelling the route.

  • Two always-tappable rows (origin, destination), each with inline edit and a shared results dropdown.
  • Drop the `if (route.data) return;` guard in `setRoutePoint` — map clicks now write to whichever row is currently being edited; legacy origin-then-destination fill remains the fallback.
  • Swap button on the right of the destination row, visible once destination is set.
  • Gear becomes a "Preferences" text button in the footer alongside "Save start as home" / the home toggle + reset.
  • New `setOrigin` / `setDestination` / `swapWaypoints` helpers; origin and destination marker-drag handlers now route through them so `editingField` stays consistent and the recompute logic is shared.
  • `applyStartAtHome` and `handleSaveHome` clear `editingField` so the home name renders instead of an empty input on first load for users with Start at home enabled.
  • `clearRoute` resets `editingField` (to `'origin'` when origin is null, `null` when origin auto-fills from home).

Depends on #76 for the dev-server proxy fix used while previewing against beebeebike.com — independent change, can land in either order.

Test plan

  • `just test-web` — 76 / 76 (4 new tests around swap + editingField).
  • `just build-web` — clean.
  • Local preview against the dev stack: set origin via search, set destination via search, change either after the route computes without clicking ×, swap origin/destination, drag origin and destination markers, toggle Start at home on/off.

Reshape the route input to mirror the mobile RouteCard:

- Two always-tappable rows for origin and destination, each with inline
  edit and a search results dropdown beneath the panel.
- Drop the "locked once computed" guard so the user can change either
  waypoint at any time without first clearing the route.
- Add a swap button on the right of the destination row, visible once
  destination is set.
- Move the gear into a "Preferences" text button that sits in the
  footer row alongside Save start as home (or the home toggle + reset).
- Map clicks now write to whichever row is currently being edited; if
  no row is in edit mode they fall back to the legacy origin-then-
  destination fill order.
- Add setOrigin / setDestination / swapWaypoints helpers; route the
  origin and destination marker drag handlers through them so
  editingField stays consistent and recompute logic is shared.
- applyStartAtHome and handleSaveHome clear editingField when they set
  the origin so the home name renders instead of an empty input.
- clearRoute resets editingField (to 'origin' when origin is null,
  null when origin auto-fills from home).

Tests cover swapWaypoints, the new clearRoute editingField behaviour,
and the applyStartAtHome editingField fix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant