feat(trail-edit): centre on the user, maximise map, stats overlay, colour (#49) #58

Closed
maximus wants to merge 0 commits from feat/49-map-layout into deploy
Member

Part 1 of #49 (trail editor, /trail/edit/new): the Map & layout items. Doesn't close #49.

PR 1 of 2. The profile and track-colouring PR is stacked on this one.

#49 checklist items covered

  • Centre on my position. MapLibre's GeolocateControl.trigger() does nothing until the control's async setup has finished. On load that hadn't happened yet, so autoGeolocateOnDrawing never centred the map. Later it put the map into tracking mode on every "Edit route". The editor now uses a one-shot helper (util/map_geolocation.ts) instead:
    • It asks the browser once and jumps to a valley-scale zoom.
    • It doesn't jump if the user has already panned or zoomed, or has started a route.
    • It caches the last fix in localStorage, so the next new trail opens there at once.
    • If permission is denied, the map keeps the default view.
  • Maximise the map. A new map control at the bottom right (also the F key; Esc leaves) puts the map over the whole page, top bar and sidebar included. The route toolbars stay visible. This is separate from the existing immersive mode, which also hides the toolbars.
  • Stats overlay. Coloured tiles for distance, D+, D− and estimated time show on the map while the sidebar is hidden or the map is maximised. The time is the personal-pace estimate when there is one, otherwise the router's. This replaces the old one-line overlay.
  • More colour and better design.
    • The same stat tiles appear in the sidebar under the draw button.
    • The section headings (Pick a trail, Waypoints, Photos, Summit book, Lists) have accent-coloured icons.
    • The "My pace" panel has an emerald tint.
    • The colours are Tailwind palette tones with light and dark variants, on top of the existing theme tokens.

Scope notes

  • The Basic info section (its fields, name/location/category/difficulty) is untouched, for the part-2 PR. The only change near it is the pace panel's outer class.
  • New code lives in web/src/lib/components/trail/editor/* and web/src/lib/util/{map_geolocation,trail_editor_stats}.ts. The page only wires them in.
  • en.json is the only locale touched.

Tests

  • npm run check: 0 errors, 2 warnings. Both warnings were already there (the pace-table <tbody> click).
  • vitest: new map_geolocation.test.ts (cache parsing, zoom, "user moved", "route exists", denial/throw) and trail_editor_stats.test.ts. Full suite, run on the stacked head (this PR plus the next one): 874 passed.
    • It also reports 1 unhandled ReadableStream is already closed rejection from src/lib/server/trail_analyze.test.ts. That file is untouched here and the rejection reproduces on it alone.
  • The changed .svelte files compile with the Svelte compiler for both client and server.
  • Not checked visually in a browser: the browser broker couldn't reach wanderer.bearoverse.com (connection refused).

🤖 Generated with Claude Code

Part 1 of #49 (trail editor, `/trail/edit/new`): the **Map & layout** items. Doesn't close #49. PR 1 of 2. The profile and track-colouring PR is stacked on this one. ## #49 checklist items covered - [x] **Centre on my position.** MapLibre's `GeolocateControl.trigger()` does nothing until the control's async setup has finished. On load that hadn't happened yet, so `autoGeolocateOnDrawing` never centred the map. Later it put the map into tracking mode on every "Edit route". The editor now uses a one-shot helper (`util/map_geolocation.ts`) instead: - It asks the browser once and jumps to a valley-scale zoom. - It doesn't jump if the user has already panned or zoomed, or has started a route. - It caches the last fix in localStorage, so the next new trail opens there at once. - If permission is denied, the map keeps the default view. - [x] **Maximise the map.** A new map control at the bottom right (also the `F` key; `Esc` leaves) puts the map over the whole page, top bar and sidebar included. The route toolbars stay visible. This is separate from the existing immersive mode, which also hides the toolbars. - [x] **Stats overlay.** Coloured tiles for distance, D+, D− and estimated time show on the map while the sidebar is hidden or the map is maximised. The time is the personal-pace estimate when there is one, otherwise the router's. This replaces the old one-line overlay. - [x] **More colour and better design.** - The same stat tiles appear in the sidebar under the draw button. - The section headings (Pick a trail, Waypoints, Photos, Summit book, Lists) have accent-coloured icons. - The "My pace" panel has an emerald tint. - The colours are Tailwind palette tones with light and dark variants, on top of the existing theme tokens. ## Scope notes - The Basic info section (its fields, name/location/category/difficulty) is untouched, for the part-2 PR. The only change near it is the pace panel's outer `class`. - New code lives in `web/src/lib/components/trail/editor/*` and `web/src/lib/util/{map_geolocation,trail_editor_stats}.ts`. The page only wires them in. - en.json is the only locale touched. ## Tests - `npm run check`: 0 errors, 2 warnings. Both warnings were already there (the pace-table `<tbody>` click). - vitest: new `map_geolocation.test.ts` (cache parsing, zoom, "user moved", "route exists", denial/throw) and `trail_editor_stats.test.ts`. Full suite, run on the stacked head (this PR plus the next one): 874 passed. - It also reports 1 unhandled `ReadableStream is already closed` rejection from `src/lib/server/trail_analyze.test.ts`. That file is untouched here and the rejection reproduces on it alone. - The changed `.svelte` files compile with the Svelte compiler for both client and server. - Not checked visually in a browser: the browser broker couldn't reach wanderer.bearoverse.com (connection refused). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat(trail-edit): centre on the user, maximise map, stats overlay, colour (#49)
All checks were successful
CI / web (push) Successful in 1m45s
CI / go (push) Successful in 14m21s
f9017fad02
Map and layout items of #49 on the trail editor:

- Centre a new trail on the user's position. MapLibre's GeolocateControl
  cannot be triggered before its async setup finishes, so the existing
  autoGeolocateOnDrawing call did nothing on load (and later switched the
  map into tracking mode on every "Edit route"). A one-shot helper now asks
  the browser once, jumps there unless the user already moved the map or
  started a route, and caches the last fix for an instant first view.
- Maximise the map: a map control (and the F key, Esc to leave) expands the
  map over the whole page, top bar and sidebar included.
- Stats overlay: distance, D+, D- and estimated time (personal pace when
  estimated, else the router's) as coloured tiles on the map while the
  sidebar is hidden or the map is maximised.
- Design: the same stat tiles in the sidebar, accent-coloured section
  headings and a tinted pace panel, all on Tailwind palette tones with
  light and dark variants.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XMf4EGfBC9xbQ6rjD6HxgP
Author
Member

Shipped via batch PR #64 (deploy 0d0d85a4), which merged this branch head unchanged; live since 2026-11-05 ~19:30 CET in wanderer-web:deploy-676a7c62 (homelab-flux #843). Forgejo does not mark stacked PRs as merged, so I am closing this by hand.

🤖 Generated with Claude Code

Shipped via batch PR #64 (`deploy` 0d0d85a4), which merged this branch head unchanged; live since 2026-11-05 ~19:30 CET in `wanderer-web:deploy-676a7c62` (homelab-flux #843). Forgejo does not mark stacked PRs as merged, so I am closing this by hand. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
maximus closed this pull request 2026-11-05 19:10:44 +00:00
All checks were successful
CI / web (push) Successful in 1m45s
Required
Details
CI / go (push) Successful in 14m21s
Required
Details

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
public/wanderer!58
No description provided.