Skip to content

feat(#59): add weekly training planner view#122

Closed
ChristopherRotnes wants to merge 7 commits into
masterfrom
claude/test-supabase-connector-t8ATa
Closed

feat(#59): add weekly training planner view#122
ChristopherRotnes wants to merge 7 commits into
masterfrom
claude/test-supabase-connector-t8ATa

Conversation

@ChristopherRotnes
Copy link
Copy Markdown
Owner

@ChristopherRotnes ChristopherRotnes commented May 5, 2026

Summary

Changes

Supabase migration

  • week_plans — one row per user per ISO week, RLS enforced
  • week_plan_days — one row per day slot, cascades on plan delete, RLS via parent join

utils.js

  • toWeekIso(date)Date → "2026-W19", handles ISO week year-rollover edge cases
  • weekIsoToMonday(weekIso)"2026-W19" → Monday Date

db.js

  • fetchWeekPlan(weekIso) — fetches plan + days with joined template data
  • saveWeekPlan(weekIso, assignments) — upserts plan row, delete + reinserts days
  • deleteWeekPlan(weekIso) — deletes plan row (cascade removes days)

Planlegger.jsx (new component)

  • Week navigation (ChevronLeft/ChevronRight) with UKE N · D–D MÅNED label
  • HeatmapBodySVG projected coverage map, updates live as templates are assigned
  • Forslag card surfaces when ≥2 muscle groups are uncovered, lists up to 3 matching templates
  • 7-day row list — assigned rows show template name + muscle AccentChips + remove button; empty rows show dashed + Legg til økt
  • Bottom-sheet template picker overlay, closes on Escape or backdrop click
  • Sticky CTA: Fjern uke (ghost, only when a saved plan exists) + Lagre plan (primary)
  • Confirm-delete strip before deletion executes
  • Mobile: Front/Bak toggle on body map

App.jsxPlanlegger import, onShowPlanlegger in NavContext, "planlegger" view branch

PageShell.jsxEventSchedule Carbon icon nav button (between Bibliotek and theme toggle)

Verification steps

  1. SQL migration ran; RLS blocks cross-user access
  2. EventSchedule calendar icon in nav → navigates to Planlegger, shows current week
  3. ChevronLeft/ChevronRight update week label and reload plan correctly
  4. Assign a template to a day → HeatmapBodySVG updates live
  5. ≥2 muscle groups uncovered → Forslag card appears; cover them all → card disappears
  6. Lagre plan → rows persisted in Supabase; reload page → plan loads back
  7. Fjern uke → confirm strip appears → confirm → week_plans row deleted (cascade removes days)
  8. Mobile: Front/Bak toggle works, bottom-sheet template picker opens and closes
  9. Unit tests for toWeekIso / weekIsoToMonday at year rollover (29 Dec → W01 next year)

Out of scope

  • Drag-and-drop day reordering
  • Multi-week arc / program builder
  • Converting a saved plan into a logged session directly from this view

https://claude.ai/code/session_01XVey99eDCo79X8b6fNQuKP

claude added 2 commits May 5, 2026 12:58
New Planlegger view lets the user assign session templates to days of the
current week and see the projected muscle coverage on a live heatmap body map.

- Supabase migration: week_plans + week_plan_days tables with RLS policies
- db.js: fetchWeekPlan, saveWeekPlan, deleteWeekPlan
- utils.js: toWeekIso, weekIsoToMonday helpers
- Planlegger.jsx: full component (week nav, HeatmapBodySVG, 7-day plan list,
  bottom-sheet template picker, Forslag card, sticky save/delete CTA)
- App.jsx: planlegger view branch + onShowPlanlegger in NavContext
- PageShell.jsx: EventSchedule nav icon linking to planner

https://claude.ai/code/session_01XVey99eDCo79X8b6fNQuKP
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

Azure Static Web Apps: Your stage site is ready! Visit it here: https://white-island-090dfd003-122.westeurope.7.azurestaticapps.net

Adding EventSchedule pushed the last icon(s) off-screen on narrow viewports.
7 × 40px = 280px fits alongside the logo on a 390px iPhone.

https://claude.ai/code/session_01XVey99eDCo79X8b6fNQuKP
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

Azure Static Web Apps: Your stage site is ready! Visit it here: https://white-island-090dfd003-122.westeurope.7.azurestaticapps.net

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.

As a user I want to plan my training week upfront so I can see projected muscle coverage before I start

2 participants