trails/openspec/changes/archive/2026-04-03-gpx-import-planner/tasks.md
Ullrich Schäfer a9f8ee61f0
Add GPX file import to planner + archive change
Two import entry points:
- Home page: "Import GPX" button next to "Start Planning"
- In-session: drag-and-drop GPX onto the map (with confirmation)

Parses GPX client-side, extracts waypoints (Douglas-Peucker) and
no-go areas from extensions. Non-GPX files show error toast.

Also:
- Fix spec drift: non-GPX drop now shows error toast (was silent)
- Add E2E tests for import button, invalid GPX, and session creation
- Archive gpx-import-planner change, sync specs

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 17:31:44 +01:00

1.6 KiB

1. Home Page Import

  • 1.1 Add "Import GPX" button next to "Start Planning" on the planner home page
  • 1.2 Add hidden file input (accept=".gpx") triggered by the button
  • 1.3 On file select: parse GPX client-side with parseGpxAsync, extract waypoints and no-go areas
  • 1.4 POST extracted data to /api/sessions, redirect to new session with waypoints + no-go areas in URL params
  • 1.5 Show error toast if GPX parsing fails

2. Drag-and-Drop Import

  • 2.1 Add drag-and-drop zone to PlannerMap (listen for dragenter, dragover, drop on map container)
  • 2.2 Show visual overlay when a file is dragged over the map ("Drop GPX file here")
  • 2.3 On drop: validate file extension is .gpx, reject others with error toast
  • 2.4 Parse dropped GPX file client-side
  • 2.5 Show confirmation dialog ("Replace current route with imported GPX?")
  • 2.6 On confirm: replace Yjs waypoints and no-go areas with imported data in a single transaction

3. i18n

  • 3.1 Add translation keys for import UI text (en + de): button label, drop zone text, confirmation dialog, error messages

4. Testing

Unit tests

  • 4.1 Test GPX file parsing and waypoint extraction from File object (mock FileReader)

E2E tests

  • 4.2 Home page import: upload GPX file via file input → session created with waypoints
  • 4.3 Drag-and-drop: drop GPX on map → waypoints replaced (Playwright file drop)
  • 4.4 Invalid file: upload non-GPX → error toast shown, no session created
  • 4.5 Plan round-trip: export plan → reimport via upload → waypoints and no-go areas match