A tool-driven inventory overlay — a three.js rack you cycle with ◀ ▶ and open with USE. Registry-based (not tied to a level type) so new tools just add a model + component. Reuses the phone's 3D model; notebook is a blocky placeholder tool. Dev route /?inventory=1; drop <Inventory/> into the navbar after the merges. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
22 lines
1.1 KiB
TypeScript
22 lines
1.1 KiB
TypeScript
import { StrictMode, Suspense, lazy } from 'react'
|
|
import { createRoot } from 'react-dom/client'
|
|
import { App } from './App'
|
|
import { Play } from './play'
|
|
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 })))
|
|
|
|
// 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.
|
|
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>)
|