Skip to content

Planner route notes: one row that opens a list #3289

Closed

Description

@timohueser

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

  1. New component builder/web/src/components/planner/RouteNotes.svelte. Props: notes: { icon: string; label: string; km: number; length?: number; coordinates: Coordinate[] }[] and onShow: (note) => void. It renders nothing for an empty list. Otherwise it renders one button with the warning icon and the text "N things to check" ("1 thing to check" for one), closed at first, with aria-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" (noteDistance formats the length). A press calls onShow.
  2. builder/web/src/lib/planner/route-closures.ts: edgeStretches adds the field at to each stretch: the km of its start, from cumulative(coordinates)[from]. So the closure stretches and the alpine stretches both have it. closureStretches skips closures of the kind sidepath; a stretch with no other kind is left out. Replace closureNote with closureLabel(stretch): string, which joins the phrases of one stretch with " · ". Shorten two phrases: limited becomes "Customers only" when its only value is customers, else "Only for …" as now; seasonal and conditional stay.
  3. builder/web/src/lib/planner/route-gaps.ts: RouteGap gets the field at, the distance of its stop along the route. gapLabel(gap) replaces gapNote: "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 as gapNote does now. route-difficulty.ts: the constant label "Alpine path (T4)" replaces alpineNote.
  4. builder/web/src/components/planner/PlannerApp.svelte: build one notes list from the gaps (icon flag), the closures (new icon lock in PlannerIcon.svelte: M6 11h12v9H6v-9Zm2 0V8a4 4 0 0 1 8 0v3) and the alpine stretches (icon mountain), sorted by at. A gap has no length, so its right column shows only "km {at}". Replace the three .closure-note lines with <RouteNotes>, in the same place and under the same condition (!focusedDay). onShow sets shownStretch and fits the map to it. Delete showNext, stepLabel and the .closure-note styles.
  5. Tests: update route-closures.test.ts for the new functions and the skipped sidepath. Add a component test for RouteNotes: closed at first, the count, one entry for each stretch.

Done when

  • From builder/web: npx vitest run src/lib/planner/ src/components/planner/ and npm 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions