Workout Wizard
The Workout Wizard is a comprehensive 9-step questionnaire that collects user preferences and generates personalized workout and meal plans. Built with Zustand for state management and persisted to localStorage.Overview
The wizard guides users through a progressive series of steps to build a complete fitness profile:Architecture
Wizard Store (State Management)
The wizard uses Zustand with persistence middleware to maintain state across page refreshes.Key Types
User Body Data
Step 6 collects physical metrics for calorie calculations using the Harris-Benedict formula:Calorie Calculation
The wizard calculates BMR (Basal Metabolic Rate), TDEE (Total Daily Energy Expenditure), and target calories:Step Components
Step 1: Training Level
Step 2: Training Goal
Step 6: Body Data with Calorie Display
Validation & Navigation
The wizard includes validation logic to ensure users can only proceed when required data is provided:Container Component
The wizard container manages step rendering and progress display:Data Persistence
All wizard state is automatically persisted to localStorage using Zustand’s persist middleware:Usage Example
Testing
The wizard includes comprehensive unit tests:See Also
- Meal Planning - How meal plans are generated from wizard data
- Subscription System - How wizard data is saved to Supabase
- Authentication - User authentication before using the wizard