This implementation adds comprehensive workout logging functionality with multiple exercises and sets, inline editing, and autosave capabilities while maintaining the existing RPG-style UI theme.
- ✅ One workout session can contain many exercises (unlimited)
- ✅ Each exercise can contain many sets (unlimited)
- ✅ Each set stores:
- Weight in kg (renamed from
weighttoweight_kg) - Reps (repetitions)
- Weight in kg (renamed from
- ✅ Users can add, edit, and delete:
- Exercises (via "Add Exercise" button and delete icon)
- Individual sets (via "Add Set" button and delete icon)
- ✅ No hard limits, no fixed templates
- ✅ Exercise List: Vertical list of exercises displayed on the main page
- ✅ Add Exercise Button: "+ Add Exercise" button at the bottom of the exercise list
- ✅ Inline Exercise Input: Minimal text input for exercise name (no modal)
- ✅ Set Logging: Each exercise displays its sets in the format:
Set 1 17.5 kg × 12 reps Set 2 20.0 kg × 10 reps - ✅ Add Set: "+ Add Set" button under each exercise
- ✅ Set Auto-increment: Set numbers are automatically incremented
- ✅ All editing is inline, no modals
- ✅ Tap weight/reps to edit values directly
- ✅ Edit exercise name inline
- ✅ Delete individual sets
- ✅ Delete entire exercises
- ✅ Every change autosaves silently to the database
- ✅ No "Save" button required
- ✅ No confirmation popups
- ✅ Subtle "Saving..." indicator shown during updates
Database schema matches requirements:
workout_sessions
- ✅ id (uuid)
- ✅ user_id (uuid)
- ✅ session_date (timestamp)
- ✅ created_at (timestamp)
session_exercises (named per existing schema)
- ✅ id (uuid)
- ✅ session_id (uuid)
- ✅ exercise_name (text)
- ✅ order_index (int)
exercise_sets
- ✅ id (uuid)
- ✅ exercise_id (uuid)
- ✅ set_number (int)
- ✅ weight_kg (numeric) - renamed from
weight - ✅ reps (int)
- ✅ Users can open past sessions from Session History
- ✅ Edit button on each session
- ✅ Full inline editing capabilities
- ✅ Changes update existing records (no duplicates)
- ✅ Maintains existing "Daily Quest" theme
- ✅ Card-based UI with RPG styling
- ✅ Exercises feel like quest objectives
- ✅ Sets feel like quest attempts
- ✅ XP rewards on completion
- ✅ No field renaming in UI
- ✅ Weight must be ≥ 0 (inline validation)
- ✅ Reps must be ≥ 1 (inline validation)
- ✅ Exercise name cannot be empty (inline validation)
- ✅ Validation is text-based and non-blocking
- ✅ No fixed set count
- ✅ No hard-coded exercises
- ✅ No modal forms (replaced with inline component)
- ✅ No "Save Workout" button (autosave)
- ✅ No loss of data on refresh (database-backed)
- InlineWorkoutLogger.tsx: Main component for inline workout logging
- Handles exercise creation and editing
- Manages set creation and editing
- Provides autosave functionality
- Shows subtle loading states
-
WorkoutSessionForm.tsx: Simplified to trigger inline logger
- Shows "Log Workout" button
- Expands to show inline logger when clicked
- No modal dialog
-
SessionHistory.tsx: Enhanced with editing capabilities
- Shows "Edit" button on each session
- Allows inline editing of past workouts
- Maintains session statistics
- useWorkoutSessions.ts: Extended with full CRUD operations
- Added
updateExercisemutation - Added
updateSetmutation - Added
deleteExercisemutation - Added
deleteSetmutation - Removed excessive toast notifications for smoother UX
- Added
- 20260119094000_rename_weight_to_weight_kg.sql: Renames weight column for clarity
- ✅ 20 tests passing (100% pass rate)
- ✅ Build successful
- ✅ No TypeScript errors
- ✅ No security vulnerabilities
Users can log workouts like:
Bench Press
- 17.5 kg × 12 reps
- 20.0 kg × 10 reps
Incline Dumbbell Press
- 12.5 kg × 12 reps
- 15.0 kg × 10 reps
And edit them later with full inline editing capabilities.
- Click "Log Workout" button
- Click "+ Add Exercise"
- Enter exercise name (e.g., "Bench Press")
- Click "Add Exercise"
- First set is automatically created
- Edit weight and reps inline
- Click "+ Add Set" to add more sets
- Repeat for additional exercises
- Click "Complete Workout" to finish
- All changes are automatically saved throughout the process
- Autosave is triggered on every input change (onChange events)
- Loading states prevent race conditions during database operations
- Session is created immediately when logging starts
- Exercise order is maintained via order_index
- Set numbering is automatic and sequential
- All operations respect Row Level Security (RLS) policies
This implementation follows the principle of minimal modifications:
- Reused existing database schema (only added one column rename migration)
- Kept existing hooks structure, just extended with new mutations
- Maintained all existing components and functionality
- No breaking changes to the RPG UI theme
- Compatible with existing test infrastructure