// ================================================================ // frontend/src/components/dashboard/SetupWizardBlocker.tsx // ================================================================ /** * Setup Wizard Blocker - Critical Path Onboarding * * JTBD: "I cannot operate my bakery without basic configuration" * * This component blocks the entire dashboard when critical setup is incomplete. * Shows a full-page wizard to guide users through essential configuration. * * Triggers when: * - 0-2 critical sections complete (<50% progress) * - Missing: Ingredients (<3) OR Suppliers (<1) OR Recipes (<1) */ import React, { useMemo } from 'react'; import { useNavigate } from 'react-router-dom'; import { useTranslation } from 'react-i18next'; import { AlertCircle, Package, Users, BookOpen, ChevronRight, CheckCircle2, Circle } from 'lucide-react'; interface SetupSection { id: string; title: string; description: string; icon: React.ElementType; path: string; isComplete: boolean; count: number; minimum: number; } interface SetupWizardBlockerProps { criticalSections: SetupSection[]; onComplete?: () => void; } export function SetupWizardBlocker({ criticalSections = [], onComplete }: SetupWizardBlockerProps) { const { t } = useTranslation(['dashboard', 'common']); const navigate = useNavigate(); // Calculate progress const { completedCount, totalCount, progressPercentage, nextSection } = useMemo(() => { // Guard against undefined or invalid criticalSections if (!criticalSections || !Array.isArray(criticalSections) || criticalSections.length === 0) { return { completedCount: 0, totalCount: 0, progressPercentage: 0, nextSection: undefined, }; } const completed = criticalSections.filter(s => s.isComplete).length; const total = criticalSections.length; const percentage = Math.round((completed / total) * 100); const next = criticalSections.find(s => !s.isComplete); return { completedCount: completed, totalCount: total, progressPercentage: percentage, nextSection: next, }; }, [criticalSections]); const handleSectionClick = (path: string) => { navigate(path); }; return (
{t('dashboard:setup_blocker.subtitle', 'Necesitas completar la configuración básica antes de usar el panel de control')}
{nextSection.description}
💡 {t('dashboard:setup_blocker.help_text', 'Una vez completes estos pasos, podrás acceder al panel de control completo y comenzar a usar todas las funciones de IA')}