Files
gupi-osint-board/src/main.tsx
T

22 lines
1.1 KiB
TypeScript
Raw Normal View History

import { StrictMode, Suspense, lazy } from 'react'
2026-08-14 12:43:11 +02:00
import { createRoot } from 'react-dom/client'
import { App } from './App'
2026-08-22 15:12:56 +02:00
import { Play } from './play'
2026-08-14 12:43:11 +02:00
import './styles.css'
// three.js is lazy-loaded so the board never pays for it up front.
const PhonePreview = lazy(() => import('./phone').then(m => ({ default: m.PhonePreview })))
const Inventory = lazy(() => import('./inventory').then(m => ({ default: m.Inventory })))
2026-08-22 15:12:56 +02:00
// Routing: the bare root is the game's front door (splash + campaign); /level/:id,
// /admin, and the legacy ?level= deep link open the board; ?phone / ?inventory spikes.
2026-08-22 15:12:56 +02:00
const path = window.location.pathname
const search = new URLSearchParams(window.location.search)
const isBoard = path.startsWith('/level/') || path === '/admin' || search.has('level')
const root = search.has('phone')
? <Suspense fallback={null}><PhonePreview /></Suspense>
: search.has('inventory')
? <Suspense fallback={null}><Inventory /></Suspense>
: isBoard ? <App /> : <Play />
createRoot(document.getElementById('root')!).render(<StrictMode>{root}</StrictMode>)