COMPLETED TASKS:
✅ 06-01: Workout Swap System
- Added swapped_from_id to workout_logs
- Created workout_swaps table for history
- POST /api/workouts/:id/swap endpoint
- GET /api/workouts/available endpoint
- Reversible swaps with audit trail
✅ 06-02: Muscle Group Recovery Tracking
- Created muscle_group_recovery table
- Implemented calculateRecoveryScore() function
- GET /api/recovery/muscle-groups endpoint
- GET /api/recovery/most-recovered endpoint
- Auto-tracking on workout log completion
✅ 06-03: Smart Workout Recommendations
- GET /api/recommendations/smart-workout endpoint
- 7-day workout analysis algorithm
- Recovery-based filtering (>30% threshold)
- Top 3 recommendations with context
- Context-aware reasoning messages
DATABASE CHANGES:
- Added 4 new tables: muscle_group_recovery, workout_swaps, custom_workouts, custom_workout_exercises
- Extended workout_logs with: swapped_from_id, source_type, custom_workout_id, custom_workout_exercise_id
- Created 7 new indexes for performance
IMPLEMENTATION:
- Recovery service with 4 core functions
- 2 new route handlers (recovery, smartRecommendations)
- Updated workouts router with swap endpoints
- Integrated recovery tracking into POST /api/logs
- Full error handling and logging
TESTING:
- Test file created: /backend/test/phase-06-tests.js
- Ready for E2E and staging validation
STATUS: Ready for frontend integration and production review
Branch: feature/06-phase-06
- Enhanced exaSearch service with Exa API + fallback tier system
* Tier 1: Exa API (primary)
* Tier 2: Synthetic results with suggested web sources
* Improved error handling with graceful degradation
- Updated backend exerciseResearch route to return provider info
* Returns 'provider' field identifying which API was used
* Returns 'status' field (success/degraded) for UI feedback
* Better error messages for debugging
- Enhanced ResearchDisplay component with fallback feedback
* New ResearchProviderBadge shows which provider was used
* Visual indicators for fallback results (Suggested badge)
* Support for multiple provider types (exa, fallback, gemini, etc.)
* Improved error handling and recovery flows
- Updated ExerciseResearchPanel with better error handling
* Proper response parsing from backend
* Forwards provider and status info to display component
* Improved accessibility with tooltip hints
- Added comprehensive Research Display styling
* Responsive layout for mobile and desktop
* Visual hierarchy for summaries and sources
* Provider badge styling with color-coding
* Fallback state indicators for user awareness
- ExerciseResearchPanel: add ProviderBadge component showing which AI
tier (Ollama/Gemini/OpenRouter/OpenCode/Exa) served the response
- Add auto-retry on 429/503 with 2s delay and retry counter in button
- Normalize error messages for common failure modes (network, rate-limit)
- ResearchDisplay: pass onRetry prop to error state for inline retry button
- CSS: .research-panel-controls flex row, .provider-badge with per-provider
colour coding, .rd-error-actions + .rd-retry button styles
- Add ResearchDisplay.jsx: pure presentational component for research
data with loading skeleton, accessible error state, and source cards
- Refactor ExerciseResearchPanel to delegate rendering to ResearchDisplay
(separates fetch/state logic from display)
- Add ExerciseEncyclopediaPage.css: full dark-theme stylesheet using
CSS variables (--bg-*, --text-*, --accent, --border, --radius-*)
replacing the light-theme WorkoutEditPage.css import
- Update ExerciseEncyclopediaPage.jsx: new semantic class names,
keyboard-accessible card toggle (Enter key + role=button + aria-expanded)
- Mobile-responsive at 600px breakpoint
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add ExerciseResearchPanel component with Get Research button, loading state, summary display, and source links
- Add ExerciseEncyclopediaPage with exercise list and integrated research panel
- Wire encyclopedia view into App.jsx navigation
- Add encyclopedia nav button to Dashboard
- Add CSS for research panel and encyclopedia search
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Replace fixed setInputs object with setList array state
- Add showAddModal state and set-type chooser modal (Vanligt set / Dropset)
- handleAddNormal: append one set pre-filled from last row's weight and reps
- handleAddDropset: append 3 sets at 100%/80%/60% weight (rounded to 2.5kg), 10 reps
- handleDeleteSet: remove by index with last-set guard (no delete when only 1 remains)
- handleComplete and handleInputChange updated to use array index (idx+1 as set_number)
- Progress badge and all-done class use setList.length instead of exercise.sets
- onDeleteSet prop added (optional stub for backend wiring in plan 02)
- Add trash icon SVG to Icons.jsx (outline trash can, consistent with icon library)
TODO: Comprehensive design plan for fitness app feel
- Dark theme color palette
- Professional typography guidelines
- SVG icons to replace ALL emojis
- UI component standards
- Inspiration from Nike/FITBOD/Strong
Partial work from Claude Code:
- Icons.jsx component (SVG icons)
- Dashboard.jsx updates (some emoji removal)