trails/openspec/changes/activity-stats/proposal.md
Ullrich Schäfer 26b59b9c95
openspec: propose journal route/activity detail catch-up changes
Three OpenSpec proposals to bring the journal's route/activity detail and feed
closer to best-in-class outdoor apps, in the order we'll implement them:

- activity-sport-type: nullable sport enum on activities (hike/walk/run/
  ride/gravel/mtb/ski/other), set on create or normalized on import,
  shown as a badge + feed verb, federated as a Note PropertyValue.
- activity-stats: one reusable StatRow + canonical metric set, sport-aware
  avg pace/speed, moving-vs-elapsed time. Derive-only, no schema change.
- journal-elevation-profile: elevation profile chart + chart<->map
  "active distance" hover/click sync on the read-only detail pages.

All three validate with `openspec validate --strict`. Specs only; no code.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-12 13:56:24 +02:00

49 lines
2.4 KiB
Markdown

## Why
Distance, duration, and elevation are rendered ad-hoc and inconsistently across
the feed card, the activity/route detail page, and the profile list — different
spacing, different label casing, and a different subset of metrics on each
surface. Komoot and Strava both lead with one crisp, repeated metric row. We
also discard derivable headline numbers: **average pace/speed** (we have
distance + duration) and **moving vs. elapsed time**. A single reusable stat
component plus those derived metrics makes every surface scannable and is a
natural piece of the launch-blocking visual redesign.
## What Changes
- Introduce one reusable `StatRow` presentation component (value + localized
label + unit), used identically on the feed card, the activity & route detail
pages, and the profile activity list.
- Define the canonical headline metric set and render it consistently:
distance, time, average pace **or** speed, ascent, descent.
- Derive **average pace or speed** and choose the right one per sport (pace for
foot sports, speed for wheeled/ski), degrading to speed when sport is unset.
- Show **moving time** alongside **elapsed time** when moving time can be
derived from GPX trackpoint timestamps; otherwise show elapsed only.
- Localized number/unit formatting via i18n.
## Capabilities
### New Capabilities
- `activity-stats`: the canonical headline-metric set, the derived metrics
(average pace/speed, moving vs. elapsed time), and the reusable stat-row
presentation used across the feed, detail, and profile surfaces.
### Modified Capabilities
<!-- None at the requirement level. The feed (`activity-feed`) and profile
(`public-profiles`) specs describe aggregation/listing, not the metric set;
the shared presentation is a new capability they consume. -->
## Impact
- **Journal app**: a new shared `StatRow` (and a small `formatStat`/derivation
helper); the feed, activity-detail, route-detail, and profile views adopt it;
their loaders expose the fields needed to derive the metrics (already mostly
present: distance, duration, startedAt, elevation, plus `gpx` for moving
time).
- **i18n**: `journal.stats.*` keys (en + de) for labels and units.
- **Builds on** `activity-sport-type` for the pace-vs-speed choice (graceful
fallback if that change is not yet merged).
- No schema or wire-contract change; metrics are derived from existing fields.