Skip to content

Route the Map Journal through useRegionInstall and share the download progress UI #154

Description

@cursor

Spec: Fowler-style refactoring review (cloud agent, 2026-08-05). Refactor only — no behavior change.

Blocked by: #148

What to change

components/map-journal.tsx (618 lines) reimplements machinery that already exists:

  1. Region install FSMMapJournal (~197–258, ~391–413) and components/region-tracer.tsx (~162–228) each inline the createRegionStoreinstalled/manifest/install flow that lib/offline-region/use-region-install.ts already provides (used only by OfflineMapsPage today). Extend the hook with the options they need (e.g. autoInstall, remote-preview) and route both through it.
  2. Download progress UI ×2 — the trail-map-hero-progress block is duplicated between map-journal.tsx (~464–485) and components/offline-maps-page.tsx (~60–76). Extract a RegionDownloadProgress component.
  3. Split the rest — extract useJournalMap (MapLibre mount, markers, GPS) and a JournalCaptureSheet component for the aside, leaving MapJournal as a shell. Use useOnline from the blocking ticket for the connectivity listener (~380–389).

Out of scope: map styling, offline pack format, RegionTracer's Playwright window hooks (keep the test seams).

Acceptance criteria

  • MapJournal and RegionTracer consume useRegionInstall; no inline region-install FSM remains
  • One RegionDownloadProgress component serves both surfaces
  • mise run lint and mise run test pass (tests/outdoor-capture.spec.ts and offline-region specs unchanged)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions