Fix issues

This commit is contained in:
Urtzi Alfaro
2025-08-17 10:28:58 +02:00
parent 8914786973
commit 109961ef6e
10 changed files with 450 additions and 176 deletions

View File

@@ -1,5 +1,7 @@
import React, { useState, useEffect, useCallback, useRef } from 'react';
import { ChevronLeft, ChevronRight, Upload, MapPin, Store, Check, Brain, Clock, CheckCircle, AlertTriangle, Loader, TrendingUp } from 'lucide-react';
import { useNavigate } from 'react-router-dom';
import { useSelector } from 'react-redux';
import toast from 'react-hot-toast';
import SimplifiedTrainingProgress from '../../components/SimplifiedTrainingProgress';
@@ -16,10 +18,11 @@ import {
import { useTraining } from '../../api/hooks/useTraining';
import { OnboardingRouter } from '../../utils/onboardingRouter';
import type { RootState } from '../../store';
interface OnboardingPageProps {
user: any;
onComplete: () => void;
user?: any;
onComplete?: () => void;
}
interface BakeryData {
@@ -48,7 +51,16 @@ const MADRID_PRODUCTS = [
'Chocolate caliente', 'Zumos', 'Bocadillos', 'Empanadas', 'Tartas'
];
const OnboardingPage: React.FC<OnboardingPageProps> = ({ user, onComplete }) => {
const OnboardingPage: React.FC<OnboardingPageProps> = ({ user: propUser, onComplete: propOnComplete }) => {
const navigate = useNavigate();
const { user: reduxUser } = useSelector((state: RootState) => state.auth);
// Use prop user if provided, otherwise use Redux user
const user = propUser || reduxUser;
// Use prop onComplete if provided, otherwise navigate to dashboard
const onComplete = propOnComplete || (() => navigate('/app/dashboard'));
const [currentStep, setCurrentStep] = useState(1);
const [isLoading, setIsLoading] = useState(false);
const manualNavigation = useRef(false);