trails/apps/planner/app/components
Ullrich Schäfer 3b9672e0ff
planner: give the Yjs document a typed schema seam
The routeData Y.Map's ~15 string keys (geojson, coordinates,
segmentBoundaries, road metadata, profile, colorMode, baseLayer,
overlays, poiCategories) were read and written raw at ~30 call sites,
each with its own JSON parsing and casts; parseJsonArray existed twice
and waypoint extraction four times. GPX assembly was duplicated between
SaveToJournalButton and ExportButton, so the saved plan and the
exported file could silently diverge.

- new lib/route-data.ts owns the routeData (+ noGoAreas) schema:
  typed read/write, JSON encoding internal, ColorMode moves here
  (re-exported from ColoredRoute for existing importers)
- new lib/gpx-export.ts owns GPX assembly: buildRouteGpx /
  buildPlanGpx / buildDayGpxFiles / hasDayBreaks; multi-day splitting
  becomes a pure, tested function
- waypoint-ymap.ts gains extractWaypoints / extractWaypointData; the
  four hand-rolled copies (use-routing, use-waypoint-manager,
  WaypointSidebar, use-days) now share it, and WaypointSidebar's
  moveWaypoint reuses the round-trip helpers instead of re-listing
  every waypoint field
- all hooks/components consume the seam; no raw routeData key strings
  remain outside route-data.ts

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-10 01:35:04 +02:00
..
ClientOnly.tsx Fix SSR and automerge timing 2026-03-23 00:49:54 +01:00
ColoredRoute.tsx planner: give the Yjs document a typed schema seam 2026-06-10 01:35:04 +02:00
DayBreakdown.tsx Fix i18n: use planner namespace in sidebar components 2026-04-10 23:59:27 +02:00
ElevationChart.tsx planner: give the Yjs document a typed schema seam 2026-06-10 01:35:04 +02:00
ExportButton.tsx planner: give the Yjs document a typed schema seam 2026-06-10 01:35:04 +02:00
MapHelpers.tsx planner: give the Yjs document a typed schema seam 2026-06-10 01:35:04 +02:00
MidpointHandles.tsx Add route interactions: click-to-split, drag-to-reshape, colored route rendering 2026-03-26 21:15:55 +01:00
NearbyPoiMarkers.tsx Add per-waypoint notes and nearby POI snap to Planner 2026-05-17 23:58:21 +02:00
NoGoAreaLayer.tsx chore(ts): replace 7 \as unknown as\ shims with proper types 2026-05-26 01:02:25 +02:00
NotesPanel.tsx Fix notes not loading on session reload 2026-04-11 03:00:51 +02:00
ParticipantList.tsx Fix mobile header layout: hide secondary items on small screens 2026-04-12 19:39:19 +02:00
PlannerMap.tsx chore(ts): replace 7 \as unknown as\ shims with proper types 2026-05-26 01:02:25 +02:00
PoiPanel.tsx chore(ts): replace 7 \as unknown as\ shims with proper types 2026-05-26 01:02:25 +02:00
ProfileSelector.tsx planner: give the Yjs document a typed schema seam 2026-06-10 01:35:04 +02:00
RouteInteraction.tsx chore(ts): replace 7 \as unknown as\ shims with proper types 2026-05-26 01:02:25 +02:00
SaveToJournalButton.tsx planner: give the Yjs document a typed schema seam 2026-06-10 01:35:04 +02:00
SessionView.tsx planner: give the Yjs document a typed schema seam 2026-06-10 01:35:04 +02:00
WaypointContextMenu.tsx Replace right-click behavior with context menu on waypoints 2026-04-11 02:42:43 +02:00
WaypointSidebar.tsx planner: give the Yjs document a typed schema seam 2026-06-10 01:35:04 +02:00
YjsDebugPanel.tsx planner: give the Yjs document a typed schema seam 2026-06-10 01:35:04 +02:00