Skip to content

Planner: a strip of all days and a week in focus for trips of 15 days or more #3712

Closed

Description

@timohueser

Status: done

Part of #3652 (step 4). Read the epic's section "The screen" first: it gives the look and the pixel sizes; the mock-ups are long-trips-design-sheet.webp in /media/timo/OSM1/tmp/explore-3506/long-trips-design/ on the build PC.

Depends on #3338 (the planner tidy-up): merged. Checked against develop 1bbced3 (with #3709, #3710 and #3711 in); line numbers below are from it. Can start now.

TL;DR

Goal: From 15 riding days, a strip of all days and a week in focus make the day list, the profile and the night search show 7 calendar days in detail; up to 14 days the screen does not change.
Problem: At 32 and 64 days the profile and the day list cannot be read, the profile draws the whole line once for each day, and the planner searches places to sleep for every night at once.
Decision: Each profile day draws only its own slice (first commit); then a pure week module, a strip component, the week header in the list, the profile range of the week, and a night search only for the week, started when the week rests.
Systems: route-planning
Contracts: none
Size: M (1 system, about 800 lines, in two commits: the slices about 100 lines, the week about 700)

Where each value comes from

There is no loop: the week never reads the proposals.

  • plain = planView(trip, session.line).itinerary (the plan without proposals, beside evenDays, PlannerApp.svelte:229) gives the week's calendar days, its riding numbers and its nights: weekOf(plain, weekStart).
  • The night search reads restedStart only (below): stopWindows (:242) = nightWindows(trip, session.line, pickerNight, weekOf(plain, restedStart)?.nights).
  • proposals (:258) read stopWindows as today.
  • The shown itinerary (view.itinerary, with proposals) gives only what the screen draws for the week: its from/to route progress for the profile, the day rows and the strip bars, matched to the week by calendar number.

Plan

  1. Commit 1: profile slices (PlannerProfile.svelte, profile-data.ts). Each day of a multi-day profile draws profilePaths of its own samples, with one sample on each side so that the slices join (profile-data.ts:40-49), in place of the whole-route area and line clipped to the day (:229, :243); only the days inside shown are drawn. The pixels stay as they are; a 64-day profile no longer draws the whole line 64 times. This commit stands alone and is reviewed first.
  2. builder/web/src/lib/planner/week.ts (new, pure, no Svelte):
    • weekOf(itinerary: ItineraryDay[], start: number): Week | null: null below 15 riding days; it clamps start itself (1 ≤ start ≤ calendar days − 6). Week = { start: number; end: number; ridingDays: number[]; nights: number[] }: calendar days start to end (always 7), the riding numbers inside, and the nights to search (the riding days inside and the night before the week).
    • Moves: centredOn(day) (the day becomes the 4th), step(start, by) (±1 a day, ±7 a week), containing(start, day) (the least move that puts the day inside), home and end; each clamps by weekOf's rule.
  3. builder/web/src/components/planner/TripStrip.svelte (new): one slot for each calendar day (flex, 2 px gap) over the drawer width, height 40 px (bars up to 28 px, a 12 px line with every 7th day number, or its date when trip.startDate is set). Bar height = 4 + 22 × riding hours ÷ the longest day's hours (when all hours are 0, every bar is 4 px). Bars outside the week color-mix(in srgb, var(--ink-faint) 45%, var(--panel)), inside dayColor(riding, theme). A rest day: a 6 px square outline at the bottom. The frame: 2 px --amber, radius 5 px, fill color-mix(in srgb, var(--amber) 9%, transparent).
    • One role="slider" with tabindex="0" and aria-valuetext="Days 36 to 42". Keys: arrows one day, Page Up and Page Down 7 days, Home and End.
    • Pointer: a press focuses the strip (focus(), so the arrow keys work after it; no preventDefault that blocks the focus) and takes pointer capture. A press inside the frame keeps the offset between the pointer and the week start, and a drag moves the week one day at a time; a press outside the frame centres the week on that day (centredOn). While the pointer is down, the strip reports dragging.
    • Wheel over the strip: preventDefault (the page does not scroll); the larger axis of deltaX/deltaY accumulates, and each 50 px moves the week one day.
    • Pointer on a slot outside the week: a tip over it, "Day 45 · 57.5 km · 3h 57m · ↑ 1,441 m" in the rider's units (distanceIn, heightIn of lib/settings/format.ts); a rest slot: "Day 12 · Rest". No output to the map yet (Planner map: the week in colour, the rest of a long trip quiet #3714 adds it).
    • Props: itinerary (the shown one), week, theme, onMove(start), and the bindable dragging. strip is already a snippet prop of PlannerProfile.svelte (:52); the profile prop for this strip is tripStrip.
  4. The rested week, one place (PlannerApp.svelte): the state weekStart (changed by every move: the strip, ‹ ›, the clamp, and containing from the callers that open a day: showDay, a click on a night badge of the profile (openNight), a night or day-end mark on the map (selectPoint), and a search result on a day (applySearch)) and restedStart. An effect sets restedStart = weekStart 300 ms after the last change of weekStart, and not while the strip is dragging (then 300 ms after the drag ends). When a plan opens, restedStart = weekStart = 1. The night search reads only restedStart (above). pickerNight (an open night page) is always searched, as today.
  5. PlannerProfile.svelte, for a trip with a week:
    • The strip stands under the title row (.title, :192); the drawer grows by 40 px (the map loses 40 px). The "Map view / Whole route" switch (Segmented, :196) does not show, and a stored range of 'route' has no effect: shown (:94) is the open day when there is one (focus), else the week's from/to. A move of the week ends a selected part, as another day does today.
    • The rest columns are the rests of the week's own days, not found by progress (restColumns, :108-112, puts a rest before the week and a rest that starts it both at shown.from, and drops a rest at shown.to). The choice moves into a pure function weekRests(rests, week) in profile-axis.ts: a week that starts with a rest day shows that column at the left edge of the plot (today at > shown.from drops it); a week that ends with a rest day shows that column at the right edge (today at < shown.to drops it), except after the last day of the trip; an open day has no rest column, as today. The night badges keep their numbers ("10, Rest, 12": a night has the number of the day that ends there); the mock-up's "10, Rest, 11, 12" is not built.
    • Night badges: the nights inside the week plus the night before it at the left edge, as handles does today. The profile has no day labels on develop; the week does not bring them back. The surface row (:276) follows shown.
    • Up to 14 riding days the profile stays as it is, except the slices of commit 1.
  6. Itinerary.svelte (visible, :55): with a week, the rows of the calendar days of the week only (days, nights, rest days and the + between days); the Start row only with day 1, the Finish row only with the last day. The ladder line (.ladder::before, :279-285, which assumes the Start and Finish rows) runs from the first to the last row shown. Above the rows, a week header of 36 px that stays on top while the list scrolls (position: sticky): ‹ (7 days back), "Days 36–42" bold, the week's distance and climb, › (7 days on). When the week moves, the list scrolls to its top. With an open day, the header stays and the list shows that day only, as today.
  7. stops.ts: nightWindows(trip, line, also, nights?) (:99): with nights, only those nights get a window (plus also). Proposals exist only for these nights; every other night shows its even day end, so the day ends of a week never depend on which weeks the rider looked at before. The finder keeps its 40 recent answers, so a step back is cheap.

Tests

  • builder/web/src/lib/planner/week.test.ts (new): 15 days give a week, 14 give none; centredOn clamps at both ends; a rest day counts in the 7; containing moves the least; weekOf clamps a start past the end after fewer days.
  • builder/web/src/components/planner/TripStrip.svelte.test.ts (new): the slider keys; a press focuses the strip; a press inside the frame keeps the offset, outside it centres.
  • builder/web/src/lib/planner/stops.test.ts: nightWindows with nights gives windows only for those nights; the proposals of week 2 are the same after week 3 was shown and week 2 is shown again.
  • builder/web/src/lib/planner/profile-axis.test.ts: weekRests gives the column of a rest day that starts the week at the left edge and of one that ends it at the right edge, and none for a rest before the week. (The test is on weekRests, not on axisRest, which already gives 0 % at the left edge and could not fail.)
  • builder/web/src/components/planner/PlannerApp.svelte.test.ts:760-768 ("prevents adding an overnight past the riding-day limit") clicks "Open day 32" while the list shows only days 1 to 7: move the week to day 32 first (End on the strip), then open it.

Proof: the speed gate with town search answering

At the end, measure the 64-day cycling test plan with the night search answering, before (on develop with only the throwaway edits) and after (with this change), and write the gate into the epic's "Done when":

  • Tools on the build PC: /media/timo/OSM1/tmp/explore-3506/build-3709/tools/ (run.sh: route service with 2 workers, the catalogue proxy, the vite page of the worktree in W; speed.mjs: 3 loads of bike-64.json at 1920 × 1080). The route service binary is build-3709/bin/planner-service; the routing package is /media/timo/OSM1/tmp/explore-3506/shots/3618/package/routing.
  • Search: run obc data serve on the local data target, read only, in the worktree (it needs planner/search/.venv and npm ci --prefix planner/tiles), and point search of the catalogue proxy (tools/proxy.py) at its search address in place of the dead path. Check first that local covers Central Switzerland.
  • Throwaway edits in each worktree, never committed (add them by hand; exp.py resets builder/web/src): maxRidingDays = 64; the obc:idle mark of exp.py; a mark obc:nights when every night that the search wants has an answer (in PlannerApp.svelte, where stopFinder.found changes); and, for the "before" run only, the profile slice edit of exp-profile.py, so that the 3 GB cap does not kill it. Extend speed.mjs to read both marks: the measure is the later of the two, from the navigation start.
  • Run obc suites prepare first. Everything under /media/timo/OSM1/tmp/explore-3506/tools/heavy.sh, the browser under flock /tmp/trailview-gpu.lock; say whether the terrain run was active and the load average. 3 loads before and 3 after.
  • Earlier figures, search off: map quiet 21.1 s before Planner: route long plans two requests at a time, and keep the trip when one point or leg fails #3709, 14.4 s with only Planner: route long plans two requests at a time, and keep the trip when one point or leg fails #3709's change, 7.8 s with the week's night search. Expected under 10 s after. Set the gate at the measured median after plus 15 %, write it into the epic's Done when, and give all six times in the pull request.

Docs

docs/content/software/trips.md: the strip and the week (a few sentences), and docs/design/web-planner.md:79 (the sentence about the switch "Map view / Whole route": a long trip has the strip in its place), in one docs: commit; python3 docs/build_docs.py --check-links.

Checks

In builder/web: npx vitest run src/lib/planner/week.test.ts src/components/planner/TripStrip.svelte.test.ts src/lib/planner/stops.test.ts src/lib/planner/profile-axis.test.ts src/components/planner/PlannerApp.svelte.test.ts src/components/planner/Planner.svelte.test.ts, npm run check.

Done when

  • The checks pass, and the gate is measured and written into the epic.
  • After the build: Planner: rest-day column and "Show whole route" fixes #3715 merges first. Then this pull request merges develop, checks that the rest columns stand inside .plot, runs Planner.svelte.test.ts, and presses "Show whole route" on the 32-day plan at 1440 × 900 with the strip (the whole line must fit in the map, which is 40 px lower).
  • The owner opens a 32-day plan at 1440 × 900 on the pull request's head, served on the build PC with the route service and the local search of the Proof setup (the orchestrator gives the address). Until Planner map: the week in colour, the rest of a long trip quiet #3714 the map stays as on develop: all days in colour, and nights outside the week at their even day end. Pass when: the strip shows 32 bars with an amber frame over 7 days; the list shows only those days and the profile only those days with readable night numbers; he moves the week with a click, a drag, the arrow keys, the mouse wheel over the strip and ‹ ›, and each time list and profile follow, and after a short rest the night towns of the new week load; the pointer on a bar outside the week shows a tip with that day's distance, time and climb. He opens a 14-day plan: pass when it looks as before (no strip). Fail when numbers overlap, the page scrolls under the wheel, the towns of a week do not load, or a short trip shows the strip.

Activity

  1. timohueser commented on Nov 20, 2026

    @timohueser
    OwnerAuthor

    The owner's look passed on the sheet of the built planner (the approved mock-ups beside the built screens: 14 days unchanged, the week on days 1 to 7, after › and after a drag, the rest day inside and at both edges of the week, "Show whole route" with the strip, the towns of the week, the tip): "Merge both".


    Generated by Claude Code

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