import { useEffect, useRef } from 'react'; import { Link, useNavigate, useLocation } from 'react-router-dom'; import { ArrowLeft, Home, FileQuestion } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { useAuth } from '@/hooks/useAuth'; // Animated digit — cycles through random numbers before settling function GlitchDigit({ value, delay = 0 }) { const ref = useRef(null); useEffect(() => { const el = ref.current; if (!el) return; const frames = 14; const digits = '0123456789'; let frame = 0; let start = null; function tick(ts) { if (!start) start = ts + delay; const elapsed = ts - start; if (elapsed < 0) { requestAnimationFrame(tick); return; } if (frame < frames) { el.textContent = digits[Math.floor(Math.random() * 10)]; frame++; setTimeout(() => requestAnimationFrame(tick), 40 + frame * 6); } else { el.textContent = value; el.classList.add('settled'); } } requestAnimationFrame(tick); }, [value, delay]); return ( {value} ); } export default function NotFoundPage() { const { user } = useAuth(); const navigate = useNavigate(); const location = useLocation(); const canGoBack = window.history.length > 1; const badPath = location.pathname; return (
{badPath !== '/'
? <>The page {badPath} doesn't exist.>
: <>That page doesn't exist.>
}
{' '}Check the URL or head back somewhere useful.
error 404 · page not found