Skip to content

Share race & session results#26

Merged
burkben merged 1 commit into
mainfrom
burkben/share-results
Jun 20, 2026
Merged

Share race & session results#26
burkben merged 1 commit into
mainfrom
burkben/share-results

Conversation

@burkben

@burkben burkben commented Jun 20, 2026

Copy link
Copy Markdown
Owner

What & why

Phase 5 "share results." Race nights are social — this lets you fling a clean recap to Messages / Notes / AirDrop straight from the app. A Share button now lives on:

  • the finished-race view (race.tsx) — a celebratory recap with splits + lap-by-lap, and
  • a History session detail (history/[id].tsx) — a session summary with the fastest passes.

Both hand plain text to the OS share sheet via React Native's built-in Share API — no new native module, so nothing to miss in a dev build (unlike the ExpoSQLite gotcha).

How

  • New pure module apps/mobile/src/share/summary.ts (+13 tests):
    • raceShareText(result, { carName })🏁 player finished N laps in T, best/avg/worst splits, and a numbered lap list with the fastest lap flagged ⚡.
    • sessionShareText(session, passes, { display, carNames, topN }) — date, pass count, duration, best, and the top-N fastest passes.
    • formatLapTime mirrors race.tsx's on-screen clock; speeds run through the same speed/format converter as every readout, so a shared number honors the user's unit + calibration exactly.
  • race.tsx — "Share result" button resolves the car's garage nickname, honors the haptics setting.
  • history/[id].tsx — header "Share" action (shown once a session has passes), passing the live speed display + a car-nickname map.

Example race share:

🏁 Ben finished 3 laps in 7.40s
Car: Twin Mill

Best lap 2.10s (lap 2)
Average 2.47s
Worst lap 2.80s (lap 3)

Laps:
  1. 2.50s
  2. 2.10s ⚡
  3. 2.80s

via RedlineID

Tests / gates

  • 178 vitest pass (+13 share). tsc --noEmit clean · expo export --platform ios clean.

Notes

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Adds Phase 5 "share results": a Share button on the finished-race view and
on a History session detail, each handing a clean text recap to the OS share
sheet (Messages, Notes, AirDrop, etc.).

- New pure apps/mobile/src/share/summary.ts (+13 tests): raceShareText (total
  time, best/avg/worst splits, lap-by-lap with the fastest lap flagged) and
  sessionShareText (date, pass count, duration, best, fastest passes). Speeds
  run through the same speed/format converter as every readout, so shared
  numbers honor the user's unit + calibration; lap times mirror race.tsx.
- race.tsx Results: "Share result" button (RN Share API), resolving the car's
  garage nickname; honors the haptics setting.
- history/[id].tsx: header "Share" action (shown once a session has passes),
  passing the current speed display + car nickname map.
- Uses React Native's built-in Share — no new native module.

Also refreshed stale ROADMAP Phase 5 checkboxes (Achievements #23, speed
units #25, this as #26).

178 vitest pass; tsc --noEmit clean; iOS export clean.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@burkben burkben changed the title Share race & session results Share race &amp; session results Jun 20, 2026
@burkben burkben merged commit b402900 into main Jun 20, 2026
1 check passed
@burkben burkben deleted the burkben/share-results branch June 20, 2026 01:12
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