feat(web): Karte/Satellit layer toggle on the Leaflet map #1105

Merged
chris merged 2 commits from feat/map-satellite-layer-toggle into main 2026-10-11 13:31:58 +02:00
Owner

Summary

Adds an optional map/satellite layer switcher to MapView.svelte, shown only when the tile provider supplies satelliteTileUrlTemplate (otherwise the map renders exactly as before).

Interaction

  • Compact segmented control with two options, Karte and Satellit, wrapped in role="group" aria-label="Kartenstil"; each segment is a native button with aria-pressed, keyboard focusable with a visible focus-visible:ring-2 ring-emerald-300 ring.
  • Active segment is filled emerald (bg-emerald-400 text-emerald-950), inactive segments are text-neutral-400 with a hover lift; the pill uses the established control language: rounded-2xl border border-neutral-700 bg-neutral-950/95 backdrop-blur shadow-xl shadow-black/35 — same family as the split-view toggle.
  • Switching swaps only the tile layer (URL template + attribution). Center, zoom, markers, bounds, and events are untouched.
  • Choice persists in localStorage under memories.map.layer ('map' | 'satellite', read on mount with error guard) and applies to every MapView instance (map page, album map, media info panel) via a component-internal window event + storage listener — no new props, no public API change.
  • If the provider has no satellite template but a stored preference is 'satellite', the component silently falls back to the base layer.

Placement

Bottom-right of the map frame at bottom-10 right-3 (z-[500]). Deliberately 40px above the bottom edge rather than bottom-4: Leaflet's attribution bar hugs the bottom-right corner and grows to multiple lines once satellite credits (satelliteAttribution or fallback Esri, Maxar, Earthstar Geographics) are appended, so bottom-4 would collide. bottom-10 clears it in every case, keeps the control clear of the zoom control (topright) and the split-view toggle (right-3 top-[6.25rem]), and the 40px pill height is touch-friendly on mobile. The control is a sibling of the Leaflet container (not inside it), so map drags/scroll cannot be captured by it.

Other changes

  • renderTileLayer() refactored to resolve the active template: base → tileUrlTemplate/attribution, satellite → satelliteTileUrlTemplate/satelliteAttribution (fallback attribution 'Esri, Maxar, Earthstar Geographics' when empty). maxZoom: 19, detectRetina: true preserved.
  • The reactive tile-layer statement now also keys on provider.satelliteTileUrlTemplate, provider.satelliteAttribution, and the active layer.
  • MapTileProviderSettings gains the three optional satellite fields (identical block as the parallel backend lane, so the merge is trivial).

Verification

  • npm run check (svelte-kit sync + svelte-check): 0 errors; 22 warnings, all pre-existing in unrelated route files — none in the changed files.
## Summary Adds an optional map/satellite layer switcher to `MapView.svelte`, shown only when the tile provider supplies `satelliteTileUrlTemplate` (otherwise the map renders exactly as before). ### Interaction - Compact segmented control with two options, **Karte** and **Satellit**, wrapped in `role="group"` `aria-label="Kartenstil"`; each segment is a native button with `aria-pressed`, keyboard focusable with a visible `focus-visible:ring-2 ring-emerald-300` ring. - Active segment is filled emerald (`bg-emerald-400 text-emerald-950`), inactive segments are `text-neutral-400` with a hover lift; the pill uses the established control language: `rounded-2xl border border-neutral-700 bg-neutral-950/95 backdrop-blur shadow-xl shadow-black/35` — same family as the split-view toggle. - Switching swaps **only** the tile layer (URL template + attribution). Center, zoom, markers, bounds, and events are untouched. - Choice persists in `localStorage` under `memories.map.layer` (`'map' | 'satellite'`, read on mount with error guard) and applies to every MapView instance (map page, album map, media info panel) via a component-internal window event + `storage` listener — no new props, no public API change. - If the provider has no satellite template but a stored preference is `'satellite'`, the component silently falls back to the base layer. ### Placement Bottom-right of the map frame at `bottom-10 right-3` (`z-[500]`). Deliberately 40px above the bottom edge rather than `bottom-4`: Leaflet's attribution bar hugs the bottom-right corner and grows to multiple lines once satellite credits (`satelliteAttribution` or fallback *Esri, Maxar, Earthstar Geographics*) are appended, so `bottom-4` would collide. `bottom-10` clears it in every case, keeps the control clear of the zoom control (`topright`) and the split-view toggle (`right-3 top-[6.25rem]`), and the 40px pill height is touch-friendly on mobile. The control is a sibling of the Leaflet container (not inside it), so map drags/scroll cannot be captured by it. ### Other changes - `renderTileLayer()` refactored to resolve the active template: base → `tileUrlTemplate`/`attribution`, satellite → `satelliteTileUrlTemplate`/`satelliteAttribution` (fallback attribution `'Esri, Maxar, Earthstar Geographics'` when empty). `maxZoom: 19`, `detectRetina: true` preserved. - The reactive tile-layer statement now also keys on `provider.satelliteTileUrlTemplate`, `provider.satelliteAttribution`, and the active layer. - `MapTileProviderSettings` gains the three optional satellite fields (identical block as the parallel backend lane, so the merge is trivial). ## Verification - `npm run check` (svelte-kit sync + svelte-check): **0 errors**; 22 warnings, all pre-existing in unrelated route files — none in the changed files.
feat(web): add Karte/Satellit layer toggle to MapView
All checks were successful
Wiki Sync / Sync wiki from docs (push) Has been skipped
Build and Deploy / Detect changed services and test scopes (push) Successful in 6s
Build and Deploy / Android unit tests and debug APK (push) Has been skipped
Build and Deploy / Smoke API and media worker (push) Has been skipped
Build and Deploy / Smoke web (push) Has been skipped
Build and Deploy / Smoke ML worker (push) Has been skipped
Build and Deploy / Smoke people worker (push) Has been skipped
Build and Deploy / Build postgres image (push) Has been skipped
Build and Deploy / Build plants worker image (push) Has been skipped
Build and Deploy / Build converter worker image (push) Has been skipped
Build and Deploy / Deploy postgres (push) Has been skipped
Build and Deploy / Build API image (push) Has been skipped
Build and Deploy / Build media worker image (push) Has been skipped
Build and Deploy / Build ML worker image (push) Has been skipped
Build and Deploy / Build people worker image (push) Has been skipped
Build and Deploy / Build web image (push) Has been skipped
Build and Deploy / Deploy API (push) Has been skipped
Build and Deploy / Deploy web (push) Has been skipped
Build and Deploy / Deploy media worker (push) Has been skipped
Build and Deploy / Deploy ML worker (push) Has been skipped
Build and Deploy / Deploy plants worker (push) Has been skipped
Build and Deploy / Deploy people worker (push) Has been skipped
Build and Deploy / Deploy converter worker (push) Has been skipped
Build and Deploy / Clean Docker build artifacts (push) Has been skipped
Build and Deploy / Run scoped PR tests (push) Successful in 23m8s
13cb5b4567
- Segmented control (role=group, aria-label 'Kartenstil', aria-pressed
  buttons) rendered only when provider.satelliteTileUrlTemplate is set
- Layer choice persisted under localStorage key 'memories.map.layer',
  read on mount with error guard, synced across MapView instances via a
  window event and the storage event
- renderTileLayer() picks base vs satellite template/attribution
  (satellite attribution falls back to 'Esri, Maxar, Earthstar
  Geographics'); center, zoom, markers untouched
- Reactive tile-layer statement now keyed on satellite fields and the
  active layer
- Type: optional satellite fields added to MapTileProviderSettings for
  the parallel backend lane
Merge remote-tracking branch 'origin/main' into feat/map-satellite-layer-toggle
All checks were successful
Wiki Sync / Sync wiki from docs (push) Has been skipped
Build and Deploy / Detect changed services and test scopes (push) Successful in 3s
Build and Deploy / Android unit tests and debug APK (push) Has been skipped
Build and Deploy / Build postgres image (push) Has been skipped
Build and Deploy / Smoke API and media worker (push) Has been skipped
Build and Deploy / Smoke web (push) Has been skipped
Build and Deploy / Smoke ML worker (push) Has been skipped
Build and Deploy / Smoke people worker (push) Has been skipped
Build and Deploy / Build plants worker image (push) Has been skipped
Build and Deploy / Build converter worker image (push) Has been skipped
Build and Deploy / Deploy postgres (push) Has been skipped
Build and Deploy / Build API image (push) Has been skipped
Build and Deploy / Build media worker image (push) Has been skipped
Build and Deploy / Build ML worker image (push) Has been skipped
Build and Deploy / Build people worker image (push) Has been skipped
Build and Deploy / Build web image (push) Has been skipped
Build and Deploy / Deploy API (push) Has been skipped
Build and Deploy / Deploy web (push) Has been skipped
Build and Deploy / Deploy media worker (push) Has been skipped
Build and Deploy / Deploy ML worker (push) Has been skipped
Build and Deploy / Deploy plants worker (push) Has been skipped
Build and Deploy / Deploy people worker (push) Has been skipped
Build and Deploy / Deploy converter worker (push) Has been skipped
Build and Deploy / Clean Docker build artifacts (push) Has been skipped
Build and Deploy / Run scoped PR tests (push) Successful in 6m42s
4ef5947735
chris merged commit de65a9c411 into main 2026-10-11 13:31:58 +02:00
Sign in to join this conversation.
No reviewers
No labels
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
chris/memories!1105
No description provided.