Fix: program workout shortcut now appears under Workout category

Two bugs fixed:

1. Backend: list_programs endpoint did not include catalog_id in its
   response, so the frontend filter (p.catalog_id) always matched zero
   programs. The previous LogActivity card never rendered because
   loadActiveProgram() found no active program with a catalog link.
   Now also exposes current_week.

2. UX restructure: instead of showing the program workout card at the
   top of /log unconditionally, the card now appears AFTER the user
   selects the 'Workout' category — matching the natural flow:
   Log -> Workout -> see today's program workout option.

   The Workout category now reveals:
   - Active program banner (clickable, shows program name + week,
     navigates to ProgramDetail on tap)
   - Today's workout card with exercise preview and one-tap 75 pts
   - Other uncompleted workouts in the current week (up to 3)
   - 'Or log freeform' divider before the existing form

   When all workouts in the current week are done, a green completion
   banner appears instead.

Refactored the workout card into a ProgramWorkoutCard component since
it's now used for both today's featured workout and weekly upcoming.
This commit is contained in:
claude 2026-04-09 16:13:47 +00:00
parent 42797b5462
commit 9a306bc250
2 changed files with 154 additions and 79 deletions

View file

@ -44,6 +44,8 @@ async def list_programs(
"id": str(p.id), "name": p.name, "source": p.source, "source_url": p.source_url,
"start_date": p.start_date.isoformat(), "end_date": p.end_date.isoformat(),
"status": p.status, "current_day": min(day_num, total), "total_days": total,
"catalog_id": str(p.catalog_id) if p.catalog_id else None,
"current_week": p.current_week,
})
return out