feat(waiter): the look on the shared tokens; the venue's colour (platform-v2 step 4.6)
- The waiter's --bg/--text/--accent… are made of @xenia/ui tokens: light / dark (user menu) and the venue's accent reach every screen; the 751 colour literals in waiter_pwa/src became tokens (by hue family and lightness), hex-alpha suffixes became fade() (color-mix), fixing 'var(--accent)18' tints that never showed. - @xenia/ui: new `special` (violet: offers, discounts, deals; contrast-tested) and `on-colour` tokens. - Setting venue.theme (teal | amber | blue | violet | rose, default amber), bootstrap venue.theme, manager Settings → Venue → Colour; the waiter sets data-venue-theme and the theme before the first render. - Guard tests/no-colours.test.mjs; tests/e2e/waiter_look.mjs (every page light + dark, side-by-side compare page); waiter e2e +3; backend test_venue_theme.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -11,6 +11,7 @@ import useKdsReadyStore from '../store/kdsReadyStore'
|
||||
import useInstallPromptStore, { apkAvailable } from '../store/installPromptStore'
|
||||
import useOfflineQueueCount from '../hooks/useOfflineQueueCount'
|
||||
import useFailedPrintCount from '../hooks/useFailedPrintCount'
|
||||
import { fade } from '../logic/colour'
|
||||
|
||||
// ─── Nav item registry ────────────────────────────────────────────────────────
|
||||
|
||||
@@ -121,7 +122,7 @@ function CacheButton({ count }) {
|
||||
position: 'relative',
|
||||
display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
|
||||
minWidth: 44, minHeight: 44, borderRadius: 8,
|
||||
color: '#f59e0b',
|
||||
color: 'var(--x-warning)',
|
||||
}}>
|
||||
{/* Cloud upload icon */}
|
||||
<svg width="22" height="22" viewBox="0 0 24 24" fill="none">
|
||||
@@ -130,7 +131,7 @@ function CacheButton({ count }) {
|
||||
</svg>
|
||||
<span style={{
|
||||
position: 'absolute', top: 6, right: 6,
|
||||
background: '#f59e0b', color: 'white', fontSize: 10, fontWeight: 700,
|
||||
background: 'var(--x-warning)', color: 'var(--x-warning-fg)', fontSize: 10, fontWeight: 700,
|
||||
borderRadius: '50%', width: 16, height: 16,
|
||||
display: 'flex', alignItems: 'center', justifyContent: 'center',
|
||||
}}>
|
||||
@@ -152,7 +153,7 @@ function FailedPrintButton({ count, onClick }) {
|
||||
display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
|
||||
minWidth: 44, minHeight: 44, borderRadius: 8,
|
||||
background: 'none', border: 'none', cursor: 'pointer',
|
||||
color: '#ef4444',
|
||||
color: 'var(--x-danger)',
|
||||
}}
|
||||
>
|
||||
{/* Printer icon */}
|
||||
@@ -163,7 +164,7 @@ function FailedPrintButton({ count, onClick }) {
|
||||
</svg>
|
||||
<span style={{
|
||||
position: 'absolute', top: 6, right: 6,
|
||||
background: '#ef4444', color: 'white', fontSize: 10, fontWeight: 700,
|
||||
background: 'var(--x-danger)', color: 'var(--x-danger-fg)', fontSize: 10, fontWeight: 700,
|
||||
borderRadius: '50%', width: 16, height: 16,
|
||||
display: 'flex', alignItems: 'center', justifyContent: 'center',
|
||||
}}>
|
||||
@@ -193,7 +194,7 @@ function BellButton({ onClick, count }) {
|
||||
{count > 0 && (
|
||||
<span style={{
|
||||
position: 'absolute', top: 6, right: 6,
|
||||
background: '#ef4444', color: 'white', fontSize: 10, fontWeight: 700,
|
||||
background: 'var(--x-danger)', color: 'var(--x-danger-fg)', fontSize: 10, fontWeight: 700,
|
||||
borderRadius: '50%', width: 16, height: 16,
|
||||
display: 'flex', alignItems: 'center', justifyContent: 'center',
|
||||
}}>
|
||||
@@ -230,7 +231,7 @@ function NotificationDrawer({ messages, onClose }) {
|
||||
<span style={{ fontSize: 20, flexShrink: 0 }}>📢</span>
|
||||
<div style={{ flex: 1, minWidth: 0 }}>
|
||||
{msg.sender_name && (
|
||||
<div style={{ fontSize: 11, fontWeight: 700, color: '#a5b4fc', marginBottom: 2 }}>{msg.sender_name}</div>
|
||||
<div style={{ fontSize: 11, fontWeight: 700, color: 'var(--x-info-ink)', marginBottom: 2 }}>{msg.sender_name}</div>
|
||||
)}
|
||||
<div style={{ fontSize: 14, fontWeight: 600, color: 'var(--text)' }}>{msg.body}</div>
|
||||
{tableIds.length > 0 && (
|
||||
@@ -349,7 +350,7 @@ function DrawerButton({ item, location, onNavigate, active: activeProp, onClick
|
||||
style={{
|
||||
display: 'flex', alignItems: 'center', gap: 14,
|
||||
padding: '12px 14px', borderRadius: 12, border: 'none',
|
||||
background: active ? 'var(--accent)18' : 'transparent',
|
||||
background: active ? fade('var(--accent)', 0.09) : 'transparent',
|
||||
color: active ? 'var(--accent)' : 'var(--text)',
|
||||
fontSize: 15, fontWeight: active ? 700 : 500,
|
||||
cursor: 'pointer', textAlign: 'left', width: '100%',
|
||||
@@ -391,7 +392,7 @@ function SideDrawer({ open, onClose }) {
|
||||
onClick={onClose}
|
||||
style={{
|
||||
position: 'fixed', inset: 0, zIndex: 300,
|
||||
background: 'rgba(0,0,0,0.55)',
|
||||
background: 'rgb(var(--x-scrim-rgb) / 0.55)',
|
||||
opacity: open ? 1 : 0,
|
||||
pointerEvents: open ? 'all' : 'none',
|
||||
transition: 'opacity 0.22s ease',
|
||||
@@ -406,7 +407,7 @@ function SideDrawer({ open, onClose }) {
|
||||
display: 'flex', flexDirection: 'column',
|
||||
transform: open ? 'translateX(0)' : 'translateX(-100%)',
|
||||
transition: 'transform 0.22s ease',
|
||||
boxShadow: open ? '4px 0 24px rgba(0,0,0,0.4)' : 'none',
|
||||
boxShadow: open ? '4px 0 24px rgb(var(--x-scrim-rgb) / 0.4)' : 'none',
|
||||
}}>
|
||||
{/* Drawer header */}
|
||||
<div style={{ padding: '20px 20px 16px', borderBottom: '1px solid var(--border)' }}>
|
||||
@@ -451,11 +452,11 @@ function SideDrawer({ open, onClose }) {
|
||||
|
||||
// ─── Triple pill footer ───────────────────────────────────────────────────────
|
||||
|
||||
function PillBadge({ count, color = '#ef4444' }) {
|
||||
function PillBadge({ count, color = 'var(--x-danger)' }) {
|
||||
if (!count) return null
|
||||
return (
|
||||
<span style={{
|
||||
background: color, color: 'white', fontSize: 12, fontWeight: 800,
|
||||
background: color, color: 'var(--x-on-colour)', fontSize: 12, fontWeight: 800,
|
||||
borderRadius: 11, minWidth: 22, height: 22,
|
||||
display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
|
||||
padding: '0 6px', lineHeight: 1, flexShrink: 0,
|
||||
@@ -494,9 +495,9 @@ function TripleFooter({ location, navigate, chatUnread, kdsReady, tripleItems })
|
||||
? item.match(location) && !isStandaloneActive
|
||||
: item.match(location)
|
||||
const badge = item.key === 'messages' && chatUnread > 0
|
||||
? { count: chatUnread, color: '#ef4444' }
|
||||
? { count: chatUnread, color: 'var(--x-danger)' }
|
||||
: item.key === 'orders' && kdsReady > 0
|
||||
? { count: kdsReady, color: '#22c55e' }
|
||||
? { count: kdsReady, color: 'var(--x-success)' }
|
||||
: null
|
||||
return (
|
||||
<button
|
||||
@@ -564,9 +565,9 @@ function IconNavbar({ navItems, location, navigate, chatUnread, kdsReady }) {
|
||||
? item.match(location) && !isStandaloneActive
|
||||
: item.match(location)
|
||||
const badge = item.key === 'messages' && chatUnread > 0
|
||||
? { count: chatUnread, color: '#ef4444' }
|
||||
? { count: chatUnread, color: 'var(--x-danger)' }
|
||||
: item.key === 'orders' && kdsReady > 0
|
||||
? { count: kdsReady, color: '#22c55e' }
|
||||
? { count: kdsReady, color: 'var(--x-success)' }
|
||||
: null
|
||||
return (
|
||||
<button
|
||||
@@ -594,7 +595,7 @@ function IconNavbar({ navItems, location, navigate, chatUnread, kdsReady }) {
|
||||
{badge && (
|
||||
<span style={{
|
||||
position: 'absolute', top: -4, right: -6,
|
||||
background: badge.color, color: 'white', fontSize: 9, fontWeight: 800,
|
||||
background: badge.color, color: 'var(--x-on-colour)', fontSize: 9, fontWeight: 800,
|
||||
borderRadius: '50%', minWidth: 14, height: 14,
|
||||
display: 'flex', alignItems: 'center', justifyContent: 'center',
|
||||
padding: '0 2px',
|
||||
|
||||
Reference in New Issue
Block a user