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:
2026-11-17 09:08:39 +02:00
co-authored by Claude Opus 5.5
parent d8c3a6c57c
commit beb53c65bb
41 changed files with 798 additions and 585 deletions
+28 -28
View File
@@ -83,7 +83,7 @@ function ProductDetailModal({ product, onClose }) {
onClick={onClose}
style={{
position: 'fixed', inset: 0,
background: 'rgba(0,0,0,0.65)',
background: 'rgb(var(--x-scrim-rgb) / 0.65)',
zIndex: 300,
}}
/>
@@ -96,7 +96,7 @@ function ProductDetailModal({ product, onClose }) {
background: 'var(--bg)',
borderRadius: 20,
overflow: 'hidden',
boxShadow: '0 20px 60px rgba(0,0,0,0.5)',
boxShadow: '0 20px 60px rgb(var(--x-scrim-rgb) / 0.5)',
}}>
{/* Close button */}
<button
@@ -104,14 +104,14 @@ function ProductDetailModal({ product, onClose }) {
style={{
position: 'absolute', top: 12, right: 12,
width: 32, height: 32, borderRadius: '50%',
background: 'rgba(0,0,0,0.45)',
background: 'rgb(var(--x-scrim-rgb) / 0.45)',
border: 'none', cursor: 'pointer',
display: 'flex', alignItems: 'center', justifyContent: 'center',
zIndex: 1,
}}
>
<svg width="14" height="14" viewBox="0 0 24 24" fill="none">
<path d="M6 6L18 18M6 18L18 6" stroke="#fff" strokeWidth="2.2" strokeLinecap="round"/>
<path d="M6 6L18 18M6 18L18 6" stroke="var(--x-ink)" strokeWidth="2.2" strokeLinecap="round"/>
</svg>
</button>
@@ -133,7 +133,7 @@ function ProductDetailModal({ product, onClose }) {
<div style={{ fontSize: 20, fontWeight: 800, color: 'var(--text)', lineHeight: 1.2, marginBottom: 6 }}>
{product.name}
</div>
<div style={{ fontSize: 18, fontWeight: 700, color: 'var(--accent, #f59e0b)', marginBottom: product.description ? 14 : 0 }}>
<div style={{ fontSize: 18, fontWeight: 700, color: 'var(--accent, var(--x-warning))', marginBottom: product.description ? 14 : 0 }}>
{money(product.base_price)}
</div>
{product.description && (
@@ -281,7 +281,7 @@ function ServiceItemCard({ product, customerCount, onAdd }) {
<span style={{ fontSize: 15, fontWeight: 700, color: 'var(--text)', lineHeight: 1.2, flex: 1, minWidth: 0 }}>
{product.name}
</span>
<span style={{ fontSize: 13, fontWeight: 600, color: hasPrice ? '#f59e0b' : 'var(--muted)', flexShrink: 0 }}>
<span style={{ fontSize: 13, fontWeight: 600, color: hasPrice ? 'var(--x-warning)' : 'var(--muted)', flexShrink: 0 }}>
{hasPrice ? money(product.base_price) : t('picker.noCharge')}
</span>
</div>
@@ -294,8 +294,8 @@ function ServiceItemCard({ product, customerCount, onAdd }) {
onClick={dec}
style={{
...btnBase,
background: qty === 0 ? 'var(--bg3)' : 'rgba(245,158,11,0.15)',
color: qty === 0 ? 'var(--muted)' : '#f59e0b',
background: qty === 0 ? 'var(--bg3)' : 'rgb(var(--x-warning-rgb) / 0.15)',
color: qty === 0 ? 'var(--muted)' : 'var(--x-warning)',
}}
>−</button>
@@ -306,8 +306,8 @@ function ServiceItemCard({ product, customerCount, onAdd }) {
title={t('picker.setToGuests', { count: customerCount ?? 1 })}
style={{
...btnBase,
background: 'rgba(245,158,11,0.12)',
color: '#f59e0b',
background: 'rgb(var(--x-warning-rgb) / 0.12)',
color: 'var(--x-warning)',
fontSize: 14, fontWeight: 800,
}}
>
@@ -325,8 +325,8 @@ function ServiceItemCard({ product, customerCount, onAdd }) {
onClick={inc}
style={{
...btnBase,
background: 'rgba(245,158,11,0.15)',
color: '#f59e0b',
background: 'rgb(var(--x-warning-rgb) / 0.15)',
color: 'var(--x-warning)',
}}
>+</button>
@@ -357,10 +357,10 @@ function ServiceItemCard({ product, customerCount, onAdd }) {
disabled={qty === 0}
style={{
padding: '8px 16px', borderRadius: 10,
background: qty === 0 ? 'var(--bg3)' : '#f59e0b',
background: qty === 0 ? 'var(--bg3)' : 'var(--x-warning)',
border: 'none', cursor: qty === 0 ? 'default' : 'pointer',
fontSize: 12, fontWeight: 800,
color: qty === 0 ? 'var(--muted)' : '#fff',
color: qty === 0 ? 'var(--muted)' : 'var(--x-warning-fg)',
flexShrink: 0,
}}
>
@@ -518,9 +518,9 @@ export default function ProductPicker({ categories, products, onAdd, onQuickAdd:
<button
className="cat-tab"
style={{
background: isSvcActive ? '#f59e0b' : hexToRgba('#f59e0b', 0.22),
color: isSvcActive ? '#fff' : '#b45309',
border: isSvcActive ? '2px solid #f59e0b' : undefined,
background: isSvcActive ? 'var(--x-warning)' : hexToRgba('var(--x-warning)', 0.22),
color: isSvcActive ? 'var(--x-warning-fg)' : 'var(--x-warning)',
border: isSvcActive ? '2px solid var(--x-warning)' : undefined,
display: 'flex', alignItems: 'center', gap: 5,
}}
onClick={() => selectCategory(SVC_CAT_ID)}
@@ -536,9 +536,9 @@ export default function ProductPicker({ categories, products, onAdd, onQuickAdd:
<button
className="cat-tab"
style={{
background: isFavActive ? '#ef4444' : hexToRgba('#ef4444', 0.22),
color: isFavActive ? '#fff' : '#ef4444',
border: isFavActive ? '2px solid #ef4444' : undefined,
background: isFavActive ? 'var(--x-danger)' : hexToRgba('var(--x-danger)', 0.22),
color: isFavActive ? 'var(--x-danger-fg)' : 'var(--x-danger)',
border: isFavActive ? '2px solid var(--x-danger)' : undefined,
display: 'flex', alignItems: 'center', gap: 5,
}}
onClick={() => selectCategory(FAV_CAT_ID)}
@@ -555,7 +555,7 @@ export default function ProductPicker({ categories, products, onAdd, onQuickAdd:
? isActive ? cat.color : hexToRgba(cat.color, 0.35)
: isActive ? 'var(--accent)' : 'var(--bg3)'
const color = cat.color
? isActive ? '#fff' : 'rgba(255,255,255,0.65)'
? isActive ? 'var(--x-ink)' : 'rgb(var(--x-ink-rgb) / 0.65)'
: isActive ? 'var(--accent-fg)' : 'var(--muted)'
return (
<button
@@ -592,7 +592,7 @@ export default function ProductPicker({ categories, products, onAdd, onQuickAdd:
/>
) : (
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', padding: '48px 24px', gap: 14 }}>
<svg width="44" height="44" viewBox="0 0 24 24" fill="none" stroke="#ef4444" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" style={{ opacity: 0.4 }}>
<svg width="44" height="44" viewBox="0 0 24 24" fill="none" stroke="var(--x-danger)" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" style={{ opacity: 0.4 }}>
<path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/>
</svg>
<p style={{ color: 'var(--muted)', fontSize: 14, textAlign: 'center', lineHeight: 1.6 }}>
@@ -620,7 +620,7 @@ export default function ProductPicker({ categories, products, onAdd, onQuickAdd:
onShowDetail={setDetailProduct}
/>
{flatProducts.length === 0 && (
<p style={{ color: '#64748b', textAlign: 'center', padding: 32 }}>
<p style={{ color: 'var(--x-ink-3)', textAlign: 'center', padding: 32 }}>
{t('picker.noProducts')}
</p>
)}
@@ -726,12 +726,12 @@ export default function ProductPicker({ categories, products, onAdd, onQuickAdd:
{favorites.length > 0 && (
<button
className={`cat-all-tile ${isFavActive ? 'cat-all-tile--active' : ''}`}
style={{ background: '#ef4444', boxShadow: isFavActive ? `0 0 0 3px #fff` : undefined }}
style={{ background: 'var(--x-danger)', boxShadow: isFavActive ? `0 0 0 3px var(--x-ink)` : undefined }}
onClick={() => selectCategory(FAV_CAT_ID)}
>
<span className="cat-all-tile__overlay" style={{ background: isFavActive ? 'rgba(255,255,255,0.18)' : 'rgba(0,0,0,0.22)' }} />
<span className="cat-all-tile__overlay" style={{ background: isFavActive ? 'rgb(var(--x-ink-rgb) / 0.18)' : 'rgb(var(--x-scrim-rgb) / 0.22)' }} />
<span className="cat-all-tile__name" style={{ display: 'flex', alignItems: 'center', gap: 5 }}>
<svg width="13" height="13" viewBox="0 0 24 24" fill="white" stroke="white" strokeWidth="1" style={{ flexShrink: 0 }}>
<svg width="13" height="13" viewBox="0 0 24 24" fill="var(--x-on-colour)" stroke="var(--x-on-colour)" strokeWidth="1" style={{ flexShrink: 0 }}>
<path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/>
</svg>
{t('settings.tabs.favorites')}
@@ -741,12 +741,12 @@ export default function ProductPicker({ categories, products, onAdd, onQuickAdd:
{topLevel.map(cat => {
const isActive = activeCat === cat.id
const bg = cat.color || 'var(--bg3)'
const overlay = isActive ? 'rgba(255,255,255,0.18)' : 'rgba(0,0,0,0.35)'
const overlay = isActive ? 'rgb(var(--x-ink-rgb) / 0.18)' : 'rgb(var(--x-scrim-rgb) / 0.35)'
return (
<button
key={cat.id}
className={`cat-all-tile ${isActive ? 'cat-all-tile--active' : ''}`}
style={{ background: bg, boxShadow: isActive ? `0 0 0 3px #fff` : undefined }}
style={{ background: bg, boxShadow: isActive ? `0 0 0 3px var(--x-ink)` : undefined }}
onClick={() => selectCategory(cat.id)}
>
<span className="cat-all-tile__overlay" style={{ background: overlay }} />