import { StrictMode, useState, useEffect, lazy, Suspense } from 'react' import { createRoot } from 'react-dom/client' import './index.css' import { AuthProvider } from './contexts/AuthContext' import { applyConsent } from './lib/consent' import CookieBanner from './components/CookieBanner' const App = lazy(() => import('./App.jsx')) const Legal = lazy(() => import('./Legal.jsx')) // Boot straight into the app. Only #legal is still a distinct view; every // other hash (including #app, #app?…) renders App. function Root() { const [isLegal, setIsLegal] = useState(() => window.location.hash === '#legal') useEffect(() => { const handleHashChange = () => setIsLegal(window.location.hash === '#legal') window.addEventListener('hashchange', handleHashChange) return () => window.removeEventListener('hashchange', handleHashChange) }, []) return isLegal ? : } // Start whatever the visitor previously agreed to. Nothing at all on a first // visit: index.html only publishes the analytics initialiser, it never runs it. applyConsent(); createRoot(document.getElementById('root')).render( loading…}> , )