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
@@ -1,6 +1,7 @@
// Venue language and time zone (plan step 2.6f, D-11, D-12): venue.language is the
// language of staff without their own choice and of printed tickets/reports; venue.timezone
// is the zone every time is shown in (applies at once). Both reload bootstrap after saving.
// is the zone every time is shown in (applies at once); venue.theme is the staff apps' accent
// colour (plan step 4.6: the waiter's phones). All reload bootstrap after saving.
import { useId, useMemo } from 'react'
import { useAccess } from '@xenia/access'
import { LANGUAGE_NAMES, useTranslation, useFormat } from '@xenia/i18n'
@@ -9,6 +10,8 @@ import { SettingRow, SettingsCard } from './SettingsCard'
import { useSettings } from './useSettings'
import { timeZones } from './timeZones'
const VENUE_THEMES = ['amber', 'teal', 'blue', 'violet', 'rose'] // packages/ui tokens.css data-venue-theme
export default function VenueSettings() {
const { t } = useTranslation('manager')
const f = useFormat()
@@ -16,6 +19,7 @@ export default function VenueSettings() {
const s = useSettings()
const langId = useId()
const tzId = useId()
const themeId = useId()
const tz = s.get('venue.timezone', 'Europe/Athens')
const zones = useMemo(() => timeZones(tz), [tz])
if (s.loading) return <div className="py-8 flex justify-center"><Spinner /></div>
@@ -33,6 +37,11 @@ export default function VenueSettings() {
onChange={e => s.save('venue.timezone', e.target.value)}
options={zones.map(z => ({ value: z, label: z.replace(/_/g, ' ') }))} />
</SettingRow>
<SettingRow label={t('settings.venue.theme')} htmlFor={themeId} hint={t('settings.venue.themeHint')}>
<Select id={themeId} value={s.get('venue.theme', 'amber')} disabled={s.saving} data-testid="setting-venue.theme"
onChange={e => s.save('venue.theme', e.target.value)}
options={VENUE_THEMES.map(v => ({ value: v, label: t(`settings.venue.themes.${v}`) }))} />
</SettingRow>
</SettingsCard>
)
}
@@ -10,7 +10,7 @@ import { useTranslation } from '@xenia/i18n'
import client from '../../../api/client'
/** Keys that change what bootstrap says (language, time zone, sign-in mode): reload it. */
const BOOTSTRAP_KEYS = new Set(['venue.language', 'venue.timezone', 'auth.manager_login_mode', 'security.autofill_username'])
const BOOTSTRAP_KEYS = new Set(['venue.language', 'venue.timezone', 'venue.theme', 'auth.manager_login_mode', 'security.autofill_username'])
export function useSettings() {
const { t } = useTranslation('manager')