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:
@@ -9,7 +9,7 @@ import { money } from '../i18n'
|
||||
// ── Heart icon ────────────────────────────────────────────────────────────────
|
||||
function Heart({ filled, size = 22 }) {
|
||||
return (
|
||||
<svg width={size} height={size} viewBox="0 0 24 24" fill={filled ? '#ef4444' : 'none'} stroke={filled ? '#ef4444' : 'currentColor'} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
||||
<svg width={size} height={size} viewBox="0 0 24 24" fill={filled ? 'var(--x-danger)' : 'none'} stroke={filled ? 'var(--x-danger)' : 'currentColor'} strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
||||
<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>
|
||||
)
|
||||
@@ -57,8 +57,8 @@ function AttrSection({ title, items, favIds, onToggle }) {
|
||||
style={{
|
||||
display: 'flex', alignItems: 'center', gap: 12,
|
||||
padding: '10px 14px',
|
||||
background: isFav ? 'rgba(239,68,68,0.07)' : 'var(--bg2)',
|
||||
border: `1px solid ${isFav ? 'rgba(239,68,68,0.25)' : 'var(--border)'}`,
|
||||
background: isFav ? 'rgb(var(--x-danger-rgb) / 0.07)' : 'var(--bg2)',
|
||||
border: `1px solid ${isFav ? 'rgb(var(--x-danger-rgb) / 0.25)' : 'var(--border)'}`,
|
||||
borderRadius: 10,
|
||||
transition: 'background 120ms, border-color 120ms',
|
||||
}}
|
||||
@@ -76,7 +76,7 @@ function AttrSection({ title, items, favIds, onToggle }) {
|
||||
</div>
|
||||
<button
|
||||
onClick={() => onToggle(item.id)}
|
||||
style={{ background: 'none', border: 'none', cursor: 'pointer', padding: 4, flexShrink: 0, color: isFav ? '#ef4444' : 'var(--muted)' }}
|
||||
style={{ background: 'none', border: 'none', cursor: 'pointer', padding: 4, flexShrink: 0, color: isFav ? 'var(--x-danger)' : 'var(--muted)' }}
|
||||
>
|
||||
<Heart filled={isFav} size={20} />
|
||||
</button>
|
||||
@@ -138,7 +138,7 @@ function ItemFavoritesModal({ product, waiterAttrFavs, onSave, onClose }) {
|
||||
{/* Backdrop */}
|
||||
<div
|
||||
onClick={onClose}
|
||||
style={{ position: 'fixed', inset: 0, background: 'rgba(0,0,0,0.5)', zIndex: 100 }}
|
||||
style={{ position: 'fixed', inset: 0, background: 'rgb(var(--x-scrim-rgb) / 0.5)', zIndex: 100 }}
|
||||
/>
|
||||
|
||||
{/* Sheet */}
|
||||
@@ -149,7 +149,7 @@ function ItemFavoritesModal({ product, waiterAttrFavs, onSave, onClose }) {
|
||||
borderRadius: '20px 20px 0 0',
|
||||
maxHeight: '88vh',
|
||||
display: 'flex', flexDirection: 'column',
|
||||
boxShadow: '0 -8px 40px rgba(0,0,0,0.2)',
|
||||
boxShadow: '0 -8px 40px rgb(var(--x-scrim-rgb) / 0.2)',
|
||||
}}>
|
||||
{/* Handle bar */}
|
||||
<div style={{ display: 'flex', justifyContent: 'center', padding: '10px 0 0' }}>
|
||||
@@ -187,7 +187,7 @@ function ItemFavoritesModal({ product, waiterAttrFavs, onSave, onClose }) {
|
||||
) : (
|
||||
<>
|
||||
<p style={{ fontSize: 13, color: 'var(--muted)', marginBottom: 16, lineHeight: 1.5 }}>
|
||||
{t('favSetup.pickIntro')} <strong style={{ color: '#ef4444' }}>♥ {t('settings.tabs.favorites')}</strong>. {t('favSetup.pickOutro')}
|
||||
{t('favSetup.pickIntro')} <strong style={{ color: 'var(--x-danger)' }}>♥ {t('settings.tabs.favorites')}</strong>. {t('favSetup.pickOutro')}
|
||||
</p>
|
||||
|
||||
<AttrSection
|
||||
@@ -241,8 +241,8 @@ function ItemFavoritesModal({ product, waiterAttrFavs, onSave, onClose }) {
|
||||
onClick={handleSave}
|
||||
style={{
|
||||
flex: 1, height: 44, borderRadius: 12, border: 'none',
|
||||
background: totalSelected > 0 ? '#ef4444' : 'var(--accent)',
|
||||
color: '#fff',
|
||||
background: totalSelected > 0 ? 'var(--x-danger)' : 'var(--accent)',
|
||||
color: 'var(--x-danger-fg)',
|
||||
fontSize: 15, fontWeight: 700, cursor: 'pointer',
|
||||
}}
|
||||
>
|
||||
@@ -293,7 +293,7 @@ function ProductRow({ product, isFav, hasAttrOverride, onToggleFav, onEditAttrs
|
||||
{/* Heart — toggles product in/out of favorites list */}
|
||||
<button
|
||||
onClick={() => onToggleFav(product.id)}
|
||||
style={{ background: 'none', border: 'none', cursor: 'pointer', padding: 6, color: isFav ? '#ef4444' : 'var(--muted)', flexShrink: 0 }}
|
||||
style={{ background: 'none', border: 'none', cursor: 'pointer', padding: 6, color: isFav ? 'var(--x-danger)' : 'var(--muted)', flexShrink: 0 }}
|
||||
>
|
||||
<Heart filled={isFav} />
|
||||
</button>
|
||||
@@ -357,7 +357,7 @@ function FavoritesList({ items, products, onReorder }) {
|
||||
if (items.length === 0) {
|
||||
return (
|
||||
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', flex: 1, padding: 32, gap: 12 }}>
|
||||
<svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="#ef4444" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" style={{ opacity: 0.4 }}>
|
||||
<svg width="48" height="48" 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={{ fontSize: 14, color: 'var(--muted)', textAlign: 'center', lineHeight: 1.6 }}>
|
||||
@@ -370,7 +370,7 @@ function FavoritesList({ items, products, onReorder }) {
|
||||
return (
|
||||
<div ref={containerRef} style={{ flex: 1, overflowY: 'auto', touchAction: 'pan-x' }}>
|
||||
{dropIndex === 0 && dragging != null && (
|
||||
<div style={{ height: 3, background: '#22c55e', margin: '0 16px', borderRadius: 2 }} />
|
||||
<div style={{ height: 3, background: 'var(--x-success)', margin: '0 16px', borderRadius: 2 }} />
|
||||
)}
|
||||
|
||||
{items.map((productId, idx) => {
|
||||
@@ -412,7 +412,7 @@ function FavoritesList({ items, products, onReorder }) {
|
||||
</div>
|
||||
|
||||
{dropIndex === idx + 1 && dragging != null && dragging !== idx && (
|
||||
<div style={{ height: 3, background: '#22c55e', margin: '0 16px', borderRadius: 2 }} />
|
||||
<div style={{ height: 3, background: 'var(--x-success)', margin: '0 16px', borderRadius: 2 }} />
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user