Horux360
Pantalla de inicio
Bienvenido a Horux360
Revisa este breve video para conocer el flujo. Después podrás continuar.
Redirigiendo al dashboard…
Usuario recurrente detectado.
'use client'; import { useEffect, useMemo, useState } from 'react'; import { useRouter } from 'next/navigation'; import { useAuthStore } from '@/stores/auth-store'; /** * Onboarding persistence key. * If you later want this to come from env/config, move it to apps/web/config/onboarding.ts */ const STORAGE_KEY = 'horux360:onboarding_seen_v1'; export default function OnboardingScreen() { const router = useRouter(); const { isAuthenticated, _hasHydrated } = useAuthStore(); const [isNewUser, setIsNewUser] = useState(true); const [loading, setLoading] = useState(false); const safePush = (path: string) => { // Avoid multiple navigations if user clicks quickly. if (loading) return; setLoading(true); router.push(path); }; // Redirect to login if not authenticated useEffect(() => { if (_hasHydrated && !isAuthenticated) { router.push('/login'); } }, [isAuthenticated, _hasHydrated, router]); useEffect(() => { const seen = typeof window !== 'undefined' && localStorage.getItem(STORAGE_KEY) === '1'; // If the user has already seen onboarding, go to dashboard automatically. if (seen) { setIsNewUser(false); setLoading(true); const t = setTimeout(() => router.push('/dashboard'), 900); return () => clearTimeout(t); } }, [router]); const handleContinue = () => { if (typeof window !== 'undefined') localStorage.setItem(STORAGE_KEY, '1'); setLoading(true); setTimeout(() => router.push('/dashboard'), 700); }; const handleReset = () => { if (typeof window !== 'undefined') localStorage.removeItem(STORAGE_KEY); location.reload(); }; const headerStatus = useMemo(() => (isNewUser ? 'Onboarding' : 'Redirección'), [isNewUser]); // Show loading while store hydrates if (!_hasHydrated) { return (
Horux360
Pantalla de inicio
Revisa este breve video para conocer el flujo. Después podrás continuar.
Usuario recurrente detectado.