import { StrictMode, useState, useEffect } from 'react' import { createRoot } from 'react-dom/client' import './index.css' import App from './App.jsx' import Landing from './Landing.jsx' import Legal from './Legal.jsx' import { AuthProvider, useAuth } from './contexts/AuthContext' import { capture as captureAttribution } from './lib/attribution' import PricingPage from './components/PricingPage' import AccountPage from './components/AccountPage' import LoginModal from './components/LoginModal' function PageShell({ title, children }) { return (
OpenShorts ← Back to app
{title &&

{title}

} {children}
); } function PricingView() { const [showLogin, setShowLogin] = useState(false); return ( setShowLogin(true)} /> {showLogin && setShowLogin(false)} />} ); } function AccountView() { const { isSignedIn, loading } = useAuth(); useEffect(() => { if (!loading && !isSignedIn) window.location.hash = '#/pricing'; }, [loading, isSignedIn]); return ; } function Root() { const resolveView = () => { const hash = window.location.hash || ''; if (hash.startsWith('#/auth/')) return 'auth'; // AuthContext consumes then redirects if (hash.startsWith('#/account')) return 'account'; if (hash.startsWith('#/pricing')) return 'pricing'; if (hash === '#legal') return 'legal'; // #landing = explicit landing view (app logo); section anchors keep the landing mounted if (['#landing', '#features', '#how-it-works', '#pricing', '#comparison', '#faq'].includes(hash)) return 'landing'; if (hash === '#app' || localStorage.getItem('openshorts_skip_landing') === '1') return 'app'; return 'landing'; }; const [view, setView] = useState(resolveView); useEffect(() => { const handleHashChange = () => setView(resolveView()); window.addEventListener('hashchange', handleHashChange); return () => window.removeEventListener('hashchange', handleHashChange); }, []); const handleLaunchApp = () => { localStorage.setItem('openshorts_skip_landing', '1'); window.location.hash = '#app'; setView('app'); }; if (view === 'legal') return ; if (view === 'pricing') return ; if (view === 'account') return ; if (view === 'auth') { return
Signing you in…
; } if (view === 'app') return ; return ; } // Before React mounts: AuthContext rewrites the URL on auth redirects, which // would destroy the referrer and any UTM params we still need to read. captureAttribution(); createRoot(document.getElementById('root')).render( , )