trails/openspec/changes/journal-route-previews/tasks.md
Ullrich Schäfer 6aac8bd885
Add map previews to journal route and activity pages
- Route/activity list pages: map thumbnails with route drawn on OSM tiles
- Route/activity detail pages: interactive Leaflet map with zoom controls
- Server: expose GeoJSON from PostGIS via ST_AsGeoJSON (simplified for lists)
- RouteMapThumbnail component: shared, supports thumbnail and interactive modes
- Placeholder shown for routes/activities without geometry
- Archive journal-route-previews change, sync specs

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 09:42:07 +01:00

1.5 KiB

1. Server — Expose GeoJSON

  • 1.1 Add geojsonFromGeom() helper using ST_AsGeoJSON(geom) to convert PostGIS geometry to GeoJSON string
  • 1.2 Update listRoutes() to return simplified GeoJSON per route via ST_AsGeoJSON(ST_Simplify(geom, 0.001))
  • 1.3 Update getRoute() to return full-resolution GeoJSON
  • 1.4 Update listActivities() to return simplified GeoJSON per activity
  • 1.5 Update getActivity() to return full-resolution GeoJSON

2. Route List Page — Map Thumbnails

  • 2.1 Create RouteMapThumbnail component: small MapView + RouteLayer, no controls, auto-fit bounds
  • 2.2 Add thumbnail to each route card in routes._index.tsx (lazy-loaded via Suspense)
  • 2.3 Show placeholder when route has no geometry

3. Activity List Page — Map Thumbnails

  • 3.1 Add thumbnail to each activity card in activities._index.tsx (reuse RouteMapThumbnail)
  • 3.2 Show placeholder when activity has no geometry

4. Route Detail Page — Interactive Map

  • 4.1 Add full-width MapView + RouteLayer to routes.$id.tsx, auto-fit bounds
  • 4.2 Skip map section when route has no geometry

5. Activity Detail Page — Interactive Map

  • 5.1 Add full-width MapView + RouteLayer to activities.$id.tsx, auto-fit bounds
  • 5.2 Skip map section when activity has no geometry

6. i18n

  • 6.1 Add translation keys for map placeholder text (en + de)

7. Testing

  • 7.1 E2E: route detail page shows map when route has geometry
  • 7.2 E2E: route list page renders without errors