Implement Phase 3: Optional advanced features for setup wizard
This commit implements two optional steps that allow users to configure
advanced features during the bakery setup process. Both steps can be
skipped without blocking wizard completion.
## Implemented Steps
### 1. Quality Setup Step (QualitySetupStep.tsx)
- Quality check template creation with full API integration
- 6 check types: Visual, Measurement, Temperature, Weight, Timing, Checklist
- Multi-select applicable stages (mixing, proofing, shaping, baking, etc.)
- Optional description field
- Required/Critical flags with visual indicators
- Minimum requirement: 2 quality checks (skippable)
- Grid-based type and stage selection with icons
- Integration with useQualityTemplates and useCreateQualityTemplate hooks
### 2. Team Setup Step (TeamSetupStep.tsx)
- Team member collection form (local state management)
- Required fields: Name, Email
- Role selection: Admin, Manager, Baker, Cashier
- Grid-based role selection with icons and descriptions
- Email validation and duplicate prevention
- Team member list with avatar icons
- Remove functionality
- Fully optional (always canContinue = true)
- Info note about future invitation emails
- Skip messaging for solo operators
## Key Features
### Quality Setup Step:
- ✅ Full backend integration with quality templates API
- ✅ Visual icon-based check type selection
- ✅ Multi-select stage chips (toggle on/off)
- ✅ Required/Critical badges on template list
- ✅ Form validation (name, at least one stage)
- ✅ Optional badge prominently displayed
- ✅ Progress tracking with "Need X more" messaging
### Team Setup Step:
- ✅ Local state management (ready for future API)
- ✅ Email validation with duplicate checking
- ✅ Visual role cards with icons and descriptions
- ✅ Team member list with role badges and avatars
- ✅ Remove button for each member
- ✅ Info note about invitation emails
- ✅ Skip messaging for working alone
- ✅ Always allows continuation (truly optional)
## Shared Features Across Both Steps:
- ✅ "Optional" badge with explanatory text
- ✅ "Why This Matters" information section
- ✅ Inline forms (not modals)
- ✅ Real-time validation with error messages
- ✅ Parent notification via onUpdate callback
- ✅ Responsive mobile-first design
- ✅ i18n support with translation keys
- ✅ Loading states
- ✅ Consistent UI patterns with Phase 2 steps
## Technical Implementation
### Quality Setup:
- Integration with qualityTemplateService
- useQualityTemplates hook for fetching templates
- useCreateQualityTemplate mutation hook
- ProcessStage and QualityCheckType enums from API types
- User ID from auth store for created_by field
- Template list with badge indicators
### Team Setup:
- Local TeamMember interface
- useState for team members array
- Email regex validation
- Duplicate email detection
- Role options with metadata (icon, label, description)
- Ready for future team invitation API integration
## Files Modified:
- frontend/src/components/domain/setup-wizard/steps/QualitySetupStep.tsx (406 lines)
- frontend/src/components/domain/setup-wizard/steps/TeamSetupStep.tsx (316 lines)
Total: **722 lines of new functional code**
## Related:
- Builds on Phase 1 (foundation) and Phase 2 (core steps)
- Integrates with quality templates service
- Prepared for future team invitation service
- Follows design specification in docs/wizard-flow-specification.md
- Addresses JTBD findings about quality and team management
## Next Steps (Phase 4+):
- Smart features (auto-suggestions, smart defaults)
- Polish & animations
- Comprehensive testing
- Template systems enhancement
- Bulk import functionality
2025-11-06 11:31:58 +00:00
import React , { useState , useEffect } from 'react' ;
Implement Phase 1: Setup Wizard Foundation (Foundation & Architecture)
Created complete foundation for the bakery operations setup wizard that guides
users through post-onboarding configuration of suppliers, inventory, recipes,
quality standards, and team members.
**Core Components Created:**
1. SetupWizard.tsx - Main wizard orchestrator
- 7-step configuration (Welcome → Suppliers → Inventory → Recipes → Quality → Team → Completion)
- Weighted progress tracking (complex steps count more)
- Step state management with backend synchronization
- Auto-save and resume functionality
- Skip logic for optional steps
2. StepProgress.tsx - Progress visualization
- Responsive progress bar with weighted calculation
- Desktop: Full step indicators with descriptions
- Mobile: Horizontal scrolling step indicators
- Visual completion status (checkmarks for completed steps)
- Shows optional vs required steps
3. StepNavigation.tsx - Navigation controls
- Back/Skip/Continue buttons with smart enabling
- Conditional skip button (only for optional steps)
- Loading states during saves
- Contextual button text based on step
4. Placeholder Step Components (7 steps):
- WelcomeStep: Introduction with feature preview
- SuppliersSetupStep: Placeholder for Phase 2
- InventorySetupStep: Placeholder for Phase 2
- RecipesSetupStep: Placeholder for Phase 2
- QualitySetupStep: Placeholder for Phase 3
- TeamSetupStep: Placeholder for Phase 3
- CompletionStep: Success celebration
**Routing & Integration:**
- Added /app/setup route to routes.config.ts and AppRouter.tsx
- Created SetupPage wrapper component
- Integrated with OnboardingWizard CompletionStep
- Added "One More Thing" CTA after onboarding
- Choice: "Configurar Ahora (15 min)" or "Lo haré después"
- Smooth transition from onboarding to setup
**Key Features:**
✅ Weighted progress calculation (steps weighted by complexity/time)
✅ Mobile and desktop responsive design
✅ Step state persistence (save & resume)
✅ Skip logic for optional steps (Quality, Team)
✅ Backend integration ready (uses existing useUserProgress hooks)
✅ Consistent with existing OnboardingWizard patterns
✅ Loading and error states
✅ Accessibility support (ARIA labels, keyboard navigation ready)
**Architecture Decisions:**
- Reuses OnboardingWizard patterns (StepConfig interface, progress tracking)
- Integrates with existing backend (user_progress table, step completion API)
- AppShell layout (shows header & sidebar for context)
- Modular step components (easy to implement individually in Phases 2-3)
**Progress:**
Phase 1 (Foundation): ✅ COMPLETE
- Component structure ✅
- Navigation & progress ✅
- Routing & integration ✅
- Placeholder steps ✅
Phase 2 (Core Steps): 🔜 NEXT
- Suppliers setup implementation
- Inventory items setup implementation
- Recipes setup implementation
Phase 3 (Advanced Features): 🔜 FUTURE
- Quality standards implementation
- Team setup implementation
- Templates & smart defaults
**Files Changed:**
- 17 new files created
- 3 existing files modified (CompletionStep.tsx, AppRouter.tsx, routes.config.ts)
**Testing Status:**
- Components compile successfully
- No TypeScript errors
- Ready for Phase 2 implementation
Based on comprehensive design specification in:
- docs/wizard-flow-specification.md (2,144 lines)
- docs/jtbd-analysis-inventory-setup.md (461 lines)
Total implementation time: ~4 hours (Phase 1 of 6 phases)
Estimated total project: 11 weeks (Phase 1: Week 1-2 foundation ✅)
2025-11-06 11:14:09 +00:00
import { useTranslation } from 'react-i18next' ;
import type { SetupStepProps } from '../SetupWizard' ;
Implement Phase 3: Optional advanced features for setup wizard
This commit implements two optional steps that allow users to configure
advanced features during the bakery setup process. Both steps can be
skipped without blocking wizard completion.
## Implemented Steps
### 1. Quality Setup Step (QualitySetupStep.tsx)
- Quality check template creation with full API integration
- 6 check types: Visual, Measurement, Temperature, Weight, Timing, Checklist
- Multi-select applicable stages (mixing, proofing, shaping, baking, etc.)
- Optional description field
- Required/Critical flags with visual indicators
- Minimum requirement: 2 quality checks (skippable)
- Grid-based type and stage selection with icons
- Integration with useQualityTemplates and useCreateQualityTemplate hooks
### 2. Team Setup Step (TeamSetupStep.tsx)
- Team member collection form (local state management)
- Required fields: Name, Email
- Role selection: Admin, Manager, Baker, Cashier
- Grid-based role selection with icons and descriptions
- Email validation and duplicate prevention
- Team member list with avatar icons
- Remove functionality
- Fully optional (always canContinue = true)
- Info note about future invitation emails
- Skip messaging for solo operators
## Key Features
### Quality Setup Step:
- ✅ Full backend integration with quality templates API
- ✅ Visual icon-based check type selection
- ✅ Multi-select stage chips (toggle on/off)
- ✅ Required/Critical badges on template list
- ✅ Form validation (name, at least one stage)
- ✅ Optional badge prominently displayed
- ✅ Progress tracking with "Need X more" messaging
### Team Setup Step:
- ✅ Local state management (ready for future API)
- ✅ Email validation with duplicate checking
- ✅ Visual role cards with icons and descriptions
- ✅ Team member list with role badges and avatars
- ✅ Remove button for each member
- ✅ Info note about invitation emails
- ✅ Skip messaging for working alone
- ✅ Always allows continuation (truly optional)
## Shared Features Across Both Steps:
- ✅ "Optional" badge with explanatory text
- ✅ "Why This Matters" information section
- ✅ Inline forms (not modals)
- ✅ Real-time validation with error messages
- ✅ Parent notification via onUpdate callback
- ✅ Responsive mobile-first design
- ✅ i18n support with translation keys
- ✅ Loading states
- ✅ Consistent UI patterns with Phase 2 steps
## Technical Implementation
### Quality Setup:
- Integration with qualityTemplateService
- useQualityTemplates hook for fetching templates
- useCreateQualityTemplate mutation hook
- ProcessStage and QualityCheckType enums from API types
- User ID from auth store for created_by field
- Template list with badge indicators
### Team Setup:
- Local TeamMember interface
- useState for team members array
- Email regex validation
- Duplicate email detection
- Role options with metadata (icon, label, description)
- Ready for future team invitation API integration
## Files Modified:
- frontend/src/components/domain/setup-wizard/steps/QualitySetupStep.tsx (406 lines)
- frontend/src/components/domain/setup-wizard/steps/TeamSetupStep.tsx (316 lines)
Total: **722 lines of new functional code**
## Related:
- Builds on Phase 1 (foundation) and Phase 2 (core steps)
- Integrates with quality templates service
- Prepared for future team invitation service
- Follows design specification in docs/wizard-flow-specification.md
- Addresses JTBD findings about quality and team management
## Next Steps (Phase 4+):
- Smart features (auto-suggestions, smart defaults)
- Polish & animations
- Comprehensive testing
- Template systems enhancement
- Bulk import functionality
2025-11-06 11:31:58 +00:00
interface TeamMember {
id : string ;
name : string ;
email : string ;
role : string ;
}
2025-11-06 19:55:42 +00:00
export const TeamSetupStep : React.FC < SetupStepProps > = ( { onUpdate , onComplete , canContinue } ) = > {
Implement Phase 1: Setup Wizard Foundation (Foundation & Architecture)
Created complete foundation for the bakery operations setup wizard that guides
users through post-onboarding configuration of suppliers, inventory, recipes,
quality standards, and team members.
**Core Components Created:**
1. SetupWizard.tsx - Main wizard orchestrator
- 7-step configuration (Welcome → Suppliers → Inventory → Recipes → Quality → Team → Completion)
- Weighted progress tracking (complex steps count more)
- Step state management with backend synchronization
- Auto-save and resume functionality
- Skip logic for optional steps
2. StepProgress.tsx - Progress visualization
- Responsive progress bar with weighted calculation
- Desktop: Full step indicators with descriptions
- Mobile: Horizontal scrolling step indicators
- Visual completion status (checkmarks for completed steps)
- Shows optional vs required steps
3. StepNavigation.tsx - Navigation controls
- Back/Skip/Continue buttons with smart enabling
- Conditional skip button (only for optional steps)
- Loading states during saves
- Contextual button text based on step
4. Placeholder Step Components (7 steps):
- WelcomeStep: Introduction with feature preview
- SuppliersSetupStep: Placeholder for Phase 2
- InventorySetupStep: Placeholder for Phase 2
- RecipesSetupStep: Placeholder for Phase 2
- QualitySetupStep: Placeholder for Phase 3
- TeamSetupStep: Placeholder for Phase 3
- CompletionStep: Success celebration
**Routing & Integration:**
- Added /app/setup route to routes.config.ts and AppRouter.tsx
- Created SetupPage wrapper component
- Integrated with OnboardingWizard CompletionStep
- Added "One More Thing" CTA after onboarding
- Choice: "Configurar Ahora (15 min)" or "Lo haré después"
- Smooth transition from onboarding to setup
**Key Features:**
✅ Weighted progress calculation (steps weighted by complexity/time)
✅ Mobile and desktop responsive design
✅ Step state persistence (save & resume)
✅ Skip logic for optional steps (Quality, Team)
✅ Backend integration ready (uses existing useUserProgress hooks)
✅ Consistent with existing OnboardingWizard patterns
✅ Loading and error states
✅ Accessibility support (ARIA labels, keyboard navigation ready)
**Architecture Decisions:**
- Reuses OnboardingWizard patterns (StepConfig interface, progress tracking)
- Integrates with existing backend (user_progress table, step completion API)
- AppShell layout (shows header & sidebar for context)
- Modular step components (easy to implement individually in Phases 2-3)
**Progress:**
Phase 1 (Foundation): ✅ COMPLETE
- Component structure ✅
- Navigation & progress ✅
- Routing & integration ✅
- Placeholder steps ✅
Phase 2 (Core Steps): 🔜 NEXT
- Suppliers setup implementation
- Inventory items setup implementation
- Recipes setup implementation
Phase 3 (Advanced Features): 🔜 FUTURE
- Quality standards implementation
- Team setup implementation
- Templates & smart defaults
**Files Changed:**
- 17 new files created
- 3 existing files modified (CompletionStep.tsx, AppRouter.tsx, routes.config.ts)
**Testing Status:**
- Components compile successfully
- No TypeScript errors
- Ready for Phase 2 implementation
Based on comprehensive design specification in:
- docs/wizard-flow-specification.md (2,144 lines)
- docs/jtbd-analysis-inventory-setup.md (461 lines)
Total implementation time: ~4 hours (Phase 1 of 6 phases)
Estimated total project: 11 weeks (Phase 1: Week 1-2 foundation ✅)
2025-11-06 11:14:09 +00:00
const { t } = useTranslation ( ) ;
Implement Phase 3: Optional advanced features for setup wizard
This commit implements two optional steps that allow users to configure
advanced features during the bakery setup process. Both steps can be
skipped without blocking wizard completion.
## Implemented Steps
### 1. Quality Setup Step (QualitySetupStep.tsx)
- Quality check template creation with full API integration
- 6 check types: Visual, Measurement, Temperature, Weight, Timing, Checklist
- Multi-select applicable stages (mixing, proofing, shaping, baking, etc.)
- Optional description field
- Required/Critical flags with visual indicators
- Minimum requirement: 2 quality checks (skippable)
- Grid-based type and stage selection with icons
- Integration with useQualityTemplates and useCreateQualityTemplate hooks
### 2. Team Setup Step (TeamSetupStep.tsx)
- Team member collection form (local state management)
- Required fields: Name, Email
- Role selection: Admin, Manager, Baker, Cashier
- Grid-based role selection with icons and descriptions
- Email validation and duplicate prevention
- Team member list with avatar icons
- Remove functionality
- Fully optional (always canContinue = true)
- Info note about future invitation emails
- Skip messaging for solo operators
## Key Features
### Quality Setup Step:
- ✅ Full backend integration with quality templates API
- ✅ Visual icon-based check type selection
- ✅ Multi-select stage chips (toggle on/off)
- ✅ Required/Critical badges on template list
- ✅ Form validation (name, at least one stage)
- ✅ Optional badge prominently displayed
- ✅ Progress tracking with "Need X more" messaging
### Team Setup Step:
- ✅ Local state management (ready for future API)
- ✅ Email validation with duplicate checking
- ✅ Visual role cards with icons and descriptions
- ✅ Team member list with role badges and avatars
- ✅ Remove button for each member
- ✅ Info note about invitation emails
- ✅ Skip messaging for working alone
- ✅ Always allows continuation (truly optional)
## Shared Features Across Both Steps:
- ✅ "Optional" badge with explanatory text
- ✅ "Why This Matters" information section
- ✅ Inline forms (not modals)
- ✅ Real-time validation with error messages
- ✅ Parent notification via onUpdate callback
- ✅ Responsive mobile-first design
- ✅ i18n support with translation keys
- ✅ Loading states
- ✅ Consistent UI patterns with Phase 2 steps
## Technical Implementation
### Quality Setup:
- Integration with qualityTemplateService
- useQualityTemplates hook for fetching templates
- useCreateQualityTemplate mutation hook
- ProcessStage and QualityCheckType enums from API types
- User ID from auth store for created_by field
- Template list with badge indicators
### Team Setup:
- Local TeamMember interface
- useState for team members array
- Email regex validation
- Duplicate email detection
- Role options with metadata (icon, label, description)
- Ready for future team invitation API integration
## Files Modified:
- frontend/src/components/domain/setup-wizard/steps/QualitySetupStep.tsx (406 lines)
- frontend/src/components/domain/setup-wizard/steps/TeamSetupStep.tsx (316 lines)
Total: **722 lines of new functional code**
## Related:
- Builds on Phase 1 (foundation) and Phase 2 (core steps)
- Integrates with quality templates service
- Prepared for future team invitation service
- Follows design specification in docs/wizard-flow-specification.md
- Addresses JTBD findings about quality and team management
## Next Steps (Phase 4+):
- Smart features (auto-suggestions, smart defaults)
- Polish & animations
- Comprehensive testing
- Template systems enhancement
- Bulk import functionality
2025-11-06 11:31:58 +00:00
// Local state for team members (will be sent to backend when API is available)
const [ teamMembers , setTeamMembers ] = useState < TeamMember [ ] > ( [ ] ) ;
const [ isAdding , setIsAdding ] = useState ( false ) ;
const [ formData , setFormData ] = useState ( {
name : '' ,
email : '' ,
role : 'baker' ,
} ) ;
const [ errors , setErrors ] = useState < Record < string , string > > ( { } ) ;
// Notify parent - Team step is always optional, so always canContinue
useEffect ( ( ) = > {
onUpdate ? . ( {
itemsCount : teamMembers.length ,
canContinue : true , // Always true since this step is optional
} ) ;
} , [ teamMembers . length , onUpdate ] ) ;
// Validation
const validateForm = ( ) : boolean = > {
const newErrors : Record < string , string > = { } ;
if ( ! formData . name . trim ( ) ) {
newErrors . name = t ( 'setup_wizard:team.errors.name_required' , 'Name is required' ) ;
}
if ( ! formData . email . trim ( ) ) {
newErrors . email = t ( 'setup_wizard:team.errors.email_required' , 'Email is required' ) ;
} else if ( ! /^[^\s@]+@[^\s@]+\.[^\s@]+$/ . test ( formData . email ) ) {
newErrors . email = t ( 'setup_wizard:team.errors.email_invalid' , 'Invalid email format' ) ;
}
// Check for duplicate email
if ( teamMembers . some ( ( member ) = > member . email . toLowerCase ( ) === formData . email . toLowerCase ( ) ) ) {
newErrors . email = t ( 'setup_wizard:team.errors.email_duplicate' , 'This email is already added' ) ;
}
setErrors ( newErrors ) ;
return Object . keys ( newErrors ) . length === 0 ;
} ;
// Form handlers
const handleSubmit = ( e : React.FormEvent ) = > {
e . preventDefault ( ) ;
if ( ! validateForm ( ) ) return ;
// Add team member to local state
const newMember : TeamMember = {
id : Date.now ( ) . toString ( ) ,
name : formData.name ,
email : formData.email ,
role : formData.role ,
} ;
setTeamMembers ( [ . . . teamMembers , newMember ] ) ;
// Reset form
resetForm ( ) ;
} ;
const resetForm = ( ) = > {
setFormData ( {
name : '' ,
email : '' ,
role : 'baker' ,
} ) ;
setErrors ( { } ) ;
setIsAdding ( false ) ;
} ;
const handleRemove = ( memberId : string ) = > {
setTeamMembers ( teamMembers . filter ( ( member ) = > member . id !== memberId ) ) ;
} ;
const roleOptions = [
{ value : 'admin' , label : t ( 'team:role.admin' , 'Admin' ) , icon : '👑' , description : t ( 'team:role.admin_desc' , 'Full access' ) } ,
{ value : 'manager' , label : t ( 'team:role.manager' , 'Manager' ) , icon : '📊' , description : t ( 'team:role.manager_desc' , 'Can manage operations' ) } ,
{ value : 'baker' , label : t ( 'team:role.baker' , 'Baker' ) , icon : '👨🍳' , description : t ( 'team:role.baker_desc' , 'Production staff' ) } ,
{ value : 'cashier' , label : t ( 'team:role.cashier' , 'Cashier' ) , icon : '💰' , description : t ( 'team:role.cashier_desc' , 'Sales and POS' ) } ,
] ;
Implement Phase 1: Setup Wizard Foundation (Foundation & Architecture)
Created complete foundation for the bakery operations setup wizard that guides
users through post-onboarding configuration of suppliers, inventory, recipes,
quality standards, and team members.
**Core Components Created:**
1. SetupWizard.tsx - Main wizard orchestrator
- 7-step configuration (Welcome → Suppliers → Inventory → Recipes → Quality → Team → Completion)
- Weighted progress tracking (complex steps count more)
- Step state management with backend synchronization
- Auto-save and resume functionality
- Skip logic for optional steps
2. StepProgress.tsx - Progress visualization
- Responsive progress bar with weighted calculation
- Desktop: Full step indicators with descriptions
- Mobile: Horizontal scrolling step indicators
- Visual completion status (checkmarks for completed steps)
- Shows optional vs required steps
3. StepNavigation.tsx - Navigation controls
- Back/Skip/Continue buttons with smart enabling
- Conditional skip button (only for optional steps)
- Loading states during saves
- Contextual button text based on step
4. Placeholder Step Components (7 steps):
- WelcomeStep: Introduction with feature preview
- SuppliersSetupStep: Placeholder for Phase 2
- InventorySetupStep: Placeholder for Phase 2
- RecipesSetupStep: Placeholder for Phase 2
- QualitySetupStep: Placeholder for Phase 3
- TeamSetupStep: Placeholder for Phase 3
- CompletionStep: Success celebration
**Routing & Integration:**
- Added /app/setup route to routes.config.ts and AppRouter.tsx
- Created SetupPage wrapper component
- Integrated with OnboardingWizard CompletionStep
- Added "One More Thing" CTA after onboarding
- Choice: "Configurar Ahora (15 min)" or "Lo haré después"
- Smooth transition from onboarding to setup
**Key Features:**
✅ Weighted progress calculation (steps weighted by complexity/time)
✅ Mobile and desktop responsive design
✅ Step state persistence (save & resume)
✅ Skip logic for optional steps (Quality, Team)
✅ Backend integration ready (uses existing useUserProgress hooks)
✅ Consistent with existing OnboardingWizard patterns
✅ Loading and error states
✅ Accessibility support (ARIA labels, keyboard navigation ready)
**Architecture Decisions:**
- Reuses OnboardingWizard patterns (StepConfig interface, progress tracking)
- Integrates with existing backend (user_progress table, step completion API)
- AppShell layout (shows header & sidebar for context)
- Modular step components (easy to implement individually in Phases 2-3)
**Progress:**
Phase 1 (Foundation): ✅ COMPLETE
- Component structure ✅
- Navigation & progress ✅
- Routing & integration ✅
- Placeholder steps ✅
Phase 2 (Core Steps): 🔜 NEXT
- Suppliers setup implementation
- Inventory items setup implementation
- Recipes setup implementation
Phase 3 (Advanced Features): 🔜 FUTURE
- Quality standards implementation
- Team setup implementation
- Templates & smart defaults
**Files Changed:**
- 17 new files created
- 3 existing files modified (CompletionStep.tsx, AppRouter.tsx, routes.config.ts)
**Testing Status:**
- Components compile successfully
- No TypeScript errors
- Ready for Phase 2 implementation
Based on comprehensive design specification in:
- docs/wizard-flow-specification.md (2,144 lines)
- docs/jtbd-analysis-inventory-setup.md (461 lines)
Total implementation time: ~4 hours (Phase 1 of 6 phases)
Estimated total project: 11 weeks (Phase 1: Week 1-2 foundation ✅)
2025-11-06 11:14:09 +00:00
return (
< div className = "space-y-6" >
Implement Phase 3: Optional advanced features for setup wizard
This commit implements two optional steps that allow users to configure
advanced features during the bakery setup process. Both steps can be
skipped without blocking wizard completion.
## Implemented Steps
### 1. Quality Setup Step (QualitySetupStep.tsx)
- Quality check template creation with full API integration
- 6 check types: Visual, Measurement, Temperature, Weight, Timing, Checklist
- Multi-select applicable stages (mixing, proofing, shaping, baking, etc.)
- Optional description field
- Required/Critical flags with visual indicators
- Minimum requirement: 2 quality checks (skippable)
- Grid-based type and stage selection with icons
- Integration with useQualityTemplates and useCreateQualityTemplate hooks
### 2. Team Setup Step (TeamSetupStep.tsx)
- Team member collection form (local state management)
- Required fields: Name, Email
- Role selection: Admin, Manager, Baker, Cashier
- Grid-based role selection with icons and descriptions
- Email validation and duplicate prevention
- Team member list with avatar icons
- Remove functionality
- Fully optional (always canContinue = true)
- Info note about future invitation emails
- Skip messaging for solo operators
## Key Features
### Quality Setup Step:
- ✅ Full backend integration with quality templates API
- ✅ Visual icon-based check type selection
- ✅ Multi-select stage chips (toggle on/off)
- ✅ Required/Critical badges on template list
- ✅ Form validation (name, at least one stage)
- ✅ Optional badge prominently displayed
- ✅ Progress tracking with "Need X more" messaging
### Team Setup Step:
- ✅ Local state management (ready for future API)
- ✅ Email validation with duplicate checking
- ✅ Visual role cards with icons and descriptions
- ✅ Team member list with role badges and avatars
- ✅ Remove button for each member
- ✅ Info note about invitation emails
- ✅ Skip messaging for working alone
- ✅ Always allows continuation (truly optional)
## Shared Features Across Both Steps:
- ✅ "Optional" badge with explanatory text
- ✅ "Why This Matters" information section
- ✅ Inline forms (not modals)
- ✅ Real-time validation with error messages
- ✅ Parent notification via onUpdate callback
- ✅ Responsive mobile-first design
- ✅ i18n support with translation keys
- ✅ Loading states
- ✅ Consistent UI patterns with Phase 2 steps
## Technical Implementation
### Quality Setup:
- Integration with qualityTemplateService
- useQualityTemplates hook for fetching templates
- useCreateQualityTemplate mutation hook
- ProcessStage and QualityCheckType enums from API types
- User ID from auth store for created_by field
- Template list with badge indicators
### Team Setup:
- Local TeamMember interface
- useState for team members array
- Email regex validation
- Duplicate email detection
- Role options with metadata (icon, label, description)
- Ready for future team invitation API integration
## Files Modified:
- frontend/src/components/domain/setup-wizard/steps/QualitySetupStep.tsx (406 lines)
- frontend/src/components/domain/setup-wizard/steps/TeamSetupStep.tsx (316 lines)
Total: **722 lines of new functional code**
## Related:
- Builds on Phase 1 (foundation) and Phase 2 (core steps)
- Integrates with quality templates service
- Prepared for future team invitation service
- Follows design specification in docs/wizard-flow-specification.md
- Addresses JTBD findings about quality and team management
## Next Steps (Phase 4+):
- Smart features (auto-suggestions, smart defaults)
- Polish & animations
- Comprehensive testing
- Template systems enhancement
- Bulk import functionality
2025-11-06 11:31:58 +00:00
{ /* Why This Matters */ }
Implement Phase 1: Setup Wizard Foundation (Foundation & Architecture)
Created complete foundation for the bakery operations setup wizard that guides
users through post-onboarding configuration of suppliers, inventory, recipes,
quality standards, and team members.
**Core Components Created:**
1. SetupWizard.tsx - Main wizard orchestrator
- 7-step configuration (Welcome → Suppliers → Inventory → Recipes → Quality → Team → Completion)
- Weighted progress tracking (complex steps count more)
- Step state management with backend synchronization
- Auto-save and resume functionality
- Skip logic for optional steps
2. StepProgress.tsx - Progress visualization
- Responsive progress bar with weighted calculation
- Desktop: Full step indicators with descriptions
- Mobile: Horizontal scrolling step indicators
- Visual completion status (checkmarks for completed steps)
- Shows optional vs required steps
3. StepNavigation.tsx - Navigation controls
- Back/Skip/Continue buttons with smart enabling
- Conditional skip button (only for optional steps)
- Loading states during saves
- Contextual button text based on step
4. Placeholder Step Components (7 steps):
- WelcomeStep: Introduction with feature preview
- SuppliersSetupStep: Placeholder for Phase 2
- InventorySetupStep: Placeholder for Phase 2
- RecipesSetupStep: Placeholder for Phase 2
- QualitySetupStep: Placeholder for Phase 3
- TeamSetupStep: Placeholder for Phase 3
- CompletionStep: Success celebration
**Routing & Integration:**
- Added /app/setup route to routes.config.ts and AppRouter.tsx
- Created SetupPage wrapper component
- Integrated with OnboardingWizard CompletionStep
- Added "One More Thing" CTA after onboarding
- Choice: "Configurar Ahora (15 min)" or "Lo haré después"
- Smooth transition from onboarding to setup
**Key Features:**
✅ Weighted progress calculation (steps weighted by complexity/time)
✅ Mobile and desktop responsive design
✅ Step state persistence (save & resume)
✅ Skip logic for optional steps (Quality, Team)
✅ Backend integration ready (uses existing useUserProgress hooks)
✅ Consistent with existing OnboardingWizard patterns
✅ Loading and error states
✅ Accessibility support (ARIA labels, keyboard navigation ready)
**Architecture Decisions:**
- Reuses OnboardingWizard patterns (StepConfig interface, progress tracking)
- Integrates with existing backend (user_progress table, step completion API)
- AppShell layout (shows header & sidebar for context)
- Modular step components (easy to implement individually in Phases 2-3)
**Progress:**
Phase 1 (Foundation): ✅ COMPLETE
- Component structure ✅
- Navigation & progress ✅
- Routing & integration ✅
- Placeholder steps ✅
Phase 2 (Core Steps): 🔜 NEXT
- Suppliers setup implementation
- Inventory items setup implementation
- Recipes setup implementation
Phase 3 (Advanced Features): 🔜 FUTURE
- Quality standards implementation
- Team setup implementation
- Templates & smart defaults
**Files Changed:**
- 17 new files created
- 3 existing files modified (CompletionStep.tsx, AppRouter.tsx, routes.config.ts)
**Testing Status:**
- Components compile successfully
- No TypeScript errors
- Ready for Phase 2 implementation
Based on comprehensive design specification in:
- docs/wizard-flow-specification.md (2,144 lines)
- docs/jtbd-analysis-inventory-setup.md (461 lines)
Total implementation time: ~4 hours (Phase 1 of 6 phases)
Estimated total project: 11 weeks (Phase 1: Week 1-2 foundation ✅)
2025-11-06 11:14:09 +00:00
< div className = "bg-[var(--color-info)]/10 border border-[var(--color-info)]/20 rounded-lg p-4" >
< h3 className = "font-semibold text-[var(--text-primary)] mb-2 flex items-center gap-2" >
< svg className = "w-5 h-5 text-[var(--color-info)]" fill = "none" stroke = "currentColor" viewBox = "0 0 24 24" >
< path strokeLinecap = "round" strokeLinejoin = "round" strokeWidth = { 2 } d = "M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" / >
< / svg >
{ t ( 'setup_wizard:why_this_matters' , 'Why This Matters' ) }
< / h3 >
< p className = "text-sm text-[var(--text-secondary)]" >
{ t ( 'setup_wizard:team.why' , 'Adding team members allows you to assign tasks, track who does what, and give everyone the tools they need to work efficiently.' ) }
< / p >
< / div >
Implement Phase 3: Optional advanced features for setup wizard
This commit implements two optional steps that allow users to configure
advanced features during the bakery setup process. Both steps can be
skipped without blocking wizard completion.
## Implemented Steps
### 1. Quality Setup Step (QualitySetupStep.tsx)
- Quality check template creation with full API integration
- 6 check types: Visual, Measurement, Temperature, Weight, Timing, Checklist
- Multi-select applicable stages (mixing, proofing, shaping, baking, etc.)
- Optional description field
- Required/Critical flags with visual indicators
- Minimum requirement: 2 quality checks (skippable)
- Grid-based type and stage selection with icons
- Integration with useQualityTemplates and useCreateQualityTemplate hooks
### 2. Team Setup Step (TeamSetupStep.tsx)
- Team member collection form (local state management)
- Required fields: Name, Email
- Role selection: Admin, Manager, Baker, Cashier
- Grid-based role selection with icons and descriptions
- Email validation and duplicate prevention
- Team member list with avatar icons
- Remove functionality
- Fully optional (always canContinue = true)
- Info note about future invitation emails
- Skip messaging for solo operators
## Key Features
### Quality Setup Step:
- ✅ Full backend integration with quality templates API
- ✅ Visual icon-based check type selection
- ✅ Multi-select stage chips (toggle on/off)
- ✅ Required/Critical badges on template list
- ✅ Form validation (name, at least one stage)
- ✅ Optional badge prominently displayed
- ✅ Progress tracking with "Need X more" messaging
### Team Setup Step:
- ✅ Local state management (ready for future API)
- ✅ Email validation with duplicate checking
- ✅ Visual role cards with icons and descriptions
- ✅ Team member list with role badges and avatars
- ✅ Remove button for each member
- ✅ Info note about invitation emails
- ✅ Skip messaging for working alone
- ✅ Always allows continuation (truly optional)
## Shared Features Across Both Steps:
- ✅ "Optional" badge with explanatory text
- ✅ "Why This Matters" information section
- ✅ Inline forms (not modals)
- ✅ Real-time validation with error messages
- ✅ Parent notification via onUpdate callback
- ✅ Responsive mobile-first design
- ✅ i18n support with translation keys
- ✅ Loading states
- ✅ Consistent UI patterns with Phase 2 steps
## Technical Implementation
### Quality Setup:
- Integration with qualityTemplateService
- useQualityTemplates hook for fetching templates
- useCreateQualityTemplate mutation hook
- ProcessStage and QualityCheckType enums from API types
- User ID from auth store for created_by field
- Template list with badge indicators
### Team Setup:
- Local TeamMember interface
- useState for team members array
- Email regex validation
- Duplicate email detection
- Role options with metadata (icon, label, description)
- Ready for future team invitation API integration
## Files Modified:
- frontend/src/components/domain/setup-wizard/steps/QualitySetupStep.tsx (406 lines)
- frontend/src/components/domain/setup-wizard/steps/TeamSetupStep.tsx (316 lines)
Total: **722 lines of new functional code**
## Related:
- Builds on Phase 1 (foundation) and Phase 2 (core steps)
- Integrates with quality templates service
- Prepared for future team invitation service
- Follows design specification in docs/wizard-flow-specification.md
- Addresses JTBD findings about quality and team management
## Next Steps (Phase 4+):
- Smart features (auto-suggestions, smart defaults)
- Polish & animations
- Comprehensive testing
- Template systems enhancement
- Bulk import functionality
2025-11-06 11:31:58 +00:00
{ /* Optional badge */ }
< div className = "flex items-center gap-2 text-sm" >
< span className = "px-2 py-1 bg-[var(--bg-secondary)] text-[var(--text-secondary)] rounded-full border border-[var(--border-secondary)]" >
{ t ( 'setup_wizard:optional' , 'Optional' ) }
< / span >
< span className = "text-[var(--text-tertiary)]" >
{ t ( 'setup_wizard:team.optional_note' , 'You can add team members now or invite them later from settings' ) }
< / span >
< / div >
{ /* Info note about future invitations */ }
{ teamMembers . length > 0 && (
< div className = "flex items-start gap-2 p-3 bg-[var(--color-info)]/10 border border-[var(--color-info)]/20 rounded-lg" >
< svg className = "w-5 h-5 text-[var(--color-info)] flex-shrink-0 mt-0.5" fill = "none" stroke = "currentColor" viewBox = "0 0 24 24" >
< path strokeLinecap = "round" strokeLinejoin = "round" strokeWidth = { 2 } d = "M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" / >
< / svg >
< div className = "text-sm text-[var(--text-secondary)]" >
{ t ( 'setup_wizard:team.invitation_note' , 'Team members will receive invitation emails once you complete the setup wizard.' ) }
< / div >
< / div >
) }
{ /* Progress indicator */ }
< div className = "flex items-center justify-between p-3 bg-[var(--bg-secondary)] rounded-lg" >
< div className = "flex items-center gap-2" >
< svg className = "w-5 h-5 text-[var(--text-secondary)]" fill = "none" stroke = "currentColor" viewBox = "0 0 24 24" >
< path strokeLinecap = "round" strokeLinejoin = "round" strokeWidth = { 2 } d = "M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z" / >
< / svg >
< span className = "text-sm font-medium text-[var(--text-primary)]" >
{ t ( 'setup_wizard:team.added_count' , { count : teamMembers.length , defaultValue : '{{count}} team member added' } ) }
< / span >
Implement Phase 1: Setup Wizard Foundation (Foundation & Architecture)
Created complete foundation for the bakery operations setup wizard that guides
users through post-onboarding configuration of suppliers, inventory, recipes,
quality standards, and team members.
**Core Components Created:**
1. SetupWizard.tsx - Main wizard orchestrator
- 7-step configuration (Welcome → Suppliers → Inventory → Recipes → Quality → Team → Completion)
- Weighted progress tracking (complex steps count more)
- Step state management with backend synchronization
- Auto-save and resume functionality
- Skip logic for optional steps
2. StepProgress.tsx - Progress visualization
- Responsive progress bar with weighted calculation
- Desktop: Full step indicators with descriptions
- Mobile: Horizontal scrolling step indicators
- Visual completion status (checkmarks for completed steps)
- Shows optional vs required steps
3. StepNavigation.tsx - Navigation controls
- Back/Skip/Continue buttons with smart enabling
- Conditional skip button (only for optional steps)
- Loading states during saves
- Contextual button text based on step
4. Placeholder Step Components (7 steps):
- WelcomeStep: Introduction with feature preview
- SuppliersSetupStep: Placeholder for Phase 2
- InventorySetupStep: Placeholder for Phase 2
- RecipesSetupStep: Placeholder for Phase 2
- QualitySetupStep: Placeholder for Phase 3
- TeamSetupStep: Placeholder for Phase 3
- CompletionStep: Success celebration
**Routing & Integration:**
- Added /app/setup route to routes.config.ts and AppRouter.tsx
- Created SetupPage wrapper component
- Integrated with OnboardingWizard CompletionStep
- Added "One More Thing" CTA after onboarding
- Choice: "Configurar Ahora (15 min)" or "Lo haré después"
- Smooth transition from onboarding to setup
**Key Features:**
✅ Weighted progress calculation (steps weighted by complexity/time)
✅ Mobile and desktop responsive design
✅ Step state persistence (save & resume)
✅ Skip logic for optional steps (Quality, Team)
✅ Backend integration ready (uses existing useUserProgress hooks)
✅ Consistent with existing OnboardingWizard patterns
✅ Loading and error states
✅ Accessibility support (ARIA labels, keyboard navigation ready)
**Architecture Decisions:**
- Reuses OnboardingWizard patterns (StepConfig interface, progress tracking)
- Integrates with existing backend (user_progress table, step completion API)
- AppShell layout (shows header & sidebar for context)
- Modular step components (easy to implement individually in Phases 2-3)
**Progress:**
Phase 1 (Foundation): ✅ COMPLETE
- Component structure ✅
- Navigation & progress ✅
- Routing & integration ✅
- Placeholder steps ✅
Phase 2 (Core Steps): 🔜 NEXT
- Suppliers setup implementation
- Inventory items setup implementation
- Recipes setup implementation
Phase 3 (Advanced Features): 🔜 FUTURE
- Quality standards implementation
- Team setup implementation
- Templates & smart defaults
**Files Changed:**
- 17 new files created
- 3 existing files modified (CompletionStep.tsx, AppRouter.tsx, routes.config.ts)
**Testing Status:**
- Components compile successfully
- No TypeScript errors
- Ready for Phase 2 implementation
Based on comprehensive design specification in:
- docs/wizard-flow-specification.md (2,144 lines)
- docs/jtbd-analysis-inventory-setup.md (461 lines)
Total implementation time: ~4 hours (Phase 1 of 6 phases)
Estimated total project: 11 weeks (Phase 1: Week 1-2 foundation ✅)
2025-11-06 11:14:09 +00:00
< / div >
< / div >
Implement Phase 3: Optional advanced features for setup wizard
This commit implements two optional steps that allow users to configure
advanced features during the bakery setup process. Both steps can be
skipped without blocking wizard completion.
## Implemented Steps
### 1. Quality Setup Step (QualitySetupStep.tsx)
- Quality check template creation with full API integration
- 6 check types: Visual, Measurement, Temperature, Weight, Timing, Checklist
- Multi-select applicable stages (mixing, proofing, shaping, baking, etc.)
- Optional description field
- Required/Critical flags with visual indicators
- Minimum requirement: 2 quality checks (skippable)
- Grid-based type and stage selection with icons
- Integration with useQualityTemplates and useCreateQualityTemplate hooks
### 2. Team Setup Step (TeamSetupStep.tsx)
- Team member collection form (local state management)
- Required fields: Name, Email
- Role selection: Admin, Manager, Baker, Cashier
- Grid-based role selection with icons and descriptions
- Email validation and duplicate prevention
- Team member list with avatar icons
- Remove functionality
- Fully optional (always canContinue = true)
- Info note about future invitation emails
- Skip messaging for solo operators
## Key Features
### Quality Setup Step:
- ✅ Full backend integration with quality templates API
- ✅ Visual icon-based check type selection
- ✅ Multi-select stage chips (toggle on/off)
- ✅ Required/Critical badges on template list
- ✅ Form validation (name, at least one stage)
- ✅ Optional badge prominently displayed
- ✅ Progress tracking with "Need X more" messaging
### Team Setup Step:
- ✅ Local state management (ready for future API)
- ✅ Email validation with duplicate checking
- ✅ Visual role cards with icons and descriptions
- ✅ Team member list with role badges and avatars
- ✅ Remove button for each member
- ✅ Info note about invitation emails
- ✅ Skip messaging for working alone
- ✅ Always allows continuation (truly optional)
## Shared Features Across Both Steps:
- ✅ "Optional" badge with explanatory text
- ✅ "Why This Matters" information section
- ✅ Inline forms (not modals)
- ✅ Real-time validation with error messages
- ✅ Parent notification via onUpdate callback
- ✅ Responsive mobile-first design
- ✅ i18n support with translation keys
- ✅ Loading states
- ✅ Consistent UI patterns with Phase 2 steps
## Technical Implementation
### Quality Setup:
- Integration with qualityTemplateService
- useQualityTemplates hook for fetching templates
- useCreateQualityTemplate mutation hook
- ProcessStage and QualityCheckType enums from API types
- User ID from auth store for created_by field
- Template list with badge indicators
### Team Setup:
- Local TeamMember interface
- useState for team members array
- Email regex validation
- Duplicate email detection
- Role options with metadata (icon, label, description)
- Ready for future team invitation API integration
## Files Modified:
- frontend/src/components/domain/setup-wizard/steps/QualitySetupStep.tsx (406 lines)
- frontend/src/components/domain/setup-wizard/steps/TeamSetupStep.tsx (316 lines)
Total: **722 lines of new functional code**
## Related:
- Builds on Phase 1 (foundation) and Phase 2 (core steps)
- Integrates with quality templates service
- Prepared for future team invitation service
- Follows design specification in docs/wizard-flow-specification.md
- Addresses JTBD findings about quality and team management
## Next Steps (Phase 4+):
- Smart features (auto-suggestions, smart defaults)
- Polish & animations
- Comprehensive testing
- Template systems enhancement
- Bulk import functionality
2025-11-06 11:31:58 +00:00
{ /* Team members list */ }
{ teamMembers . length > 0 && (
< div className = "space-y-2" >
< h4 className = "text-sm font-medium text-[var(--text-secondary)]" >
{ t ( 'setup_wizard:team.your_team' , 'Your Team Members' ) }
< / h4 >
< div className = "space-y-2 max-h-80 overflow-y-auto" >
{ teamMembers . map ( ( member ) = > (
< div
key = { member . id }
className = "flex items-center justify-between p-3 bg-[var(--bg-secondary)] border border-[var(--border-secondary)] rounded-lg hover:border-[var(--border-primary)] transition-colors"
>
< div className = "flex-1 min-w-0 flex items-center gap-3" >
< div className = "w-10 h-10 bg-[var(--color-primary)]/10 rounded-full flex items-center justify-center flex-shrink-0" >
< span className = "text-lg" >
{ roleOptions . find ( opt = > opt . value === member . role ) ? . icon || '👤' }
< / span >
< / div >
< div className = "flex-1 min-w-0" >
< div className = "flex items-center gap-2" >
< h5 className = "font-medium text-[var(--text-primary)] truncate" > { member . name } < / h5 >
< span className = "text-xs px-2 py-0.5 bg-[var(--bg-primary)] rounded-full text-[var(--text-secondary)]" >
{ roleOptions . find ( opt = > opt . value === member . role ) ? . label || member . role }
< / span >
< / div >
< p className = "text-xs text-[var(--text-secondary)] truncate" > { member . email } < / p >
< / div >
< / div >
< button
type = "button"
onClick = { ( ) = > handleRemove ( member . id ) }
className = "p-1.5 text-[var(--text-secondary)] hover:text-[var(--color-error)] hover:bg-[var(--color-error)]/10 rounded transition-colors ml-2"
aria - label = { t ( 'common:remove' , 'Remove' ) }
>
< svg className = "w-4 h-4" fill = "none" stroke = "currentColor" viewBox = "0 0 24 24" >
< path strokeLinecap = "round" strokeLinejoin = "round" strokeWidth = { 2 } d = "M6 18L18 6M6 6l12 12" / >
< / svg >
< / button >
< / div >
) ) }
< / div >
< / div >
) }
{ /* Add form */ }
{ isAdding ? (
< form onSubmit = { handleSubmit } className = "space-y-4 p-4 border-2 border-[var(--color-primary)] rounded-lg bg-[var(--bg-secondary)]" >
< div className = "flex items-center justify-between mb-2" >
< h4 className = "font-medium text-[var(--text-primary)]" >
{ t ( 'setup_wizard:team.add_member' , 'Add Team Member' ) }
< / h4 >
< button
type = "button"
onClick = { resetForm }
className = "text-sm text-[var(--text-secondary)] hover:text-[var(--text-primary)]"
>
{ t ( 'common:cancel' , 'Cancel' ) }
< / button >
< / div >
< div className = "space-y-4" >
{ /* Name */ }
< div >
< label htmlFor = "member-name" className = "block text-sm font-medium text-[var(--text-primary)] mb-1" >
{ t ( 'setup_wizard:team.fields.name' , 'Full Name' ) } < span className = "text-[var(--color-error)]" > * < / span >
< / label >
< input
id = "member-name"
type = "text"
value = { formData . name }
onChange = { ( e ) = > setFormData ( { . . . formData , name : e.target.value } ) }
className = { ` w-full px-3 py-2 bg-[var(--bg-primary)] border ${ errors . name ? 'border-[var(--color-error)]' : 'border-[var(--border-secondary)]' } rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] text-[var(--text-primary)] ` }
placeholder = { t ( 'setup_wizard:team.placeholders.name' , 'e.g., María García' ) }
/ >
{ errors . name && < p className = "mt-1 text-xs text-[var(--color-error)]" > { errors . name } < / p > }
< / div >
{ /* Email */ }
< div >
< label htmlFor = "member-email" className = "block text-sm font-medium text-[var(--text-primary)] mb-1" >
{ t ( 'setup_wizard:team.fields.email' , 'Email Address' ) } < span className = "text-[var(--color-error)]" > * < / span >
< / label >
< input
id = "member-email"
type = "email"
value = { formData . email }
onChange = { ( e ) = > setFormData ( { . . . formData , email : e.target.value } ) }
className = { ` w-full px-3 py-2 bg-[var(--bg-primary)] border ${ errors . email ? 'border-[var(--color-error)]' : 'border-[var(--border-secondary)]' } rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] text-[var(--text-primary)] ` }
placeholder = { t ( 'setup_wizard:team.placeholders.email' , 'e.g., maria@panaderia.com' ) }
/ >
{ errors . email && < p className = "mt-1 text-xs text-[var(--color-error)]" > { errors . email } < / p > }
< / div >
{ /* Role */ }
< div >
< label className = "block text-sm font-medium text-[var(--text-primary)] mb-2" >
{ t ( 'setup_wizard:team.fields.role' , 'Role' ) } < span className = "text-[var(--color-error)]" > * < / span >
< / label >
< div className = "grid grid-cols-1 md:grid-cols-2 gap-2" >
{ roleOptions . map ( ( option ) = > (
< button
key = { option . value }
type = "button"
onClick = { ( ) = > setFormData ( { . . . formData , role : option.value } ) }
className = { ` p-3 text-left border rounded-lg transition-colors ${
formData . role === option . value
? 'border-[var(--color-primary)] bg-[var(--color-primary)]/10'
: 'border-[var(--border-secondary)] hover:border-[var(--border-primary)]'
} ` }
>
< div className = "flex items-center gap-2 mb-1" >
< span className = "text-lg" > { option . icon } < / span >
< span className = "text-sm font-medium text-[var(--text-primary)]" > { option . label } < / span >
< / div >
< p className = "text-xs text-[var(--text-secondary)]" > { option . description } < / p >
< / button >
) ) }
< / div >
< / div >
< / div >
< div className = "flex gap-2 pt-2" >
< button
type = "submit"
className = "px-4 py-2 bg-[var(--color-primary)] text-white rounded-lg hover:bg-[var(--color-primary-dark)] transition-colors font-medium"
>
{ t ( 'common:add' , 'Add' ) }
< / button >
< button
type = "button"
onClick = { resetForm }
className = "px-4 py-2 text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:bg-[var(--bg-primary)] rounded-lg transition-colors"
>
{ t ( 'common:cancel' , 'Cancel' ) }
< / button >
< / div >
< / form >
) : (
< button
type = "button"
onClick = { ( ) = > setIsAdding ( true ) }
className = "w-full p-4 border-2 border-dashed border-[var(--border-secondary)] rounded-lg hover:border-[var(--color-primary)] hover:bg-[var(--bg-secondary)] transition-colors group"
>
< div className = "flex items-center justify-center gap-2 text-[var(--text-secondary)] group-hover:text-[var(--color-primary)]" >
< svg className = "w-5 h-5" fill = "none" stroke = "currentColor" viewBox = "0 0 24 24" >
< path strokeLinecap = "round" strokeLinejoin = "round" strokeWidth = { 2 } d = "M12 6v6m0 0v6m0-6h6m-6 0H6" / >
< / svg >
< span className = "font-medium" >
{ teamMembers . length === 0
? t ( 'setup_wizard:team.add_first' , 'Add Your First Team Member' )
: t ( 'setup_wizard:team.add_another' , 'Add Another Team Member' ) }
< / span >
< / div >
< / button >
) }
{ /* Skip message */ }
{ teamMembers . length === 0 && ! isAdding && (
< div className = "text-center py-6" >
< p className = "text-sm text-[var(--text-secondary)] mb-2" >
{ t ( 'setup_wizard:team.skip_message' , 'Working alone for now? No problem!' ) }
< / p >
< p className = "text-xs text-[var(--text-tertiary)]" >
{ t ( 'setup_wizard:team.skip_hint' , 'You can always invite team members later from Settings → Team' ) }
< / p >
< / div >
) }
2025-11-06 19:55:42 +00:00
{ /* Continue button - only shown when used in onboarding context */ }
{ onComplete && (
< div className = "flex justify-end mt-6 pt-6 border-t border-[var(--border-secondary)]" >
< button
onClick = { onComplete }
disabled = { canContinue === false }
className = "px-6 py-3 bg-[var(--color-primary)] text-white rounded-lg hover:bg-[var(--color-primary-dark)] disabled:opacity-50 disabled:cursor-not-allowed transition-colors font-medium"
>
{ t ( 'setup_wizard:navigation.continue' , 'Continue →' ) }
< / button >
< / div >
) }
Implement Phase 1: Setup Wizard Foundation (Foundation & Architecture)
Created complete foundation for the bakery operations setup wizard that guides
users through post-onboarding configuration of suppliers, inventory, recipes,
quality standards, and team members.
**Core Components Created:**
1. SetupWizard.tsx - Main wizard orchestrator
- 7-step configuration (Welcome → Suppliers → Inventory → Recipes → Quality → Team → Completion)
- Weighted progress tracking (complex steps count more)
- Step state management with backend synchronization
- Auto-save and resume functionality
- Skip logic for optional steps
2. StepProgress.tsx - Progress visualization
- Responsive progress bar with weighted calculation
- Desktop: Full step indicators with descriptions
- Mobile: Horizontal scrolling step indicators
- Visual completion status (checkmarks for completed steps)
- Shows optional vs required steps
3. StepNavigation.tsx - Navigation controls
- Back/Skip/Continue buttons with smart enabling
- Conditional skip button (only for optional steps)
- Loading states during saves
- Contextual button text based on step
4. Placeholder Step Components (7 steps):
- WelcomeStep: Introduction with feature preview
- SuppliersSetupStep: Placeholder for Phase 2
- InventorySetupStep: Placeholder for Phase 2
- RecipesSetupStep: Placeholder for Phase 2
- QualitySetupStep: Placeholder for Phase 3
- TeamSetupStep: Placeholder for Phase 3
- CompletionStep: Success celebration
**Routing & Integration:**
- Added /app/setup route to routes.config.ts and AppRouter.tsx
- Created SetupPage wrapper component
- Integrated with OnboardingWizard CompletionStep
- Added "One More Thing" CTA after onboarding
- Choice: "Configurar Ahora (15 min)" or "Lo haré después"
- Smooth transition from onboarding to setup
**Key Features:**
✅ Weighted progress calculation (steps weighted by complexity/time)
✅ Mobile and desktop responsive design
✅ Step state persistence (save & resume)
✅ Skip logic for optional steps (Quality, Team)
✅ Backend integration ready (uses existing useUserProgress hooks)
✅ Consistent with existing OnboardingWizard patterns
✅ Loading and error states
✅ Accessibility support (ARIA labels, keyboard navigation ready)
**Architecture Decisions:**
- Reuses OnboardingWizard patterns (StepConfig interface, progress tracking)
- Integrates with existing backend (user_progress table, step completion API)
- AppShell layout (shows header & sidebar for context)
- Modular step components (easy to implement individually in Phases 2-3)
**Progress:**
Phase 1 (Foundation): ✅ COMPLETE
- Component structure ✅
- Navigation & progress ✅
- Routing & integration ✅
- Placeholder steps ✅
Phase 2 (Core Steps): 🔜 NEXT
- Suppliers setup implementation
- Inventory items setup implementation
- Recipes setup implementation
Phase 3 (Advanced Features): 🔜 FUTURE
- Quality standards implementation
- Team setup implementation
- Templates & smart defaults
**Files Changed:**
- 17 new files created
- 3 existing files modified (CompletionStep.tsx, AppRouter.tsx, routes.config.ts)
**Testing Status:**
- Components compile successfully
- No TypeScript errors
- Ready for Phase 2 implementation
Based on comprehensive design specification in:
- docs/wizard-flow-specification.md (2,144 lines)
- docs/jtbd-analysis-inventory-setup.md (461 lines)
Total implementation time: ~4 hours (Phase 1 of 6 phases)
Estimated total project: 11 weeks (Phase 1: Week 1-2 foundation ✅)
2025-11-06 11:14:09 +00:00
< / div >
) ;
} ;