Files
xenia-pos-local/waiter_pwa/src/main.jsx
T
bonaminandClaude Opus 5.5 3580f2815c feat(ui): @xenia/ui design tokens, Tailwind preset and base components
Platform-v2 step 2.3 (APPS_PLATFORM D-15 §9):
- tokens.css: --x- prefixed colours (light/dark/system + 5 venue accent themes),
  spacing, radius, type scale, shadows, motion, z-index; variables only
- components.css: .x-* classes only, no element selectors (new rule CS-16)
- Button, IconButton, Dialog, Sheet, Toast, PinPad, InfoTip, EmptyState,
  Spinner, Field/Input/Textarea/Select, Switch (accessible: focus trap and
  restore, ARIA wiring, 44px targets)
- tailwind-preset.js (adds names only); manager uses it + styles.css, the
  waiter imports tokens.css; existing screens unchanged
- dev-only /ui-gallery in the manager; e2e suite tests/e2e/ui.mjs; unit tests
  for PIN rules and WCAG AA contrast of every token pair, both in run-all

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 19:33:58 +02:00

30 lines
1.3 KiB
React

import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import '@xenia/ui/tokens.css' // shared --x-* tokens; the waiter's own --bg/--text… stay as they are
import './index.css'
import App from './App.jsx'
import db from './db/posdb.js'
import { deliveryMode, getActiveVenue } from './config/server'
// Ensure the IndexedDB schema is fully open before any component mounts.
// Without this, table accessors (db.tables, db.orders, etc.) can be undefined
// when components try to use them synchronously on first render.
//
// Native app before pairing: there is no venue yet, so don't create a database
// under the wrong (un-namespaced) name — App renders only the pairing screen.
const native = deliveryMode() === 'native'
if (native) {
import('./native/backButton').then(m => m.installBackButtonHandler())
}
// Native: hand the paired venues' TLS key pins to the WebView before any request
const trust = native ? import('./native/tls').then(m => m.syncTrustedKeys()) : Promise.resolve()
const ready = trust.then(() => (native && !getActiveVenue() ? null : db.open()))
ready.catch(err => console.error('[IDB] open failed:', err)).finally(() => {
createRoot(document.getElementById('root')).render(
<StrictMode>
<App />
</StrictMode>,
)
})