Repository navigation
Description
Status: done
Size: S
Part of #3286. Depends on #3287.
Systems: route-planning
TL;DR
Goal: The side panel shows the notes about a route as one closed row with a count. The row opens a list with one entry for each stretch.
Problem: Three separate lines sit above the plan: where the route ends before a point, where access may be restricted, and where the route is alpine. The access line has a calendar icon and joins all stretches into one sentence.
Decision: One row with a warning icon and a count replaces the three lines. It opens a list with one entry for each stretch, and an entry shows its stretch on the map. Access notes of the kind sidepath (the road has a signed cycle path beside it) leave the list: they are no warning for the rider. (Review page, finding 04.)
Plan
- New component
builder/web/src/components/planner/RouteNotes.svelte. Props:notes: { icon: string; label: string; km: number; length?: number; coordinates: Coordinate[] }[]andonShow: (note) => void. It renders nothing for an empty list. Otherwise it renders one button with thewarningicon and the text "N things to check" ("1 thing to check" for one), closed at first, witharia-expanded. Open, it lists the notes in route order. Each entry is a button: the icon, the label, and at the right "km 41.2 · 340 m" (noteDistanceformats the length). A press callsonShow. builder/web/src/lib/planner/route-closures.ts:edgeStretchesadds the fieldatto each stretch: the km of its start, fromcumulative(coordinates)[from]. So the closure stretches and the alpine stretches both have it.closureStretchesskips closures of the kindsidepath; a stretch with no other kind is left out. ReplaceclosureNotewithclosureLabel(stretch): string, which joins the phrases of one stretch with " · ". Shorten two phrases:limitedbecomes "Customers only" when its only value iscustomers, else "Only for …" as now;seasonalandconditionalstay.builder/web/src/lib/planner/route-gaps.ts:RouteGapgets the fieldat, thedistanceof its stop along the route.gapLabel(gap)replacesgapNote: "Starts {d} from your point" for a start, "Ends {d} before your point" for a finish, "Passes {d} from your point" for any other point, with{d}formatted asgapNotedoes now.route-difficulty.ts: the constant label "Alpine path (T4)" replacesalpineNote.builder/web/src/components/planner/PlannerApp.svelte: build onenoteslist from the gaps (iconflag), the closures (new iconlockinPlannerIcon.svelte:M6 11h12v9H6v-9Zm2 0V8a4 4 0 0 1 8 0v3) and the alpine stretches (iconmountain), sorted byat. A gap has nolength, so its right column shows only "km {at}". Replace the three.closure-notelines with<RouteNotes>, in the same place and under the same condition (!focusedDay).onShowsetsshownStretchand fits the map to it. DeleteshowNext,stepLabeland the.closure-notestyles.- Tests: update
route-closures.test.tsfor the new functions and the skippedsidepath. Add a component test forRouteNotes: closed at first, the count, one entry for each stretch.
Done when
- From
builder/web:npx vitest run src/lib/planner/ src/components/planner/andnpm run check - In the running planner, a route with a restricted stretch shows "1 thing to check"; the entry shows the stretch on the map.
Activity
Merge pull request #3314 from timohueser/claude/planner-ux-3289-route…