Skip to content

Phone app: the day's map with its route - #12

Merged
Torgh merged 2 commits into
mainfrom
mobile-map
Oct 18, 2026
Merged

Torgh merged 2 commits into
mainfrom
mobile-map

Conversation

@Torgh

@Torgh Torgh commented Oct 18, 2026 •

Copy link
Copy Markdown
Owner

Summary

Stage 1 of maps in the phone app: each day shows its map and route, like the desktop board.

Layout and UX

  • A map band (about 35% of the screen) sits above the day's plan. It stays put and only the list scrolls, so dragging the map never fights the page.
  • ▴ Hide map collapses it to its bar; the choice is remembered. ⛶ Full screen opens it over everything; Android back closes full screen first.
  • Pins and cards are linked: tapping a pin scrolls to its card and highlights it; tapping a card brings its pin into view.
  • In full screen, a tapped pin shows what it is at the bottom (a tour stop shows its own name with the tour underneath), with the time and Show in plan ›.
  • Same pins as the desktop: day colours, numbers, 🏨, small 1.1/1.2 pins for tour stops, dashed or routed lines.

Under the hood

  • lib/mapLayers.ts: pins, lines and tour stops moved out of components/TripMap.tsx and shared by desktop and phone (with tests). The day colours moved there too.
  • mobile/src/MapView.tsx: MapLibre + OpenFreeMap tiles (no API key), dark style in dark mode. Route shapes come from the trip file, so they need no network.
  • Offline: if the tile server can't be reached (or there's no network), the map switches to a plain background. Pins and routes stay readable.
  • MapLibre (~800 KB) is lazy-loaded when a trip opens, so the trip list still starts instantly.
  • Fix (desktop and phone): the morning's hotel pin is left out when a card sits at the same spot, where it hid a tour's pick-up pin.

Not yet (stage 2): downloading the map tiles of the trip's area for offline use.

Test plan

  • bun run typecheck, eslint (repo, minus build outputs), bun run test:coverage (194 tests), bun run build, bun run build:mobile
  • On the Android emulator with the Mexico trip: day map, hide/show, full screen, tapping a tour stop (centres on it, names it), Show in plan (scrolls to and highlights the card), pick-up pin no longer hidden by the hotel
  • Offline fallback: the emulator can't reach the tile server here (antivirus HTTPS scanning), and the map fell back to pins and routes on a plain background
  • Map tiles on a real phone with normal internet

🤖 Generated with Claude Code

A map band sits above the day's plan and stays put while the list scrolls, so
dragging the map never fights the page. It can be hidden (remembered) or opened
full screen; Android back closes full screen first. Tapping a pin scrolls to
its card; tapping a card brings its pin into view. In full screen a tapped pin
shows what it is (a tour stop names itself and its tour) with a way back to
the plan.

Pins, route lines and tour stops come from lib/mapLayers.ts, now shared with
the desktop map, so both draw the same thing. Route shapes are read from the
trip file; without network the map falls back to a plain background, keeping
pins and routes readable offline. MapLibre loads only once a trip is opened.

The morning's hotel pin is left out when a card sits at the same spot (a tour
picking you up at the hotel), where it hid that card's numbered pin.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The phone map now draws Google's tiles (Map Tiles API) when the APK is built
with NEXT_PUBLIC_GOOGLE_MAPS_API_KEY in .env.local, the desktop app's browser
key. Without it, or when Google can't be reached, it falls back to OpenFreeMap,
and offline to the plain background with pins and routes.

The Map Tiles session is reused for its lifetime, dark mode gets a dark Google
look, and the map shows Google's logo with the copyright for the area in view.
Only that one variable is exposed to the build; the source never contains a
key. README and .env.example say the key ends up inside such an APK, so it
should not be shared.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@Torgh
Torgh merged commit ad775c8 into main Oct 18, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant