Repository navigation
Description
Status: done
Part of #3652 (step 6). Read the epic's "The screen", points "Pointer on a slot outside the week" and "Map".
Depends on #3712 (the strip and the week): starts when it is merged.
Depends on #3715 (the map bounds): starts when it is merged.
#3713 (64 days) merges first if it is ready, so that this step makes its pictures, its speed measure and the owner's check on the 64-day plan. This step does not wait for #3713: without it, these use the 32-day plan.
Line numbers are from the heads of #3712 (c32c9e887: PlannerApp.svelte, TripStrip.svelte, week.ts) and #3715 (7769454ea: PlannerMap.svelte). They move by a few lines after the merges.
TL;DR
Goal: With a week in focus, the map draws the riding days of the week in their colours and the other days as thin grey lines with small night dots. A week step and a pointer on the strip send no line data to the map.
Problem: The map draws all days in 4 repeating colours, with numbered night marks and all shaping points, so a 64-day trip cannot be read. A change of the colours sets the whole trip source again (320,557 points for the 64-day test plan), and a data-driven setPaintProperty also makes MapLibre load the whole source again.
Decision: The features of the trip source have their riding day as id. The look of a day (in colour, quiet, lit) is a feature state, which MapLibre applies to the loaded tiles with no new data. Night marks outside the week become dots and shaping points outside the week hide, through classes on the existing markers. The map moves to the week only after the rider moves the week with the strip or ‹ ›, and only when the week's line is not in view.
Rejected:
- A paint expression on the week range: for a data-driven paint change, MapLibre lays out and loads the whole source again (maplibre-gl 6.11.2,
style_layer.ts:301-306,style.ts:1414-1418). - The lit day in the
trip-highlightsource: it sends the line of the day at each pointer move. A feature state sends nothing. - A static quiet layer under the coloured layer: one more layer draws the whole line again. One layer with a colour and a width from the state does the same.
- A source with only the days of the week: each week step sends about 35,000 points to the map worker, and the drawn, gap and transfer layers double.
Systems: route-planning
Contracts: none
Size: M (1 system, about 200 lines)
Facts
tripData()makes one feature for each leg and riding day (PlannerMap.svelte:250-253). The segments come fromdaySegments, which givesday, the riding number (editor.ts:295-301);PlannerApp.svelte:375keeps it, butMapSegment(map-types.ts) has noday.- The
tripsource getssetDataat each change of the line or of the day ends (PlannerMap.svelte:584-591). The town answers of a rested week change the proposals, so the day ends andsegmentschange (PlannerApp.svelte:375). - In maplibre-gl 6.11.2,
line-colorandline-widthtakefeature-state;line-dasharraydoes not. A feature-state change writes the paint values of the changed features in the loaded tiles again (tile.ts:521), with no worker work and no new tiles. Several features can share one id (feature_position_map.ts:32). States stay throughsetData. - Night marks, day-end marks and shaping points are DOM markers, made again only when their point changes (
PlannerMap.svelte:694-756).MapPointhasnighton night and day-end marks; shaping points have no day. - A press within 10 px of the line starts an insert drag, and a click opens the leg callout (
PlannerMap.svelte:388-400,:505-517).lineHitgives the leg, not the day (:334). - A click on a night mark or a day-end mark calls
selectPoint: the week moves to the night, its day opens, and the map does not move (PlannerApp.svelte:784-797). showDay,openNight,selectPoint,revealand an applied search move the week withshowInWeek(PlannerApp.svelte:247). The strip (:1365) and the ‹ › of the week header (:1249) setweekStartdirectly. The week rests 300 ms after its last move, or at the end of a strip drag (:240-245).- A plan opens with the whole route fitted (
PlannerApp.svelte:101-105). - The colours of the map layers are hex values for each theme in
installRoute(PlannerMap.svelte:278-303). A theme change callssetStyle, andstyle.loadrunsinstallRouteagain. Today a routed line is 4 px on a casing of 8 px (#fffffflight,#201f17dark). showNighttakes the padded view: the map inset byfitPadding(top 60, right 90, bottom 40 plusbottomInset, left 40) (PlannerMap.svelte:186-198).- The PlannerApp tests replace
PlannerMapwithtest-support/planner/MapStub.svelte(PlannerApp.svelte.test.ts:16).Planner.svelte.test.tsdoes not mount the map. - The approved mock-ups (
tools/mock-ux.mjsof the design folder) draw quiet days in#a9a593, 2.5 px on a casing of 5.5 px, the lit day 6 px on a casing of 9 px, and night dots of 10 px with a ring of 2 px#8f8b78on--panel. They have no labels on the line.
Plan
map-types.ts:MapSegmentgetsday: number, the riding number.MapPointgetsday?: number, the riding day of a shaping point.week.ts, the one source for the week, gets two pure functions:dayLook(week: Week | null, lit: number | null, day: number): 'colour' | 'quiet' | 'lit':litwhendayislit; elsecolourwith no week or whenweek.ridingDaysholds the day; elsequiet.pinLook(week: Week | null, point: MapPoint): 'shown' | 'dot' | 'hidden':shownwith no week. Anightordayendmark isshownwhenweek.nightsholds itsnight(the riding days of the week and the night before it), elsedot. Avia,waypoint,detourorpasspoint with adayisshownwhenweek.ridingDaysholds it, elsehidden. Every other point (start, finish, place, marker, a point with no day) isshown.
PlannerMap.svelte, the line:- New props
week: Week | null = nullandlit: number | null = null, and the callbackonDayClick?: (day: number) => void. tripData()gives each segment feature the propertyday. Thetripsource getspromoteId: "day". The connector features ofgapshave noday, so they have no state.trip-line,trip-casingandtrip-casing-drawntake their values from["coalesce", ["feature-state", "look"], "colour"]withmatch, as the table below says.- An effect on
week,litand the last riding day ofsegmentscomputesdayLookfor each riding day and callsmap.setFeatureState({ source: "trip", id: day }, { look })only for a day whose look changed since the last call (aMapof the set looks). When every look iscolour, it callsremoveFeatureState({ source: "trip" })once.installRouteempties theMap, so the effect sets all looks again on the new source after eachstyle.load. - Cost: a week step of one day changes the look of 2 days, a step of 7 days at most 14, a pointer on the strip 1 or 2. MapLibre writes the paint values of these days in the loaded tiles again. No data goes to the worker, no tile loads again, and no marker is made again.
- New props
PlannerMap.svelte, the markers: the effect that togglesselected,highlightedandmatched(:757-764) also appliespinLookto each pin: the classdotfordot, the classoffforhidden, andmarker.setDraggable(false)for both (else the draggable state of the pin's creation, whichpinskeeps). A dot'stitleis its label, with no drag hint. CSS:.planner-map-pin.dotis 10 × 10 px, with a ring of 2 pxcolor-mix(in srgb, var(--ink-faint) 70%, var(--panel)), the fillvar(--panel), no shadow, and its number, icon and moved mark hidden..planner-map-pin.offhasdisplay: none.PlannerMap.svelte, the quiet line:lineHitalso gives thedayof the segment. Over a quiet day the pointer cursor shows, but no insert dot, and a press does not start an insert drag, so the map pans. A click callsonDayClick(day)and notonLegClick. A quiet line takes no edits, because the shaping points of its day are hidden, and the quiet lines cross the whole map, so an insert drag would catch many pans.PlannerMap.svelte:export function showWeek(line: Coordinate[]).showNightandshowWeekshare one helper for the padded view. When the box oflineis inside the padded view, the map does not move. Else the map callsfitBounds(line, 13, motionDuration()), asfitCoordinatesdoes.PlannerApp.svelte, the week fit. The map moves to the week only after the rider moves the week with the strip (click, drag, keys, wheel) or with the ‹ › of the week header:moveWeek(start)setsweekStartandfitWeek = true. The strip'sonMoveand the header'sonWeekcall it.showInWeeksetsfitWeek = false: an opened day, night, point or search result moves the map itself, and the week fit must not undo it.onRiderMovesetsfitWeek = false: a pan, a zoom or a wheel turn on the map before the week rests cancels the fit.- The rest timer (
:243) setsrestedStart. WhenfitWeekis true, it then setsfitWeek = falseand callsmap.showWeekwith the line from the start of the first riding day of the week to the end of its last (days[d - 1].fromand.tofor the first and the last ofweek.ridingDays). A week with no riding day does not fit. - An opened plan and an applied search that changes the route (
:508,:1099) setfitWeek = false. A plan opens on the whole route, as today, with days 1 to 7 in colour. PlannerMapgets{week}(the moving week, so the colours follow a drag),lit={week ? litDay : null}andonDayClick={showDay}: the day opens, the week moves to it, and the map fits the day, as at a click on a day row.mapPointsgives eachvia,waypoint,detourandpasspoint itsdaywithdayOf(:712).
TripStrip.svelte:onHover?: (riding: number | null) => void, called whenlitchanges: the riding number of a lit riding day, and null for a lit rest day, for no lit day and during a drag.PlannerAppkeeps it aslitDay.- Town answers: when the answers of a rested week move its day ends,
segmentschange and thetripsource gets the whole line again, as before this change. This is accepted: it happens once for each rested week whose answers move a day end, not at a week step or a pointer move; the states belong to the day, so no colour flashes; and the colours need the day ends inside the features. The pull request measures it (Done when). - Docs.
docs/design/web-planner.md, after the sentence on the strip, one sentence: "The map draws the riding days of the week in their colours and the other days as thin grey lines, with their night marks as small dots and their shaping points hidden; the look of a day is a feature state of thetripsource, so a week step sends no line to the map, and the map moves to the week only after a move of the strip or of ‹ ›, when the line of the week is not in view."docs/content/software/trips.md, in adocs:commit: "the list, profile and town search show only that week" becomes "the list, profile, map and town search show only that week; the map draws the other days thin and grey". The page is at its word limit, so the same commit cuts as many words as it adds in the page. Planner: 64 riding days, sent to the bike computer as two parts #3713 adds a sentence to the same paragraph: the second of the two pull requests to merge joins that paragraph by hand and runstools/obc prose --checkagain.
The paint of the three layers (trip-gap, trip-transfer, trip-highlight and trip-rest do not change):
| Layer | Property | colour (as today) |
quiet |
lit |
|---|---|---|---|---|
trip-line |
line-color |
["get", "color"] |
#a9a593 light, #6f6a55 dark |
["get", "color"] |
trip-line |
line-width |
4 | 2.5 | 6 |
trip-casing |
line-width |
8 | 5.5 | 9 |
trip-casing-drawn |
line-color |
as today | the casing colour | as today |
trip-casing-drawn |
line-width |
8 | 5.5 | 9 |
- The quiet colours are
--ink-faintmixed about 57 % into--panelof the theme. The light value is the colour of the mock-ups. - A drawn leg outside the week keeps its dashes, in the casing colour, so it looks like any quiet day.
- A gap leg keeps its dashes of 3 px in every week: it is a fault that the rider must find on the whole trip.
- A transfer keeps its grey dashes: it has no day colour today.
Files
builder/web/src/lib/planner/map-types.ts: change:dayonMapSegmentandMapPoint.builder/web/src/lib/planner/week.ts,week.test.ts: change:dayLook,pinLookand their tests.builder/web/src/components/planner/PlannerMap.svelte: change: day ids and feature states, the paint table, marker looks and CSS, the quiet line,showWeek.builder/web/src/components/planner/PlannerApp.svelte,PlannerApp.svelte.test.ts: change:moveWeek,fitWeek, the new map props,dayof shaping points; one test of the week fit.builder/web/test-support/planner/MapStub.svelte: change:showWeek, which counts its calls.builder/web/src/components/planner/TripStrip.svelte: change:onHover.docs/design/web-planner.md: change: the map of a week.docs/content/software/trips.md: change: one clause, and as many words cut, in adocs:commit.
Done when
-
Tests:
week.test.ts, a 20-day plan with the week on days 8 to 14.dayLook: days 8 and 14colour, days 7 and 15quiet, lit day 3lit, and with no week every daycolour.pinLook: the marks of nights 7 (the night before the week) and 14shown, of nights 6 and 15dot; a shaping point of day 9shown, of day 3hidden; start, finish and a placeshown; with no week every pointshown.PlannerApp.svelte.test.ts, a 20-day plan: › in the week header gives oneshowWeekcall after the rest; opening a day row gives none.
-
Checks, in
builder/web:npx vitest run src/lib/planner/week.test.ts src/components/planner/PlannerApp.svelte.test.ts src/components/planner/TripStrip.svelte.test.ts,npm run check. In the root, on the branch merged withorigin/develop:python3 docs/build_docs.py --check-links,tools/obc prose --check. -
Up to 14 riding days the map is as today. Proof: with no week,
dayLookgivescolourandpinLookgivesshown(tests above), so no state and no class is set; and the 14-day test plan at 1440 × 900 on the base and on the head of the pull request, compared withtools/diff.mjs, has 0 differing pixels in the map. -
Speed, with the setup of the Planner: a strip of all days and a week in focus for trips of 15 days or more #3712 speed proof in
/media/timo/OSM1/tmp/explore-3506/build-3712/:tools/run.sh(route service, proxy, dev page;SEARCH=1adds the local town search onlocal-search/),tools/exp.py(the throwaway edits for "before" and "after"), the planstools/bike-32.jsonandtools/bike-64.json, andtools/speed.mjs. Copytools/into a scratch folder of this step (build-3714/tools) and change the copy:Wand every path point at the worktree of this step, also the search thatrun.shstarts;- "before" is the base of the pull request, not a fixed commit;
- when Planner: 64 riding days, sent to the bike computer as two parts #3713 is merged, drop the edit and the check of
maxRidingDays = 32inexp.py; speed.mjsmarksobc:nightsfor each rested week, not once for each load, for the "search on" measure.
The 64-day plan when Planner: 64 riding days, sent to the bike computer as two parts #3713 is merged, else the 32-day plan (the town search refuses the 64-day line until Planner: 64 riding days, sent to the bike computer as two parts #3713). Dev page at 1920 × 1080, 3 runs. The pull request says whether the terrain run was active and gives the load average.
- Search off: from one → on the focused strip to the next map
idle. Pass when nodataevent of the sourcetripwithsourceDataType: "content"comes. Report the median time and the longest main-thread task. - Search on: from one → on the focused strip to the map
idleafter the answers of the new week's nights (obc:nights), on the base and on the head. Report the medians and the longest main-thread task. Pass when the median of the head is at most the median of the base plus 15 %, the margin of the epic's speed gates.
-
Pictures at 1440 × 900 (
tools/shots.mjsof the copied tools, extended), on 64 days when Planner: 64 riding days, sent to the bike computer as two parts #3713 is merged, else on 32, mock-up | built, mock-ups in/media/timo/OSM1/tmp/explore-3506/long-trips-design/panels/: the 32-day plan, week 8 to 14 (ux-new-32.png); the 64-day plan, week 36 to 42 (ux-new-64.png), else the 32-day plan, week 22 to 28; the pointer on day 45 (ux-new-64-hover.png), else on day 20 of the 32-day plan. Built only: the 32-day plan in the dark theme. -
The owner's check, on the head of the pull request served on the build PC, with the 64-day test plan when Planner: 64 riding days, sent to the bike computer as two parts #3713 is merged (else the 32-day plan, with days 22 to 28 for 36 to 42 and day 20 for 45):
- The plan opens on the whole trip. Pass when days 1 to 7 have their colours and numbered nights, and the other days are thin grey lines with small dots and no numbers.
- He opens Day 3 in the day list, so the map shows day 3. He drags the week on the strip to days 36 to 42 and lets go. Pass when the colours follow the pointer with no stutter, the map stays still during the drag, and the map moves to days 36 to 42 once after he lets go.
- He presses "Show whole route", then ›. Pass when the map does not move.
- He points at day 45 on the strip. Pass when day 45 lights up on the map in its colour, wider, and the map does not move.
- He clicks a grey dot. Pass when its night opens in the list, the week moves to it and the map does not move. He clicks a grey line. Pass when its day opens, the map shows that day and does not move again a moment later.
- He presses on a grey line and drags. Pass when the map pans and no point is added.
Fail when two coloured days next to each other have the same colour, numbers or shaping points of other weeks show, or the map moves when he did not move the week with the strip or ‹ ›.
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: the week in colour, the other days grey with dots, the map move, the lit day, a click on a grey dot and line, "Show whole route", 14 days unchanged): "Yes, merge it".
Generated by Claude Code
Merge the map step #3714 (7d6f842) into claude/longtrips-3713-two-parts