Skip to content

Planner map: the week in colour, the rest of a long trip quiet #3714

Closed

Description

@timohueser

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-highlight source: 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 from daySegments, which gives day, the riding number (editor.ts:295-301); PlannerApp.svelte:375 keeps it, but MapSegment (map-types.ts) has no day.
  • The trip source gets setData at 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 and segments change (PlannerApp.svelte:375).
  • In maplibre-gl 6.11.2, line-color and line-width take feature-state; line-dasharray does 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 through setData.
  • Night marks, day-end marks and shaping points are DOM markers, made again only when their point changes (PlannerMap.svelte:694-756). MapPoint has night on 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). lineHit gives 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, reveal and an applied search move the week with showInWeek (PlannerApp.svelte:247). The strip (:1365) and the ‹ › of the week header (:1249) set weekStart directly. 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 calls setStyle, and style.load runs installRoute again. Today a routed line is 4 px on a casing of 8 px (#ffffff light, #201f17 dark).
  • showNight takes the padded view: the map inset by fitPadding (top 60, right 90, bottom 40 plus bottomInset, left 40) (PlannerMap.svelte:186-198).
  • The PlannerApp tests replace PlannerMap with test-support/planner/MapStub.svelte (PlannerApp.svelte.test.ts:16). Planner.svelte.test.ts does not mount the map.
  • The approved mock-ups (tools/mock-ux.mjs of 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 #8f8b78 on --panel. They have no labels on the line.

Plan

  1. map-types.ts: MapSegment gets day: number, the riding number. MapPoint gets day?: number, the riding day of a shaping point.
  2. week.ts, the one source for the week, gets two pure functions:
    • dayLook(week: Week | null, lit: number | null, day: number): 'colour' | 'quiet' | 'lit': lit when day is lit; else colour with no week or when week.ridingDays holds the day; else quiet.
    • pinLook(week: Week | null, point: MapPoint): 'shown' | 'dot' | 'hidden': shown with no week. A night or dayend mark is shown when week.nights holds its night (the riding days of the week and the night before it), else dot. A via, waypoint, detour or pass point with a day is shown when week.ridingDays holds it, else hidden. Every other point (start, finish, place, marker, a point with no day) is shown.
  3. PlannerMap.svelte, the line:
    • New props week: Week | null = null and lit: number | null = null, and the callback onDayClick?: (day: number) => void.
    • tripData() gives each segment feature the property day. The trip source gets promoteId: "day". The connector features of gaps have no day, so they have no state.
    • trip-line, trip-casing and trip-casing-drawn take their values from ["coalesce", ["feature-state", "look"], "colour"] with match, as the table below says.
    • An effect on week, lit and the last riding day of segments computes dayLook for each riding day and calls map.setFeatureState({ source: "trip", id: day }, { look }) only for a day whose look changed since the last call (a Map of the set looks). When every look is colour, it calls removeFeatureState({ source: "trip" }) once. installRoute empties the Map, so the effect sets all looks again on the new source after each style.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.
  4. PlannerMap.svelte, the markers: the effect that toggles selected, highlighted and matched (:757-764) also applies pinLook to each pin: the class dot for dot, the class off for hidden, and marker.setDraggable(false) for both (else the draggable state of the pin's creation, which pins keeps). A dot's title is its label, with no drag hint. CSS: .planner-map-pin.dot is 10 × 10 px, with a ring of 2 px color-mix(in srgb, var(--ink-faint) 70%, var(--panel)), the fill var(--panel), no shadow, and its number, icon and moved mark hidden. .planner-map-pin.off has display: none.
  5. PlannerMap.svelte, the quiet line: lineHit also gives the day of 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 calls onDayClick(day) and not onLegClick. 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.
  6. PlannerMap.svelte: export function showWeek(line: Coordinate[]). showNight and showWeek share one helper for the padded view. When the box of line is inside the padded view, the map does not move. Else the map calls fitBounds(line, 13, motionDuration()), as fitCoordinates does.
  7. 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) sets weekStart and fitWeek = true. The strip's onMove and the header's onWeek call it.
    • showInWeek sets fitWeek = false: an opened day, night, point or search result moves the map itself, and the week fit must not undo it.
    • onRiderMove sets fitWeek = false: a pan, a zoom or a wheel turn on the map before the week rests cancels the fit.
    • The rest timer (:243) sets restedStart. When fitWeek is true, it then sets fitWeek = false and calls map.showWeek with the line from the start of the first riding day of the week to the end of its last (days[d - 1].from and .to for the first and the last of week.ridingDays). A week with no riding day does not fit.
    • An opened plan and an applied search that changes the route (:508, :1099) set fitWeek = false. A plan opens on the whole route, as today, with days 1 to 7 in colour.
    • PlannerMap gets {week} (the moving week, so the colours follow a drag), lit={week ? litDay : null} and onDayClick={showDay}: the day opens, the week moves to it, and the map fits the day, as at a click on a day row.
    • mapPoints gives each via, waypoint, detour and pass point its day with dayOf (:712).
  8. TripStrip.svelte: onHover?: (riding: number | null) => void, called when lit changes: the riding number of a lit riding day, and null for a lit rest day, for no lit day and during a drag. PlannerApp keeps it as litDay.
  9. Town answers: when the answers of a rested week move its day ends, segments change and the trip source 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).
  10. 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 the trip source, 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 a docs: 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 runs tools/obc prose --check again.

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-faint mixed about 57 % into --panel of 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: day on MapSegment and MapPoint.
  • builder/web/src/lib/planner/week.ts, week.test.ts: change: dayLook, pinLook and 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, day of 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 a docs: commit.

Done when

  • Tests:

    • week.test.ts, a 20-day plan with the week on days 8 to 14. dayLook: days 8 and 14 colour, days 7 and 15 quiet, lit day 3 lit, and with no week every day colour. pinLook: the marks of nights 7 (the night before the week) and 14 shown, of nights 6 and 15 dot; a shaping point of day 9 shown, of day 3 hidden; start, finish and a place shown; with no week every point shown.
    • PlannerApp.svelte.test.ts, a 20-day plan: › in the week header gives one showWeek call 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 with origin/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, dayLook gives colour and pinLook gives shown (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 with tools/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=1 adds the local town search on local-search/), tools/exp.py (the throwaway edits for "before" and "after"), the plans tools/bike-32.json and tools/bike-64.json, and tools/speed.mjs. Copy tools/ into a scratch folder of this step (build-3714/tools) and change the copy:

    • W and every path point at the worktree of this step, also the search that run.sh starts;
    • "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 = 32 in exp.py;
    • speed.mjs marks obc:nights for 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 no data event of the source trip with sourceDataType: "content" comes. Report the median time and the longest main-thread task.
    • Search on: from one → on the focused strip to the map idle after 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.mjs of 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):

    1. 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.
    2. 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.
    3. He presses "Show whole route", then ›. Pass when the map does not move.
    4. 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.
    5. 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.
    6. 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

  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: 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

  2. added a commit that references this issue on Nov 20, 2026
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