Repository navigation
Description
Status: done
Size: M
Part of #3286 (round 2, after the owner's browser check).
Systems: route-planning
TL;DR
Goal: The side panel shows one level at a time: the trip, then one night, then one town. Each level below the trip starts with a back row that names the level above.
Problem: A night opens as a box inside the day list, and a town opens as a card inside that box. The panel then holds three levels at once, and the list moves when a night opens or closes. The owner gets lost in it.
Decision: "Choose" on a night replaces the day list with a page for that night. A town replaces the night page. Nothing opens inside the day list. (Wireframe page https://claude.ai/artifact/HibXoqwkvZM9jHwdae1Ka7, question 3, option A.)
Rejected: The night stays in the list as a filled block (option B): the panel still holds two levels, and the list still moves.
Words
- Day list: the list of riding days and nights in the side panel (
Itinerary.svelteinbuilder/web/src/components/planner/). A night row is one night of it (NightNode.svelte). - Night picker: the list of towns where the rider can sleep on one night (
StopPicker.svelte). A stop is one town of it, with its places to sleep. The town card shows one stop (StopCard.svelte). - Open day: a day that the rider opened from the day list. The panel then shows only that day, with the back row "All days" (
.day-navinItinerary.svelte). This exists today and is the model for the night page. - Stay kind: one of the five kinds of place to sleep (camp, hut, hostel, hotel, shelter).
Facts
- All state is in
PlannerApp.svelte:choosingNight, the derivedpickerNight(null in a search),stopId(the open town) andexpandedDay(the open day). The objectnights(NightChoicesinlib/planner/night-stops.svelte.ts) gives them to the day list. NightNode.svelte: "Choose" or "Change" callsnights.choose(day.number). Whilenights.choosing === day.number, the row renders.night-panelwith a close button and its children.Escapeon the panel and the close button callnights.choose(null).Itinerary.sveltepasses the snippettowns, which rendersStopPicker.StopPickershowsStopCardin place of the list while a town is open; the card has the back row "All towns".- While a night is open from the day list, the side panel still shows the search field, the totals, the notes row, the trip row and the whole day list.
- An open day hides the totals, the notes row and the trip row. Inside an open day,
DayRow.svelteshows the picker under "Where to sleep" (.choose), with "Cancel". stopCountsinlib/planner/stops.tsgives a text such as "1 campsite · 2 hostels · 17 hotels · 1 shelter". The night row and the town rows show it.- The footer row of
StopPickerholds the stay kinds (StayChip) and "Pick on the map". PlannerApp.sveltehides the search field withstyle:displayon.query-slotwhile the signed routes are open.pickerNightis also null while the route is recalculated (session.stale), for example after a drag of a route point;choosingNightstays set in that time.- With a rest day, the number of a night in the code (the riding number) differs from the number that the rider sees.
StopPickergets the visible numbers aslabels: the day that ends and the day that starts. Itinerary.svelteshows the block "N campsites suggested" with "Keep all" (.keep) whenever no day is open.- The side panel scrolls in
.pane-scroll.Itinerary.svelteresets the scroll position only when the open day changes. - A night also opens from the elevation profile (
openNight) and from the callout of the map.
Plan
PlannerApp.svelte: one derived flagnightPagesays that the night page shows:choosingNightis set, no day is open and no search is open. It does not depend onsession.stale, so the page stays while the route is recalculated; the picker then shows its loading line.PlannerApp.sveltepasses the flag toItinerary, so the two cannot disagree.Itinerary.svelte: whilenightPageis true, the component renders the night page in place of the list and of the block.keep: a back row "All days" (the markup and the class of.day-nav, the same text as the back row of an open day), the heading "Night " and the first oflabels, the line "Where day X ends and day Y starts" with bothlabels, then{@render towns(N)}.- Back and
Escape: the back row callsnights.choose(null).Escapegoes back one level: it closes the open town, or, with no town open, the night. When the page opens, from the day list, the profile or the map, focus moves to the back row. When the page closes, by the back row,Escape, the end of a day in a town or "Let the planner choose", focus goes to the "Choose" or "Change" button of that night in the day list. - Scroll: when the page opens,
PlannerApp.svelteorItinerary.sveltekeeps the scroll position of.pane-scrolland sets it to the top. When the page closes, it restores the position, so the day list is where the rider left it. A town page also opens at the top. NightNode.svelte: delete.night-panel, its close button, itsEscapehandler, its children and their styles. The row keeps its name, its counts, its two step buttons and "Choose" or "Change".PlannerApp.svelte: whilenightPageis true, the side panel hides the search field (as for the signed routes), the notes row and the trip row. Planner: the totals leave the side panel (two variants to compare) #3370 removes the totals from the side panel; if it is not merged yet, hide.trip-summaryhere too.StopPicker.svelte: the row with the stay kinds and "Pick on the map" becomes the first row of the picker, above the towns. "Cancel", which shows only inside an open day, stays in that row. "Let the planner choose" stays below the towns. The picker of an open day gets the same order; nothing else of it changes.StopCard.svelte: the back row reads "Night " and the first oflabelson the night page, and stays "All towns" inside an open day.lib/planner/stops.ts: a short form of the counts for a row. It counts the same places asstopCounts(only the stay kinds of the night). With more than two stay kinds present, the text is "21 places to sleep"; with one or two kinds it is the text ofstopCounts. The night row and the town rows show the short form; the accessible name of a town row keeps the full text. The header of the town card keepsstopCounts.- The move of the map does not change:
nightToShowandshowNightact as today when the night page opens. - Tests: update the cases of
Planner.svelte.test.tsandPlannerApp.svelte.test.tsthat read.night-panel, its close button andEscape. New cases: "Choose" shows the night page and hides the day list,.keep, the search field, the notes row and the trip row; the page stays while the route is recalculated; the back row andEscapereturn to the day list with focus on the button of the night;Escapewith an open town closes only the town; the heading of a night after a rest day; the short form of the counts. - Docs, in its own
docs:commit:docs/content/software/trips.md, where it describes how the rider chooses a night.
Done when
- From
builder/web:npx vitest run src/components/planner/ src/lib/planner/andnpm run check python3 docs/build_docs.py --check-links- In the running planner: "Choose" on a night shows only that night; a town shows only that town; each back row returns one level, and the day list is where the rider left it.
Activity