Files
bakery-ia/frontend/src/components/domain/setup-wizard/steps/QualitySetupStep.tsx

447 lines
21 KiB
TypeScript
Raw Normal View History

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
import { useQualityTemplates, useCreateQualityTemplate } from '../../../../api/hooks/qualityTemplates';
import { useCurrentTenant } from '../../../../stores/tenant.store';
import { useAuthUser } from '../../../../stores/auth.store';
import { QualityCheckType, ProcessStage } from '../../../../api/types/qualityTemplates';
import type { QualityCheckTemplateCreate } from '../../../../api/types/qualityTemplates';
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
Architect navigation buttons correctly: move from wizard-level to step-level Fixed the navigation architecture to follow proper onboarding patterns: **ARCHITECTURE CHANGE:** - REMOVED: External navigation footer from UnifiedOnboardingWizard (Back + Continue buttons at wizard level) - ADDED: Internal Continue buttons inside each setup wizard step component **WHY THIS MATTERS:** 1. Onboarding should NEVER show Back buttons (users cannot go back) 2. Each step should be self-contained with its own Continue button 3. Setup wizard steps are reused in both contexts: - SetupWizard (/app/setup): Uses external StepNavigation component - UnifiedOnboardingWizard: Steps now render their own buttons **CHANGES MADE:** 1. UnifiedOnboardingWizard.tsx: - Removed navigation footer (lines 548-588) - Now passes canContinue prop to steps - Steps are responsible for their own navigation 2. All setup wizard steps updated: - QualitySetupStep: Added onComplete, canContinue props + Continue button - SuppliersSetupStep: Modified existing button to call onComplete - InventorySetupStep: Added onComplete, canContinue props + Continue button - RecipesSetupStep: Added canContinue prop + Continue button - TeamSetupStep: Added onComplete, canContinue props + Continue button - ReviewSetupStep: Added onComplete, canContinue props + Continue button 3. Continue button pattern: - Only renders when onComplete prop exists (onboarding context) - Disabled based on canContinue prop from parent - Styled consistently across all steps - Positioned at bottom with border-top separator **RESULT:** - Clean separation: onboarding steps have internal buttons, no external navigation - No Back button in onboarding (as required) - Setup wizard still works with external StepNavigation - Consistent UX across all steps
2025-11-06 19:55:42 +00:00
export const QualitySetupStep: 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
// Get tenant ID and user
const currentTenant = useCurrentTenant();
const user = useAuthUser();
const tenantId = currentTenant?.id || user?.tenant_id || '';
Fix multiple onboarding and navigation issues **1. Remove duplicate navigation buttons in SetupWizard** - Removed external navigation footer from SetupWizard (lines 370-383) - All setup wizard steps now have only internal navigation buttons - Prevents confusion with double Continue buttons in onboarding **2. Fix quality template API call failure** - Fixed userId validation in QualitySetupStep:17 - Changed from defaulting to empty string to undefined - Added validation check before API call to prevent UUID errors - Disabled submit button when userId not available - Added error message display for missing user Related: frontend/src/components/domain/setup-wizard/steps/QualitySetupStep.tsx:17,51-54,376 **3. Delete regular tours implementation (keep demo tour)** Removed custom tours system while preserving demo tour functionality: - Deleted TourContext.tsx and TourProvider - Deleted Tour UI components folder - Deleted tours/tours.ts definitions - Deleted tour.json translations - Removed TourProvider from App.tsx - Removed TourButton from Sidebar Demo tour (useDemoTour, driver.js) remains intact and functional. Files deleted: - frontend/src/contexts/TourContext.tsx - frontend/src/components/ui/Tour/* (all files) - frontend/src/tours/tours.ts - frontend/src/locales/es/tour.json **4. Issues verified/confirmed:** - Quality type select UI already working (callback setState pattern) - Inventory lots UI confirmed present in InventorySetupStep:683,788,833 - Lots UI visible after adding ingredients in onboarding flow **Build Status:** ✓ All changes verified, build successful in 21.95s
2025-11-06 21:26:09 +00:00
const userId = user?.id; // Keep undefined if not available - backend requires valid UUID
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
// Fetch quality templates
const { data: templatesData, isLoading } = useQualityTemplates(tenantId);
const templates = templatesData?.templates || [];
// Mutations
const createTemplateMutation = useCreateQualityTemplate(tenantId);
// Form state
const [isAdding, setIsAdding] = useState(false);
const [formData, setFormData] = useState({
name: '',
check_type: QualityCheckType.VISUAL,
description: '',
applicable_stages: [] as ProcessStage[],
is_required: false,
is_critical: false,
});
const [errors, setErrors] = useState<Record<string, string>>({});
// Notify parent when count changes
useEffect(() => {
const count = templates.length;
onUpdate?.({
itemsCount: count,
Implement Phase 1: Post-onboarding configuration system This commit implements the first phase of the post-onboarding configuration system based on JTBD analysis: **1. Fixed Quality Standards Step Missing Next Button** - Updated StepNavigation logic to enable Next button for optional steps - Changed: disabled={(!canContinue && !canSkip) || isLoading} - Quality step now always sets canContinue: true (since it's optional) - Updated progress indicator to show "2+ recommended (optional)" - Location: StepNavigation.tsx, QualitySetupStep.tsx **2. Implemented Configuration Progress Widget** A comprehensive dashboard widget that guides post-onboarding configuration: Features: - Real-time progress tracking (% complete calculation) - Section-by-section status (Inventory, Suppliers, Recipes, Quality) - Visual indicators: checkmarks for complete, circles for incomplete - Minimum requirements vs recommended amounts - Next action prompts ("Add at least 3 ingredients") - Feature unlock notifications ("Purchase Orders unlocked!") - Clickable sections that navigate to configuration pages - Auto-hides when 100% configured Location: ConfigurationProgressWidget.tsx (340 lines) Integration: DashboardPage.tsx **Configuration Logic:** - Inventory: 3 minimum, 10 recommended - Suppliers: 1 minimum, 3 recommended - Recipes: 1 minimum, 3 recommended - Quality: 0 minimum (optional), 2 recommended **UX Improvements:** - Clear orientation ("Complete Your Bakery Setup") - Progress bar with percentage - Next step call-to-action - Visual hierarchy (gradient borders, icons, colors) - Responsive design - Loading states **Technical Implementation:** - React hooks: useMemo for calculations - Real-time data fetching from inventory, suppliers, recipes, quality APIs - Automatic progress recalculation on data changes - Navigation integration with react-router - i18n support for all text **Files Created:** - ConfigurationProgressWidget.tsx **Files Modified:** - StepNavigation.tsx - Fixed optional step button logic - QualitySetupStep.tsx - Always allow continuing (optional step) - DashboardPage.tsx - Added configuration widget **Pending (Next Phases):** - Phase 2: Recipe & Supplier Wizard Modals (multi-step forms) - Phase 3: Recipe templates, bulk operations, configuration recovery Build: ✅ Success (21.17s) All TypeScript validations passed.
2025-11-06 17:49:06 +00:00
canContinue: true, // Always allow continuing since this step is optional
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
});
}, [templates.length, onUpdate]);
// Validation
const validateForm = (): boolean => {
const newErrors: Record<string, string> = {};
Fix multiple onboarding and navigation issues **1. Remove duplicate navigation buttons in SetupWizard** - Removed external navigation footer from SetupWizard (lines 370-383) - All setup wizard steps now have only internal navigation buttons - Prevents confusion with double Continue buttons in onboarding **2. Fix quality template API call failure** - Fixed userId validation in QualitySetupStep:17 - Changed from defaulting to empty string to undefined - Added validation check before API call to prevent UUID errors - Disabled submit button when userId not available - Added error message display for missing user Related: frontend/src/components/domain/setup-wizard/steps/QualitySetupStep.tsx:17,51-54,376 **3. Delete regular tours implementation (keep demo tour)** Removed custom tours system while preserving demo tour functionality: - Deleted TourContext.tsx and TourProvider - Deleted Tour UI components folder - Deleted tours/tours.ts definitions - Deleted tour.json translations - Removed TourProvider from App.tsx - Removed TourButton from Sidebar Demo tour (useDemoTour, driver.js) remains intact and functional. Files deleted: - frontend/src/contexts/TourContext.tsx - frontend/src/components/ui/Tour/* (all files) - frontend/src/tours/tours.ts - frontend/src/locales/es/tour.json **4. Issues verified/confirmed:** - Quality type select UI already working (callback setState pattern) - Inventory lots UI confirmed present in InventorySetupStep:683,788,833 - Lots UI visible after adding ingredients in onboarding flow **Build Status:** ✓ All changes verified, build successful in 21.95s
2025-11-06 21:26:09 +00:00
if (!userId) {
newErrors.form = t('common:error_loading_user', 'User not loaded. Please wait or refresh the page.');
setErrors(newErrors);
return false;
}
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
if (!formData.name.trim()) {
newErrors.name = t('setup_wizard:quality.errors.name_required', 'Name is required');
}
if (formData.applicable_stages.length === 0) {
newErrors.stages = t('setup_wizard:quality.errors.stages_required', 'At least one stage is required');
}
setErrors(newErrors);
return Object.keys(newErrors).length === 0;
};
// Form handlers
const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault();
if (!validateForm()) return;
try {
const templateData: QualityCheckTemplateCreate = {
name: formData.name,
check_type: formData.check_type,
description: formData.description || undefined,
applicable_stages: formData.applicable_stages,
is_required: formData.is_required,
is_critical: formData.is_critical,
is_active: true,
weight: formData.is_critical ? 10 : 5,
created_by: userId,
};
await createTemplateMutation.mutateAsync(templateData);
// Reset form
resetForm();
} catch (error) {
console.error('Error saving quality template:', error);
}
};
const resetForm = () => {
setFormData({
name: '',
check_type: QualityCheckType.VISUAL,
description: '',
applicable_stages: [],
is_required: false,
is_critical: false,
});
setErrors({});
setIsAdding(false);
};
const toggleStage = (stage: ProcessStage) => {
const stages = formData.applicable_stages.includes(stage)
? formData.applicable_stages.filter((s) => s !== stage)
: [...formData.applicable_stages, stage];
setFormData({ ...formData, applicable_stages: stages });
};
const checkTypeOptions = [
{ value: QualityCheckType.VISUAL, label: t('quality:type.visual', 'Visual Inspection'), icon: '👁️' },
{ value: QualityCheckType.MEASUREMENT, label: t('quality:type.measurement', 'Measurement'), icon: '📏' },
{ value: QualityCheckType.TEMPERATURE, label: t('quality:type.temperature', 'Temperature'), icon: '🌡️' },
{ value: QualityCheckType.WEIGHT, label: t('quality:type.weight', 'Weight'), icon: '⚖️' },
{ value: QualityCheckType.TIMING, label: t('quality:type.timing', 'Timing'), icon: '⏱️' },
{ value: QualityCheckType.CHECKLIST, label: t('quality:type.checklist', 'Checklist'), icon: '✅' },
];
const stageOptions = [
{ value: ProcessStage.MIXING, label: t('quality:stage.mixing', 'Mixing') },
{ value: ProcessStage.PROOFING, label: t('quality:stage.proofing', 'Proofing') },
{ value: ProcessStage.SHAPING, label: t('quality:stage.shaping', 'Shaping') },
{ value: ProcessStage.BAKING, label: t('quality:stage.baking', 'Baking') },
{ value: ProcessStage.COOLING, label: t('quality:stage.cooling', 'Cooling') },
{ value: ProcessStage.FINISHING, label: t('quality:stage.finishing', 'Finishing') },
{ value: ProcessStage.PACKAGING, label: t('quality:stage.packaging', 'Packaging') },
];
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:quality.why', 'Quality checks ensure consistent output and help you identify issues early. Define what "good" looks like for each stage of production.')}
</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:quality.optional_note', 'You can skip this and configure quality checks later')}
</span>
</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="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
<span className="text-sm font-medium text-[var(--text-primary)]">
{t('setup_wizard:quality.added_count', { count: templates.length, defaultValue: '{{count}} quality check 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>
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
{templates.length >= 2 ? (
<div className="flex items-center gap-1 text-xs text-[var(--color-success)]">
<svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M5 13l4 4L19 7" />
</svg>
Implement Phase 1: Post-onboarding configuration system This commit implements the first phase of the post-onboarding configuration system based on JTBD analysis: **1. Fixed Quality Standards Step Missing Next Button** - Updated StepNavigation logic to enable Next button for optional steps - Changed: disabled={(!canContinue && !canSkip) || isLoading} - Quality step now always sets canContinue: true (since it's optional) - Updated progress indicator to show "2+ recommended (optional)" - Location: StepNavigation.tsx, QualitySetupStep.tsx **2. Implemented Configuration Progress Widget** A comprehensive dashboard widget that guides post-onboarding configuration: Features: - Real-time progress tracking (% complete calculation) - Section-by-section status (Inventory, Suppliers, Recipes, Quality) - Visual indicators: checkmarks for complete, circles for incomplete - Minimum requirements vs recommended amounts - Next action prompts ("Add at least 3 ingredients") - Feature unlock notifications ("Purchase Orders unlocked!") - Clickable sections that navigate to configuration pages - Auto-hides when 100% configured Location: ConfigurationProgressWidget.tsx (340 lines) Integration: DashboardPage.tsx **Configuration Logic:** - Inventory: 3 minimum, 10 recommended - Suppliers: 1 minimum, 3 recommended - Recipes: 1 minimum, 3 recommended - Quality: 0 minimum (optional), 2 recommended **UX Improvements:** - Clear orientation ("Complete Your Bakery Setup") - Progress bar with percentage - Next step call-to-action - Visual hierarchy (gradient borders, icons, colors) - Responsive design - Loading states **Technical Implementation:** - React hooks: useMemo for calculations - Real-time data fetching from inventory, suppliers, recipes, quality APIs - Automatic progress recalculation on data changes - Navigation integration with react-router - i18n support for all text **Files Created:** - ConfigurationProgressWidget.tsx **Files Modified:** - StepNavigation.tsx - Fixed optional step button logic - QualitySetupStep.tsx - Always allow continuing (optional step) - DashboardPage.tsx - Added configuration widget **Pending (Next Phases):** - Phase 2: Recipe & Supplier Wizard Modals (multi-step forms) - Phase 3: Recipe templates, bulk operations, configuration recovery Build: ✅ Success (21.17s) All TypeScript validations passed.
2025-11-06 17:49:06 +00:00
{t('setup_wizard:quality.recommended_met', 'Recommended amount met')}
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
</div>
) : (
Implement Phase 1: Post-onboarding configuration system This commit implements the first phase of the post-onboarding configuration system based on JTBD analysis: **1. Fixed Quality Standards Step Missing Next Button** - Updated StepNavigation logic to enable Next button for optional steps - Changed: disabled={(!canContinue && !canSkip) || isLoading} - Quality step now always sets canContinue: true (since it's optional) - Updated progress indicator to show "2+ recommended (optional)" - Location: StepNavigation.tsx, QualitySetupStep.tsx **2. Implemented Configuration Progress Widget** A comprehensive dashboard widget that guides post-onboarding configuration: Features: - Real-time progress tracking (% complete calculation) - Section-by-section status (Inventory, Suppliers, Recipes, Quality) - Visual indicators: checkmarks for complete, circles for incomplete - Minimum requirements vs recommended amounts - Next action prompts ("Add at least 3 ingredients") - Feature unlock notifications ("Purchase Orders unlocked!") - Clickable sections that navigate to configuration pages - Auto-hides when 100% configured Location: ConfigurationProgressWidget.tsx (340 lines) Integration: DashboardPage.tsx **Configuration Logic:** - Inventory: 3 minimum, 10 recommended - Suppliers: 1 minimum, 3 recommended - Recipes: 1 minimum, 3 recommended - Quality: 0 minimum (optional), 2 recommended **UX Improvements:** - Clear orientation ("Complete Your Bakery Setup") - Progress bar with percentage - Next step call-to-action - Visual hierarchy (gradient borders, icons, colors) - Responsive design - Loading states **Technical Implementation:** - React hooks: useMemo for calculations - Real-time data fetching from inventory, suppliers, recipes, quality APIs - Automatic progress recalculation on data changes - Navigation integration with react-router - i18n support for all text **Files Created:** - ConfigurationProgressWidget.tsx **Files Modified:** - StepNavigation.tsx - Fixed optional step button logic - QualitySetupStep.tsx - Always allow continuing (optional step) - DashboardPage.tsx - Added configuration widget **Pending (Next Phases):** - Phase 2: Recipe & Supplier Wizard Modals (multi-step forms) - Phase 3: Recipe templates, bulk operations, configuration recovery Build: ✅ Success (21.17s) All TypeScript validations passed.
2025-11-06 17:49:06 +00:00
<div className="text-xs text-[var(--text-tertiary)]">
{t('setup_wizard:quality.recommended', '2+ recommended (optional)')}
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
</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>
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
{/* Templates list */}
{templates.length > 0 && (
<div className="space-y-2">
<h4 className="text-sm font-medium text-[var(--text-secondary)]">
{t('setup_wizard:quality.your_checks', 'Your Quality Checks')}
</h4>
<div className="space-y-2 max-h-80 overflow-y-auto">
{templates.map((template) => (
<div
key={template.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">
<div className="flex items-center gap-2">
<h5 className="font-medium text-[var(--text-primary)] truncate">{template.name}</h5>
{template.is_critical && (
<span className="text-xs px-2 py-0.5 bg-[var(--color-error)]/10 text-[var(--color-error)] rounded-full">
{t('quality:critical', 'Critical')}
</span>
)}
{template.is_required && (
<span className="text-xs px-2 py-0.5 bg-[var(--color-warning)]/10 text-[var(--color-warning)] rounded-full">
{t('quality:required', 'Required')}
</span>
)}
</div>
<div className="flex items-center gap-3 mt-1 text-xs text-[var(--text-secondary)]">
<span className="px-2 py-0.5 bg-[var(--bg-primary)] rounded-full">
{checkTypeOptions.find(opt => opt.value === template.check_type)?.label || template.check_type}
</span>
{template.applicable_stages && template.applicable_stages.length > 0 && (
<span>
{template.applicable_stages.length} {t('quality:stages', 'stage(s)')}
</span>
)}
</div>
</div>
</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:quality.add_check', 'Add Quality Check')}
</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="check-name" className="block text-sm font-medium text-[var(--text-primary)] mb-1">
{t('setup_wizard:quality.fields.name', 'Check Name')} <span className="text-[var(--color-error)]">*</span>
</label>
<input
id="check-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:quality.placeholders.name', 'e.g., Crust color check, Dough temperature')}
/>
{errors.name && <p className="mt-1 text-xs text-[var(--color-error)]">{errors.name}</p>}
</div>
{/* Check Type */}
<div>
<label className="block text-sm font-medium text-[var(--text-primary)] mb-2">
{t('setup_wizard:quality.fields.check_type', 'Check Type')} <span className="text-[var(--color-error)]">*</span>
</label>
<div className="grid grid-cols-2 md:grid-cols-3 gap-2">
{checkTypeOptions.map((option) => (
<button
key={option.value}
type="button"
onClick={(e) => {
e.preventDefault();
e.stopPropagation();
console.log('Check type clicked:', option.value, 'current:', formData.check_type);
setFormData(prev => ({ ...prev, check_type: option.value }));
}}
feat: Improve onboarding wizard UI, UX and dark mode support This commit implements multiple improvements to the onboarding wizard: **1. Unified UI Components:** - Created InfoCard component for consistent "why is important" blocks across all steps - Created TemplateCard component for consistent template displays - Both components use global CSS variables for proper dark mode support **2. Initial Stock Entry Step Improvements:** - Fixed title/subtitle positioning using unified InfoCard component - Fixed missing count bug in warning message (now uses {{count}} interpolation) - Fixed dark mode colors using CSS variables (--color-success, --color-info, etc.) - Changed next button title from "completar configuración" to "Continuar →" - Implemented stock creation API call using useAddStock hook - Products with stock now properly save to backend on step completion **3. Dark Mode Fixes:** - Fixed QualitySetupStep: Enhanced button selection visibility with rings and shadows - Fixed TeamSetupStep: Enhanced role selection visibility with rings and shadows - Fixed AddressAutocomplete: Replaced all hardcoded colors with CSS variables - All dropdown results, icons, and hover states now properly adapt to dark mode **4. Streamlined Wizard Flow:** - Removed POI Detection step from wizard (step previously added complexity) - POI detection now runs automatically in background after tenant registration - Non-blocking approach ensures users aren't delayed by POI detection - Removed Revision step (setup-review) as it adds no user value - Completion step is now the final step before dashboard **5. Backend Updates:** - Updated onboarding_progress.py to remove poi-detection from ONBOARDING_STEPS - Updated onboarding_progress.py to remove setup-review from ONBOARDING_STEPS - Updated step dependencies to reflect streamlined flow - POI detection documented as automatic background process All changes maintain backward compatibility and use proper TypeScript types.
2025-11-12 14:48:46 +00:00
className={`p-3 text-left border-2 rounded-lg transition-all cursor-pointer ${
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
formData.check_type === option.value
feat: Improve onboarding wizard UI, UX and dark mode support This commit implements multiple improvements to the onboarding wizard: **1. Unified UI Components:** - Created InfoCard component for consistent "why is important" blocks across all steps - Created TemplateCard component for consistent template displays - Both components use global CSS variables for proper dark mode support **2. Initial Stock Entry Step Improvements:** - Fixed title/subtitle positioning using unified InfoCard component - Fixed missing count bug in warning message (now uses {{count}} interpolation) - Fixed dark mode colors using CSS variables (--color-success, --color-info, etc.) - Changed next button title from "completar configuración" to "Continuar →" - Implemented stock creation API call using useAddStock hook - Products with stock now properly save to backend on step completion **3. Dark Mode Fixes:** - Fixed QualitySetupStep: Enhanced button selection visibility with rings and shadows - Fixed TeamSetupStep: Enhanced role selection visibility with rings and shadows - Fixed AddressAutocomplete: Replaced all hardcoded colors with CSS variables - All dropdown results, icons, and hover states now properly adapt to dark mode **4. Streamlined Wizard Flow:** - Removed POI Detection step from wizard (step previously added complexity) - POI detection now runs automatically in background after tenant registration - Non-blocking approach ensures users aren't delayed by POI detection - Removed Revision step (setup-review) as it adds no user value - Completion step is now the final step before dashboard **5. Backend Updates:** - Updated onboarding_progress.py to remove poi-detection from ONBOARDING_STEPS - Updated onboarding_progress.py to remove setup-review from ONBOARDING_STEPS - Updated step dependencies to reflect streamlined flow - POI detection documented as automatic background process All changes maintain backward compatibility and use proper TypeScript types.
2025-11-12 14:48:46 +00:00
? 'border-[var(--color-primary)] bg-[var(--color-primary)]/20 shadow-lg ring-2 ring-[var(--color-primary)]/30'
: 'border-[var(--border-secondary)] hover:border-[var(--color-primary)]/50 hover:bg-[var(--bg-secondary)]'
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
}`}
>
<div className="text-lg mb-1">{option.icon}</div>
<div className="text-xs font-medium text-[var(--text-primary)]">{option.label}</div>
</button>
))}
</div>
</div>
{/* Description */}
<div>
<label htmlFor="description" className="block text-sm font-medium text-[var(--text-primary)] mb-1">
{t('setup_wizard:quality.fields.description', 'Description')}
</label>
<textarea
id="description"
value={formData.description}
onChange={(e) => setFormData({ ...formData, description: e.target.value })}
rows={2}
className="w-full px-3 py-2 bg-[var(--bg-primary)] border border-[var(--border-secondary)] rounded-lg focus:outline-none focus:ring-2 focus:ring-[var(--color-primary)] text-[var(--text-primary)] resize-none"
placeholder={t('setup_wizard:quality.placeholders.description', 'What should be checked and why...')}
/>
</div>
{/* Applicable Stages */}
<div>
<label className="block text-sm font-medium text-[var(--text-primary)] mb-2">
{t('setup_wizard:quality.fields.stages', 'Applicable Stages')} <span className="text-[var(--color-error)]">*</span>
</label>
{errors.stages && <p className="mb-2 text-xs text-[var(--color-error)]">{errors.stages}</p>}
<div className="grid grid-cols-2 md:grid-cols-3 gap-2">
{stageOptions.map((option) => (
<button
key={option.value}
type="button"
onClick={(e) => {
e.preventDefault();
e.stopPropagation();
console.log('Stage clicked:', option.value);
const isSelected = formData.applicable_stages.includes(option.value);
setFormData(prev => ({
...prev,
applicable_stages: isSelected
? prev.applicable_stages.filter(s => s !== option.value)
: [...prev.applicable_stages, option.value]
}));
}}
feat: Improve onboarding wizard UI, UX and dark mode support This commit implements multiple improvements to the onboarding wizard: **1. Unified UI Components:** - Created InfoCard component for consistent "why is important" blocks across all steps - Created TemplateCard component for consistent template displays - Both components use global CSS variables for proper dark mode support **2. Initial Stock Entry Step Improvements:** - Fixed title/subtitle positioning using unified InfoCard component - Fixed missing count bug in warning message (now uses {{count}} interpolation) - Fixed dark mode colors using CSS variables (--color-success, --color-info, etc.) - Changed next button title from "completar configuración" to "Continuar →" - Implemented stock creation API call using useAddStock hook - Products with stock now properly save to backend on step completion **3. Dark Mode Fixes:** - Fixed QualitySetupStep: Enhanced button selection visibility with rings and shadows - Fixed TeamSetupStep: Enhanced role selection visibility with rings and shadows - Fixed AddressAutocomplete: Replaced all hardcoded colors with CSS variables - All dropdown results, icons, and hover states now properly adapt to dark mode **4. Streamlined Wizard Flow:** - Removed POI Detection step from wizard (step previously added complexity) - POI detection now runs automatically in background after tenant registration - Non-blocking approach ensures users aren't delayed by POI detection - Removed Revision step (setup-review) as it adds no user value - Completion step is now the final step before dashboard **5. Backend Updates:** - Updated onboarding_progress.py to remove poi-detection from ONBOARDING_STEPS - Updated onboarding_progress.py to remove setup-review from ONBOARDING_STEPS - Updated step dependencies to reflect streamlined flow - POI detection documented as automatic background process All changes maintain backward compatibility and use proper TypeScript types.
2025-11-12 14:48:46 +00:00
className={`p-2 text-sm text-left border-2 rounded-lg transition-all cursor-pointer ${
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
formData.applicable_stages.includes(option.value)
feat: Improve onboarding wizard UI, UX and dark mode support This commit implements multiple improvements to the onboarding wizard: **1. Unified UI Components:** - Created InfoCard component for consistent "why is important" blocks across all steps - Created TemplateCard component for consistent template displays - Both components use global CSS variables for proper dark mode support **2. Initial Stock Entry Step Improvements:** - Fixed title/subtitle positioning using unified InfoCard component - Fixed missing count bug in warning message (now uses {{count}} interpolation) - Fixed dark mode colors using CSS variables (--color-success, --color-info, etc.) - Changed next button title from "completar configuración" to "Continuar →" - Implemented stock creation API call using useAddStock hook - Products with stock now properly save to backend on step completion **3. Dark Mode Fixes:** - Fixed QualitySetupStep: Enhanced button selection visibility with rings and shadows - Fixed TeamSetupStep: Enhanced role selection visibility with rings and shadows - Fixed AddressAutocomplete: Replaced all hardcoded colors with CSS variables - All dropdown results, icons, and hover states now properly adapt to dark mode **4. Streamlined Wizard Flow:** - Removed POI Detection step from wizard (step previously added complexity) - POI detection now runs automatically in background after tenant registration - Non-blocking approach ensures users aren't delayed by POI detection - Removed Revision step (setup-review) as it adds no user value - Completion step is now the final step before dashboard **5. Backend Updates:** - Updated onboarding_progress.py to remove poi-detection from ONBOARDING_STEPS - Updated onboarding_progress.py to remove setup-review from ONBOARDING_STEPS - Updated step dependencies to reflect streamlined flow - POI detection documented as automatic background process All changes maintain backward compatibility and use proper TypeScript types.
2025-11-12 14:48:46 +00:00
? 'border-[var(--color-primary)] bg-[var(--color-primary)]/20 text-[var(--color-primary)] font-semibold shadow-md ring-1 ring-[var(--color-primary)]/30'
: 'border-[var(--border-secondary)] text-[var(--text-secondary)] hover:border-[var(--color-primary)]/50 hover:bg-[var(--bg-secondary)]'
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
}`}
>
{option.label}
</button>
))}
</div>
</div>
{/* Flags */}
<div className="space-y-2">
<label className="flex items-center gap-2 cursor-pointer">
<input
type="checkbox"
checked={formData.is_required}
onChange={(e) => setFormData({ ...formData, is_required: e.target.checked })}
className="w-4 h-4 text-[var(--color-primary)] rounded focus:ring-2 focus:ring-[var(--color-primary)]"
/>
<span className="text-sm text-[var(--text-primary)]">
{t('setup_wizard:quality.fields.required', 'Required check (must be completed)')}
</span>
</label>
<label className="flex items-center gap-2 cursor-pointer">
<input
type="checkbox"
checked={formData.is_critical}
onChange={(e) => setFormData({ ...formData, is_critical: e.target.checked })}
className="w-4 h-4 text-[var(--color-error)] rounded focus:ring-2 focus:ring-[var(--color-error)]"
/>
<span className="text-sm text-[var(--text-primary)]">
{t('setup_wizard:quality.fields.critical', 'Critical check (failure stops production)')}
</span>
</label>
</div>
</div>
Fix multiple onboarding and navigation issues **1. Remove duplicate navigation buttons in SetupWizard** - Removed external navigation footer from SetupWizard (lines 370-383) - All setup wizard steps now have only internal navigation buttons - Prevents confusion with double Continue buttons in onboarding **2. Fix quality template API call failure** - Fixed userId validation in QualitySetupStep:17 - Changed from defaulting to empty string to undefined - Added validation check before API call to prevent UUID errors - Disabled submit button when userId not available - Added error message display for missing user Related: frontend/src/components/domain/setup-wizard/steps/QualitySetupStep.tsx:17,51-54,376 **3. Delete regular tours implementation (keep demo tour)** Removed custom tours system while preserving demo tour functionality: - Deleted TourContext.tsx and TourProvider - Deleted Tour UI components folder - Deleted tours/tours.ts definitions - Deleted tour.json translations - Removed TourProvider from App.tsx - Removed TourButton from Sidebar Demo tour (useDemoTour, driver.js) remains intact and functional. Files deleted: - frontend/src/contexts/TourContext.tsx - frontend/src/components/ui/Tour/* (all files) - frontend/src/tours/tours.ts - frontend/src/locales/es/tour.json **4. Issues verified/confirmed:** - Quality type select UI already working (callback setState pattern) - Inventory lots UI confirmed present in InventorySetupStep:683,788,833 - Lots UI visible after adding ingredients in onboarding flow **Build Status:** ✓ All changes verified, build successful in 21.95s
2025-11-06 21:26:09 +00:00
{errors.form && (
<div className="p-3 bg-[var(--color-error)]/10 border border-[var(--color-error)]/20 rounded-lg text-sm text-[var(--color-error)]">
{errors.form}
</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
<div className="flex gap-2 pt-2">
<button
type="submit"
Fix multiple onboarding and navigation issues **1. Remove duplicate navigation buttons in SetupWizard** - Removed external navigation footer from SetupWizard (lines 370-383) - All setup wizard steps now have only internal navigation buttons - Prevents confusion with double Continue buttons in onboarding **2. Fix quality template API call failure** - Fixed userId validation in QualitySetupStep:17 - Changed from defaulting to empty string to undefined - Added validation check before API call to prevent UUID errors - Disabled submit button when userId not available - Added error message display for missing user Related: frontend/src/components/domain/setup-wizard/steps/QualitySetupStep.tsx:17,51-54,376 **3. Delete regular tours implementation (keep demo tour)** Removed custom tours system while preserving demo tour functionality: - Deleted TourContext.tsx and TourProvider - Deleted Tour UI components folder - Deleted tours/tours.ts definitions - Deleted tour.json translations - Removed TourProvider from App.tsx - Removed TourButton from Sidebar Demo tour (useDemoTour, driver.js) remains intact and functional. Files deleted: - frontend/src/contexts/TourContext.tsx - frontend/src/components/ui/Tour/* (all files) - frontend/src/tours/tours.ts - frontend/src/locales/es/tour.json **4. Issues verified/confirmed:** - Quality type select UI already working (callback setState pattern) - Inventory lots UI confirmed present in InventorySetupStep:683,788,833 - Lots UI visible after adding ingredients in onboarding flow **Build Status:** ✓ All changes verified, build successful in 21.95s
2025-11-06 21:26:09 +00:00
disabled={createTemplateMutation.isPending || !userId}
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
className="px-4 py-2 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"
>
{createTemplateMutation.isPending ? (
<span className="flex items-center gap-2">
<svg className="animate-spin h-4 w-4" fill="none" viewBox="0 0 24 24">
<circle className="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="4" />
<path className="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" />
</svg>
{t('common:saving', 'Saving...')}
</span>
) : (
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">
{templates.length === 0
? t('setup_wizard:quality.add_first', 'Add Your First Quality Check')
: t('setup_wizard:quality.add_another', 'Add Another Quality Check')}
</span>
</div>
</button>
)}
{/* Loading state */}
{isLoading && templates.length === 0 && (
<div className="text-center py-8">
<svg className="animate-spin h-8 w-8 text-[var(--color-primary)] mx-auto" fill="none" viewBox="0 0 24 24">
<circle className="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="4" />
<path className="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" />
</svg>
<p className="mt-2 text-sm text-[var(--text-secondary)]">
{t('common:loading', 'Loading...')}
</p>
</div>
)}
Architect navigation buttons correctly: move from wizard-level to step-level Fixed the navigation architecture to follow proper onboarding patterns: **ARCHITECTURE CHANGE:** - REMOVED: External navigation footer from UnifiedOnboardingWizard (Back + Continue buttons at wizard level) - ADDED: Internal Continue buttons inside each setup wizard step component **WHY THIS MATTERS:** 1. Onboarding should NEVER show Back buttons (users cannot go back) 2. Each step should be self-contained with its own Continue button 3. Setup wizard steps are reused in both contexts: - SetupWizard (/app/setup): Uses external StepNavigation component - UnifiedOnboardingWizard: Steps now render their own buttons **CHANGES MADE:** 1. UnifiedOnboardingWizard.tsx: - Removed navigation footer (lines 548-588) - Now passes canContinue prop to steps - Steps are responsible for their own navigation 2. All setup wizard steps updated: - QualitySetupStep: Added onComplete, canContinue props + Continue button - SuppliersSetupStep: Modified existing button to call onComplete - InventorySetupStep: Added onComplete, canContinue props + Continue button - RecipesSetupStep: Added canContinue prop + Continue button - TeamSetupStep: Added onComplete, canContinue props + Continue button - ReviewSetupStep: Added onComplete, canContinue props + Continue button 3. Continue button pattern: - Only renders when onComplete prop exists (onboarding context) - Disabled based on canContinue prop from parent - Styled consistently across all steps - Positioned at bottom with border-top separator **RESULT:** - Clean separation: onboarding steps have internal buttons, no external navigation - No Back button in onboarding (as required) - Setup wizard still works with external StepNavigation - Consistent UX across all steps
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()}
Architect navigation buttons correctly: move from wizard-level to step-level Fixed the navigation architecture to follow proper onboarding patterns: **ARCHITECTURE CHANGE:** - REMOVED: External navigation footer from UnifiedOnboardingWizard (Back + Continue buttons at wizard level) - ADDED: Internal Continue buttons inside each setup wizard step component **WHY THIS MATTERS:** 1. Onboarding should NEVER show Back buttons (users cannot go back) 2. Each step should be self-contained with its own Continue button 3. Setup wizard steps are reused in both contexts: - SetupWizard (/app/setup): Uses external StepNavigation component - UnifiedOnboardingWizard: Steps now render their own buttons **CHANGES MADE:** 1. UnifiedOnboardingWizard.tsx: - Removed navigation footer (lines 548-588) - Now passes canContinue prop to steps - Steps are responsible for their own navigation 2. All setup wizard steps updated: - QualitySetupStep: Added onComplete, canContinue props + Continue button - SuppliersSetupStep: Modified existing button to call onComplete - InventorySetupStep: Added onComplete, canContinue props + Continue button - RecipesSetupStep: Added canContinue prop + Continue button - TeamSetupStep: Added onComplete, canContinue props + Continue button - ReviewSetupStep: Added onComplete, canContinue props + Continue button 3. Continue button pattern: - Only renders when onComplete prop exists (onboarding context) - Disabled based on canContinue prop from parent - Styled consistently across all steps - Positioned at bottom with border-top separator **RESULT:** - Clean separation: onboarding steps have internal buttons, no external navigation - No Back button in onboarding (as required) - Setup wizard still works with external StepNavigation - Consistent UX across all steps
2025-11-06 19:55:42 +00:00
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>
);
};