Repository navigation
Description
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, besideevenDays,PlannerApp.svelte:229) gives the week's calendar days, its riding numbers and its nights:weekOf(plain, weekStart).- The night search reads
restedStartonly (below):stopWindows(:242) =nightWindows(trip, session.line, pickerNight, weekOf(plain, restedStart)?.nights). proposals(:258) readstopWindowsas today.- The shown itinerary (
view.itinerary, with proposals) gives only what the screen draws for the week: itsfrom/toroute progress for the profile, the day rows and the strip bars, matched to the week by calendar number.
Plan
- Commit 1: profile slices (
PlannerProfile.svelte,profile-data.ts). Each day of a multi-day profile drawsprofilePathsof its own samples, with one sample on each side so that the slices join (profile-data.ts:40-49), in place of the whole-routeareaandlineclipped to the day (:229,:243); only the days insideshownare 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. builder/web/src/lib/planner/week.ts(new, pure, no Svelte):weekOf(itinerary: ItineraryDay[], start: number): Week | null: null below 15 riding days; it clampsstartitself (1 ≤ start ≤ calendar days − 6).Week = { start: number; end: number; ridingDays: number[]; nights: number[] }: calendar daysstarttoend(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),homeandend; each clamps byweekOf's rule.
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 whentrip.startDateis 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 weekcolor-mix(in srgb, var(--ink-faint) 45%, var(--panel)), insidedayColor(riding, theme). A rest day: a 6 px square outline at the bottom. The frame: 2 px--amber, radius 5 px, fillcolor-mix(in srgb, var(--amber) 9%, transparent).- One
role="slider"withtabindex="0"andaria-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; nopreventDefaultthat 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 reportsdragging. - Wheel over the strip:
preventDefault(the page does not scroll); the larger axis ofdeltaX/deltaYaccumulates, 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,heightInoflib/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 bindabledragging.stripis already a snippet prop ofPlannerProfile.svelte(:52); the profile prop for this strip istripStrip.
- One
- The rested week, one place (
PlannerApp.svelte): the stateweekStart(changed by every move: the strip, ‹ ›, the clamp, andcontainingfrom 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)) andrestedStart. An effect setsrestedStart = weekStart300 ms after the last change ofweekStart, and not while the strip isdragging(then 300 ms after the drag ends). When a plan opens,restedStart = weekStart = 1. The night search reads onlyrestedStart(above).pickerNight(an open night page) is always searched, as today. 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 storedrangeof'route'has no effect:shown(:94) is the open day when there is one (focus), else the week'sfrom/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 atshown.from, and drops a rest atshown.to). The choice moves into a pure functionweekRests(rests, week)inprofile-axis.ts: a week that starts with a rest day shows that column at the left edge of the plot (todayat > shown.fromdrops it); a week that ends with a rest day shows that column at the right edge (todayat < shown.todrops 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
handlesdoes today. The profile has no day labels ondevelop; the week does not bring them back. The surface row (:276) followsshown. - Up to 14 riding days the profile stays as it is, except the slices of commit 1.
- The strip stands under the title row (
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.stops.ts:nightWindows(trip, line, also, nights?)(:99): withnights, only those nights get a window (plusalso). 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;centredOnclamps at both ends; a rest day counts in the 7;containingmoves the least;weekOfclamps 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:nightWindowswithnightsgives 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:weekRestsgives 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 onweekRests, not onaxisRest, 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 inW;speed.mjs: 3 loads ofbike-64.jsonat 1920 × 1080). The route service binary isbuild-3709/bin/planner-service; the routing package is/media/timo/OSM1/tmp/explore-3506/shots/3618/package/routing. - Search: run
obc data serveon thelocaldata target, read only, in the worktree (it needsplanner/search/.venvandnpm ci --prefix planner/tiles), and pointsearchof the catalogue proxy (tools/proxy.py) at its search address in place of the dead path. Check first thatlocalcovers Central Switzerland. - Throwaway edits in each worktree, never committed (add them by hand;
exp.pyresetsbuilder/web/src):maxRidingDays = 64; theobc:idlemark ofexp.py; a markobc:nightswhen every night that the search wants has an answer (inPlannerApp.svelte, wherestopFinder.foundchanges); and, for the "before" run only, the profile slice edit ofexp-profile.py, so that the 3 GB cap does not kill it. Extendspeed.mjsto read both marks: the measure is the later of the two, from the navigation start. - Run
obc suites preparefirst. Everything under/media/timo/OSM1/tmp/explore-3506/tools/heavy.sh, the browser underflock /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, runsPlanner.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
timohueser commentedon Nov 20, 2026
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