Skip to content

Simplify: apply a batch of safe, behavior-preserving code cleanups - #27

Merged
davd-gzl merged 1 commit into
mainfrom
claude/journal-redesign-spec-kit-ku0l3d
Jul 22, 2026
Merged

davd-gzl merged 1 commit into
mainfrom
claude/journal-redesign-spec-kit-ku0l3d

Conversation

@davd-gzl

Copy link
Copy Markdown
Collaborator

A curated set from an app-wide simplification analysis. Each cleanup was verified behavior-preserving and is guarded by the type-checker + tests — no behavior change.

  • Shared helpers replace copies: stampNow (→ schema/helpers, was duplicated in all three Zustand stores), formatPercentFloor (→ lib/format, was inlined 4× across the stats screens), isOffline (in GuideButton, was repeated 3×).
  • Reuse existing values: MapScreen imports IN_VIEW_CAP from viewport (was a second copy); MapView's trip-arcs reset reuses EMPTY_FC; TripComposer maps over the shared MODE_ORDER instead of its own list.
  • Smaller reads: Backup reuses its hasData flag; SyncSection drops a needless Promise.all([import]) wrapper.
  • Tighter surface: drop export from types used only in their own module (PosterStats, PhotoRef, MapMode, CityStatus).

The analysis surfaced ~45 candidates; this PR takes the unambiguous, low-risk subset. The rest (larger refactors like a shared NearbyList component or a prefetch-pool helper, and a couple of schema-transform dedups) are left for a focused follow-up.


Gate: tsc clean · 459 unit tests · e2e green (smoke, a11y, trip-reconstruction, filter-panel, offline).

🤖 Generated with Claude Code

https://claude.ai/code/session_014W6tgHRgLEugCsbKC9ccST


Generated by Claude Code

A curated set from an app-wide analysis — each verified behavior-preserving and
guarded by the type-checker + tests:

- Shared helpers replace copies: `stampNow` (schema/helpers, was duplicated in all
  three stores), `formatPercentFloor` (lib/format, was inlined 4× across the stats
  screens), `isOffline` (GuideButton, was repeated 3×).
- Reuse existing constants/values: MapScreen imports `IN_VIEW_CAP` from viewport
  (was a second copy); MapView's trip-arcs reset reuses `EMPTY_FC`; TripComposer
  maps over the shared `MODE_ORDER` instead of its own mode list.
- Smaller reads: Backup reuses its `hasData` flag; SyncSection drops a needless
  `Promise.all([import])` wrapper.
- Tighter surface: drop `export` from types only used in their own module
  (PosterStats, PhotoRef, MapMode, CityStatus).

No behavior change. Gate: tsc clean, 459 unit tests, e2e green (smoke, a11y,
trip-reconstruction, filter-panel, offline).
@davd-gzl
davd-gzl merged commit 7a1b115 into main Jul 22, 2026
4 checks passed

This branch was previously deployed

1 inactive deployment
github-pages — f45ae34c Deployed Jul 22, 2026 by davd-gzl via deploy #150
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