feat(waiter): the waiter app on the shared foundations (api client, access, i18n), lint clean, starts offline

Plan step 4.1. No visible change to layout or flows.
- api/client.js on @xenia/api createApiClient (CS-8 baseURL, 401 → sign out, no answer →
  backend-offline, err.xenia, the manager-approval retry); the PIN login handles its own 401
  (before, a wrong PIN reloaded the page).
- <AccessProvider> at the root with an i18n instance: modules, permission keys, venue,
  language from bootstrap; who is signed in comes with it (no more /api/auth/me polling).
  packages/access: AccessProvider gains `cache` (the last bootstrap per session; used when
  the server can't be reached, `offline` in the context, keeps retrying) and `failed` (the
  app's own screen when there's nothing cached). The waiter caches per venue, shows its
  offline page (server search) on a first start without a server, retries every 5 s;
  ServerRediscovery and BundleSync run outside the bootstrap.
- Role names → keys: the shift gate and the user menu use core.dashboard.access.
- One shared, offline-cached read of the venue settings (api/venueSettings.js) instead of
  seven GET /api/settings/ calls; apiError() shows backend error codes in the user's
  language (17 places).
- Lint: 78 errors → 0 (unused code, empty catches, two duplicate style keys, a component
  created during render, refs read during render → state, hooks after an early return);
  set-state-in-effect is a warning like the manager/terminal; lint in run-all.
- Tests: tests/bootstrapCache.test.mjs; e2e browser: an offline restart stays signed in.
  Android rediscovery waits for what the screen shows instead of fixed sleeps: 10/10 three
  runs in a row (KI-009). Terminal 3.4 waits for both displays before the sale.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-16 11:37:47 +02:00
co-authored by Claude Opus 5.5
parent f85894a72e
commit 9f5498332a
41 changed files with 389 additions and 213 deletions
+14 -12
View File
@@ -812,12 +812,14 @@ function PloigisiTab() {
// ── Icon Navbar drag state ────────────────────────────────────────────────────
const dragKey = useRef(null)
const [dragging, setDragging] = useState(null) // drawn dimmed while dragged (refs aren't read in render)
const touchDragKey = useRef(null)
const itemRefs = useRef({})
const [dropIndex, setDropIndex] = useState(null)
// ── Triple Pill drag state ────────────────────────────────────────────────────
const triDragKey = useRef(null)
const [triDragging, setTriDragging] = useState(null)
const triTouchDragKey = useRef(null)
const triItemRefs = useRef({})
const [triDropIndex, setTriDropIndex] = useState(null)
@@ -865,45 +867,45 @@ function PloigisiTab() {
}
// ── Icon Navbar drag handlers ────────────────────────────────────────────────
function onDragStart(key) { dragKey.current = key }
function onDragStart(key) { dragKey.current = key; setDragging(key) }
function onDragOverContainer(e, items) {
e.preventDefault()
setDropIndex(computeDropIndex(e.clientY, itemRefs, items))
}
function onDropContainer(items) {
applyReorder(dragKey.current, dropIndex, items, setNavItems)
dragKey.current = null; setDropIndex(null)
dragKey.current = null; setDragging(null); setDropIndex(null)
}
function onDragEnd() { dragKey.current = null; setDropIndex(null) }
function onTouchStart(e, key) { touchDragKey.current = key }
function onDragEnd() { dragKey.current = null; setDragging(null); setDropIndex(null) }
function onTouchStart(e, key) { touchDragKey.current = key; setDragging(key) }
function onTouchMove(e, items) {
e.preventDefault()
setDropIndex(computeDropIndex(e.touches[0].clientY, itemRefs, items))
}
function onTouchEnd(items) {
applyReorder(touchDragKey.current, dropIndex, items, setNavItems)
touchDragKey.current = null; setDropIndex(null)
touchDragKey.current = null; setDragging(null); setDropIndex(null)
}
// ── Triple Pill drag handlers ────────────────────────────────────────────────
function triOnDragStart(key) { triDragKey.current = key }
function triOnDragStart(key) { triDragKey.current = key; setTriDragging(key) }
function triOnDragOver(e, items) {
e.preventDefault()
setTriDropIndex(computeDropIndex(e.clientY, triItemRefs, items))
}
function triOnDrop(items) {
applyReorder(triDragKey.current, triDropIndex, items, setTripleItems)
triDragKey.current = null; setTriDropIndex(null)
triDragKey.current = null; setTriDragging(null); setTriDropIndex(null)
}
function triOnDragEnd() { triDragKey.current = null; setTriDropIndex(null) }
function triOnTouchStart(e, key) { triTouchDragKey.current = key }
function triOnDragEnd() { triDragKey.current = null; setTriDragging(null); setTriDropIndex(null) }
function triOnTouchStart(e, key) { triTouchDragKey.current = key; setTriDragging(key) }
function triOnTouchMove(e, items) {
e.preventDefault()
setTriDropIndex(computeDropIndex(e.touches[0].clientY, triItemRefs, items))
}
function triOnTouchEnd(items) {
applyReorder(triTouchDragKey.current, triDropIndex, items, setTripleItems)
triTouchDragKey.current = null; setTriDropIndex(null)
triTouchDragKey.current = null; setTriDragging(null); setTriDropIndex(null)
}
const enabledItems = navItems.map(k => NAV_MAP[k]).filter(Boolean)
@@ -978,7 +980,7 @@ function PloigisiTab() {
border: '2px solid var(--accent)',
background: 'var(--accent)18',
cursor: 'grab', userSelect: 'none',
opacity: (triDragKey.current === item.key || triTouchDragKey.current === item.key) ? 0.4 : 1,
opacity: triDragging === item.key ? 0.4 : 1,
transition: 'opacity 0.1s',
}}
>
@@ -1080,7 +1082,7 @@ function PloigisiTab() {
background: 'var(--accent)18',
cursor: 'grab',
userSelect: 'none',
opacity: (dragKey.current === item.key || touchDragKey.current === item.key) ? 0.4 : 1,
opacity: dragging === item.key ? 0.4 : 1,
transition: 'opacity 0.1s',
}}
>