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:
- Region install FSM —
MapJournal (~197–258, ~391–413) and components/region-tracer.tsx (~162–228) each inline the createRegionStore → installed/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.
- 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.
- 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
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:MapJournal(~197–258, ~391–413) andcomponents/region-tracer.tsx(~162–228) each inline thecreateRegionStore→installed/manifest/installflow thatlib/offline-region/use-region-install.tsalready provides (used only byOfflineMapsPagetoday). Extend the hook with the options they need (e.g.autoInstall, remote-preview) and route both through it.trail-map-hero-progressblock is duplicated betweenmap-journal.tsx(~464–485) andcomponents/offline-maps-page.tsx(~60–76). Extract aRegionDownloadProgresscomponent.useJournalMap(MapLibre mount, markers, GPS) and aJournalCaptureSheetcomponent for the aside, leavingMapJournalas a shell. UseuseOnlinefrom 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
MapJournalandRegionTracerconsumeuseRegionInstall; no inline region-install FSM remainsRegionDownloadProgresscomponent serves both surfacesmise run lintandmise run testpass (tests/outdoor-capture.spec.tsand offline-region specs unchanged)