import { lazy, Suspense } from 'react'; import { createRoot } from 'react-dom/client'; import App from './App'; import ErrorBoundary from './components/ErrorBoundary'; import './styles.css'; // Proofing galleries and invite pages are public and self-contained: loading // them lazily keeps the editor out of the chunk a client downloads to view a // shoot, and keeps the invite page tiny. const ProofingGallery = lazy(() => import('./components/ProofingGallery')); const JoinPage = lazy(() => import('./components/JoinPage')); const root = document.getElementById('root'); if (!root) throw new Error('root element missing'); // Proofing links are public: /g/ renders the gallery straight away and // never mounts the editor or asks for a session. const galleryMatch = /^\/g\/([A-Za-z0-9_-]+)\/?$/.exec(window.location.pathname); // Invite links are public too: the token decides whether signup is allowed. const joinMatch = /^\/join\/([A-Za-z0-9_-]+)\/?$/.exec(window.location.pathname); createRoot(root).render( {galleryMatch ? ( ) : joinMatch ? ( ) : ( )} , );