// The terminal app's root (plan steps 3.1b, 3.1c; APPS_PLATFORM D-2, D-8, §9): one web app
// for every paired screen, served on :8082 (LAN only).
// DeviceProvider the device (pairing, GET /api/devices/me), who is signed in, the live
// connection, offline
// AccessProvider platform bootstrap (venue, language, modules, keys) for that session;
// retries by itself while the server can't be reached (unattended screens)
// Terminal pairing → sign-in → the device's own app, or a "can't run" screen
// The screen follows the device, not the URL; only the dev pages have routes.
import { lazy, Suspense, useEffect } from 'react'
import { BrowserRouter, Route, Routes } from 'react-router-dom'
import { AccessProvider, useAccess } from '@xenia/access'
import { createI18n } from '@xenia/i18n'
import { applyVenueTheme, Spinner, ToastProvider } from '@xenia/ui'
import client from './api/client'
import DeviceProvider from './device/DeviceProvider'
import { useDevice } from './device/context'
import Terminal from './screens/Terminal'
const i18n = createI18n({ defaultNS: 'terminal' })
// Visual check pages for the shared packages, dev builds only (CS-16)
const UiGallery = import.meta.env.DEV ? lazy(() => import('@xenia/ui/gallery')) : null
const I18nSample = import.meta.env.DEV ? lazy(() => import('@xenia/i18n/sample')) : null
const loading =
const AUTO_RETRY_MS = 5_000
function Root() {
const { sessionKey } = useDevice()
return (
)
}
/** The venue's own colour as the accent of every screen when the venue chose it (6R.20, Settings →
* Venue → "The venue's identity"); otherwise the screens keep their own accent. */
function VenueAccent() {
const venue = useAccess()?.venue
const colour = venue?.theme === 'identity' ? venue?.identity?.colour : null
useEffect(() => { applyVenueTheme(colour ? 'identity' : null, colour) }, [colour])
return null
}
export default function App() {
return (
{UiGallery && } />}
{I18nSample && } />}
} />
)
}