- Waiter: Bookings (side drawer, for whoever has connect_orders.manage or reservations.manage, with the online-orders app on): requests made online are confirmed or declined with a reason the guest sees; confirmed ones are seated at a free table (its seats shown, a warning mark when the party is bigger) or cancelled / marked as a no-show; the food ordered ahead and its kitchen time; live updates. - Backend: the bookings routes take reservations.manage too (require_any). - @xenia/ui ReasonPicker + reasonText (gallery, unit test), first piece moved from the terminal (4.6 → 4.8): the counter's online reject and booking decline dialogs use it; the waiter loads @xenia/ui styles.css (the .x-* components; tokens as before). - Tests: waiter e2e +2 (request listed with the key, confirmed and seated from the phone); terminal.mjs and qr_table.mjs green. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
38 lines
1.8 KiB
React
38 lines
1.8 KiB
React
import { StrictMode } from 'react'
|
|
import { createRoot } from 'react-dom/client'
|
|
import '@xenia/ui/styles.css' // shared --x-* tokens (the waiter's --bg/--text… are made of them, 4.6) + the .x-* components (4.8)
|
|
import './index.css'
|
|
|
|
// The theme before anything renders (no light flash on a dark phone): the user's light/dark
|
|
// (themeStore, default dark) and the waiter's default accent until bootstrap says the venue's.
|
|
try {
|
|
const saved = JSON.parse(localStorage.getItem('pos-theme') || 'null')
|
|
document.documentElement.setAttribute('data-theme', saved?.state?.dark === false ? 'light' : 'dark')
|
|
} catch { document.documentElement.setAttribute('data-theme', 'dark') }
|
|
document.documentElement.setAttribute('data-venue-theme', 'amber')
|
|
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>,
|
|
)
|
|
})
|