Start integrating the onboarding flow with backend 12
This commit is contained in:
@@ -1,14 +1,13 @@
|
||||
import React, { useEffect } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { OnboardingWizard, OnboardingStep } from '../../../components/domain/onboarding/OnboardingWizard';
|
||||
import { useOnboarding } from '../../../hooks/business/onboarding';
|
||||
import { useOnboarding, useAutoResume } from '../../../hooks/business/onboarding';
|
||||
import { useAuthUser, useIsAuthenticated } from '../../../stores/auth.store';
|
||||
import { LoadingSpinner } from '../../../components/shared/LoadingSpinner';
|
||||
|
||||
// Step Components
|
||||
import { BakerySetupStep } from '../../../components/domain/onboarding/steps/BakerySetupStep';
|
||||
import { HistoricalSalesValidationStep } from '../../../components/domain/onboarding/steps/HistoricalSalesValidationStep';
|
||||
import { InventorySetupStep } from '../../../components/domain/onboarding/steps/InventorySetupStep';
|
||||
import { SmartInventorySetupStep } from '../../../components/domain/onboarding/steps/SmartInventorySetupStep';
|
||||
import { SuppliersStep } from '../../../components/domain/onboarding/steps/SuppliersStep';
|
||||
import { MLTrainingStep } from '../../../components/domain/onboarding/steps/MLTrainingStep';
|
||||
import { CompletionStep } from '../../../components/domain/onboarding/steps/CompletionStep';
|
||||
@@ -18,6 +17,9 @@ const OnboardingPage: React.FC = () => {
|
||||
const user = useAuthUser();
|
||||
const isAuthenticated = useIsAuthenticated();
|
||||
|
||||
// Use auto-resume functionality
|
||||
const autoResume = useAutoResume();
|
||||
|
||||
// Use the onboarding business hook
|
||||
const {
|
||||
currentStep,
|
||||
@@ -42,8 +44,7 @@ const OnboardingPage: React.FC = () => {
|
||||
// Map steps to components
|
||||
const stepComponents: { [key: string]: React.ComponentType<any> } = {
|
||||
'setup': BakerySetupStep,
|
||||
'sales-validation': HistoricalSalesValidationStep,
|
||||
'inventory': InventorySetupStep,
|
||||
'smart-inventory-setup': SmartInventorySetupStep,
|
||||
'suppliers': SuppliersStep,
|
||||
'ml-training': MLTrainingStep,
|
||||
'completion': CompletionStep
|
||||
@@ -104,11 +105,15 @@ const OnboardingPage: React.FC = () => {
|
||||
};
|
||||
}, [error, clearError]);
|
||||
|
||||
// Show loading while processing
|
||||
if (isLoading) {
|
||||
// Show loading while processing or checking for saved progress
|
||||
if (isLoading || autoResume.isCheckingResume) {
|
||||
const message = autoResume.isCheckingResume
|
||||
? "Verificando progreso guardado..."
|
||||
: "Procesando...";
|
||||
|
||||
return (
|
||||
<div className="min-h-screen flex items-center justify-center">
|
||||
<LoadingSpinner size="lg" message="Procesando..." />
|
||||
<LoadingSpinner size="lg" message={message} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user