Skip to content

Training plan retention: redesign, persistence, progress tracking, mobile layout - #77

Merged
aleexwong merged 4 commits into
mainfrom
claude/training-plan-animation-k057ea
Jul 14, 2026
Merged

Training plan retention: redesign, persistence, progress tracking, mobile layout#77
aleexwong merged 4 commits into
mainfrom
claude/training-plan-animation-k057ea

Conversation

@aleexwong

Copy link
Copy Markdown
Owner

Turns the /plan generator from a one-shot form into a product users return to. Four stacked changes:

1. Runna-level visual redesign (b60a2a4)

  • Dark emerald hero card: goal time as the dominant numeral, race-day countdown, big-number stat tiles, integrated phase timeline
  • Single workout-type + phase color system (utils/planDisplay.ts) shared by the chart, badges, rails, and day cards
  • Week list grouped by phase with colored rails; expanded weeks show rich day cards only (removed the duplicated text list)
  • Pace chips became zone cards on the pace-ladder ramp; form got filled selected states and a CTA that explains itself

2. Draft persistence + sign-in handoff (1ebfeff)

  • Generated plan + form inputs persist to localStorage (trainpace_plan_draft / trainpace_plan_inputs); restored on mount, stale drafts (past race date) self-clean, private-mode safe
  • "Sign in to save" now links to /login?returnTo=/plan with a pending-save flag; on return the restored plan auto-saves once — previously the banner destroyed the plan the user was trying to save

3. Workout completion tracking (5bdd63d)

  • completedWorkouts map on the plan doc ("week:Day" → ISO timestamp), toggled via dot-path updates so devices merge instead of clobbering; no Firestore rules change needed (owner update already allowed)
  • Shared calendar math in utils/planSchedule.ts; PlanCalendar now agrees with the iCal export on week boundaries (fixes a latent current-week discrepancy)
  • usePlanProgress: optimistic toggles with per-key rollback; guest progress lives in localStorage and merges into the doc at save time (including through the auto-save handoff)
  • Done-toggles on day cards, n/m + progress bars on week rows / hero / dashboard cards, and a ThisWeekCard (next run up, real dates, before-start and post-race states) on /plan and the dashboard

4. Mobile de-scroll (cbe3455)

  • Sticky This Week / Schedule / Stats segments; This Week is the default for in-progress plans
  • Hero slimmed; volume chart + pace zones + phase details moved to Stats
  • Compact week rows on mobile (82px → 55px); Schedule auto-scrolls to the current week once per visit (respects prefers-reduced-motion)
  • Default mobile view: ~2561px tall vs ~5000px before (~49% reduction)

Verification

  • npm run build (tsc + full prerender) and npm run lint pass at every commit; no new warnings
  • Playwright against the dev server: guest persistence flows (generate → reload → restored; start-over keeps inputs; stale/corrupt drafts handled), completion flows (tick → n/m + hero update → reload persists → un-tick decrements), segment behavior, and 390px layout checks (no clipped/orphaned/truncated text)
  • Firebase-authenticated paths (auto-save, Firestore toggles) verified by code review + typecheck; worth a quick manual pass on a real login after deploy

Product defaults chosen (easy to flip): missed past runs render neutral (not red), future runs are tickable, race day is tickable as the capstone. The optional firestore.rules hardening (pinning userId on update) was deliberately left out — happy to follow up separately since rules deploys deserve their own review.

🤖 Generated with Claude Code

https://claude.ai/code/session_011gQkB7Td39HRHSY7Z7oL9Z


Generated by Claude Code

claude added 4 commits July 13, 2026 06:17
The generated plan view read like a gray settings form. Reworks the
/plan presentation layer only (plan-math untouched):

- Dark emerald hero card: goal time as the dominant numeral, race-day
  countdown, big-number stat tiles, integrated phase timeline with a
  mobile legend instead of clipped labels
- Single workout-type + phase color system (utils/planDisplay.ts) used
  across the volume chart, badges, rails, and day cards
- Week list grouped by phase with colored rails; week 1 auto-expands;
  expanded weeks show rich day cards only (removed duplicated text list)
- Pace chips become zone cards on the pace-ladder color ramp
- Form polish: filled selected states, live-feeling CTA with helper copy
- Mobile pass at 390px: no clipped, orphaned, or mid-word truncated text

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011gQkB7Td39HRHSY7Z7oL9Z
Guests lost a generated plan on refresh, and the 'Sign in to save'
banner navigated away and destroyed the plan they wanted to save.

- Persist the generated plan + form inputs to localStorage
  (trainpace_plan_draft / trainpace_plan_inputs); restore on mount,
  discard drafts whose race date has passed, survive private mode
- Start over clears the draft plan but keeps inputs as form prefill
- Sign-in banner now links to /login?returnTo=/plan and sets a
  pending-save flag; on return, the restored plan auto-saves once
  and the draft is cleared on success

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011gQkB7Td39HRHSY7Z7oL9Z
Saved plans were static documents with no reason to return. Adds
per-workout done-tracking and a daily-return surface:

- completedWorkouts map on the plan doc ('week:Day' -> ISO timestamp),
  toggled via dot-path updates so devices merge instead of clobbering
- Shared calendar math in utils/planSchedule.ts (week dates, current
  week, next run up, active plan selection); PlanCalendar now agrees
  with the iCal export on week boundaries
- usePlanProgress hook: optimistic toggles with per-key rollback,
  guest progress in localStorage, merged into the doc on save
- Done-toggles on day cards, n/m runs + progress bars on week rows,
  hero, and dashboard plan cards
- ThisWeekCard on /plan and dashboard: current week at a glance with
  the next run highlighted, before-start and post-race states

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011gQkB7Td39HRHSY7Z7oL9Z
The generated plan stacked hero, chart, paces, this-week, and 14 week
rows into one ~5000px mobile column. Restructures the layout:

- Sticky This Week / Schedule / Stats segments; This Week is the
  default for in-progress plans (Schedule before the plan starts)
- Hero slimmed to race, goal, countdown, stats, and phase bar; volume
  chart, pace zones, and phase details move to the Stats segment
- Compact collapsed week rows on mobile (82px -> 55px)
- Schedule auto-scrolls the current week into view once per visit,
  honoring prefers-reduced-motion

This Week segment now measures ~2561px on a 390px viewport, down ~49%.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011gQkB7Td39HRHSY7Z7oL9Z
@netlify

netlify Bot commented Jul 13, 2026

Copy link
Copy Markdown

Deploy Preview for trainpace ready!

Name Link
🔨 Latest commit cbe3455
🔍 Latest deploy log https://app.netlify.com/projects/trainpace/deploys/6a549a793d59c500080e3f51
😎 Deploy Preview https://deploy-preview-77--trainpace.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 57
Accessibility: 89
Best Practices: 100
SEO: 100
PWA: 60
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

@vercel

vercel Bot commented Jul 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
trainpace Ready Ready Preview, Comment Jul 13, 2026 7:57am

@codacy-production

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 37 high · 30 medium · 1 minor

Alerts:
⚠ 68 issues (≤ 0 issues of at least minor severity)

Results:
68 new issues

Category Results
UnusedCode 8 medium
ErrorProne 10 medium
27 high
Security 10 high
CodeStyle 1 minor
Complexity 12 medium

View in Codacy

🟢 Metrics 241 complexity · 4 duplication

Metric Results
Complexity 241
Duplication 4

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@aleexwong
aleexwong merged commit 32912f4 into main Jul 14, 2026
8 of 9 checks passed
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.

2 participants