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:
@@ -78,9 +78,9 @@ function GateBtn({ onClick, disabled, variant = 'primary', children }) {
|
||||
opacity: disabled ? 0.6 : 1, transition: 'opacity 120ms',
|
||||
}
|
||||
const styles = {
|
||||
primary: { background: 'var(--accent)', color: '#0f172a' },
|
||||
primary: { background: 'var(--accent)', color: 'var(--x-canvas)' },
|
||||
secondary: { background: 'var(--bg3)', color: 'var(--text)' },
|
||||
danger: { background: 'var(--danger)', color: '#fff' },
|
||||
danger: { background: 'var(--danger)', color: 'var(--x-danger-fg)' },
|
||||
}
|
||||
return <button style={{ ...base, ...styles[variant] }} onClick={onClick} disabled={disabled}>{children}</button>
|
||||
}
|
||||
@@ -331,11 +331,17 @@ function OfflineListener() {
|
||||
return null
|
||||
}
|
||||
|
||||
// Light / dark from the user menu (per phone), the accent colour from the venue (bootstrap
|
||||
// venue.theme, Settings → Venue; plan step 4.6). The waiter's colours are @xenia/ui tokens.
|
||||
function ThemeApplier() {
|
||||
const dark = useThemeStore(s => s.dark)
|
||||
const venueTheme = useAccess()?.venue?.theme || 'amber'
|
||||
useEffect(() => {
|
||||
document.documentElement.setAttribute('data-theme', dark ? 'dark' : 'light')
|
||||
}, [dark])
|
||||
useEffect(() => {
|
||||
document.documentElement.setAttribute('data-venue-theme', venueTheme)
|
||||
}, [venueTheme])
|
||||
return null
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user