import { Navigate } from 'react-router-dom'; import { useAuth } from '@/hooks/useAuth'; import { useLearningJourney } from '@/hooks/useLearningJourney'; import { PageSkeleton } from '@/components/skeletons'; /** * Entry router at "/". * Routes the learner to the correct step of the single product journey. */ export function HomeRedirect() { const { effectiveUserId, guestSessionHydrated } = useAuth(); const { progress, loading } = useLearningJourney(effectiveUserId ?? undefined); if (!guestSessionHydrated || (effectiveUserId && loading)) { return ; } if (!effectiveUserId) { return ; } if (!progress?.pre_test_completed_at) { return ; } if (!progress?.training_completed_at) { return ; } if (!progress?.post_test_completed_at) { return ; } return ; }