diff --git a/local_backend/core/modules/api.py b/local_backend/core/modules/api.py
index f7fb13e..bf36661 100644
--- a/local_backend/core/modules/api.py
+++ b/local_backend/core/modules/api.py
@@ -112,6 +112,7 @@ def bootstrap(
"timezone": timeutil.venue_tz().key,
"language": i18n.venue_language(),
"currency": _setting(db, "venue.currency", "EUR"),
+ "theme": _setting(db, "venue.theme", "amber") or "amber", # the accent colour (4.6, data-venue-theme)
"business_day_rollover_hour": timeutil.rollover_hour(),
},
"modules": [{"key": m.key, "kind": m.kind} for m in registry().values() if m.key in effective],
diff --git a/local_backend/modules/core/manifest.py b/local_backend/modules/core/manifest.py
index fbdee60..188e767 100644
--- a/local_backend/modules/core/manifest.py
+++ b/local_backend/modules/core/manifest.py
@@ -32,6 +32,7 @@ MODULE = Module(
SettingDef('venue.language', 'en', 'Default language (en | el) for staff without their own language, and for printed reports/receipts and tickets of zones without one.', type='str'),
SettingDef('venue.timezone', 'Europe/Athens', 'IANA time zone of the venue (e.g. Europe/Athens). All times are shown in it; DST is automatic. Applies immediately.', type='str'),
SettingDef('venue.name', '', 'Venue name shown on screens and tickets.', type='str'),
+ SettingDef('venue.theme', 'amber', "Accent colour of the staff apps (the waiter's phones first, plan step 4.6): 'teal' | 'amber' | 'blue' | 'violet' | 'rose'", type='enum', choices=('teal', 'amber', 'blue', 'violet', 'rose')),
SettingDef('venue.type', '', 'Kind of venue (restaurant, cafe, bar...), chosen in the setup wizard.', type='str'),
SettingDef('venue.currency', 'EUR', 'ISO 4217 currency of all prices.', type='str'),
),
diff --git a/local_backend/tests/test_venue_theme.py b/local_backend/tests/test_venue_theme.py
new file mode 100644
index 0000000..3d3501e
--- /dev/null
+++ b/local_backend/tests/test_venue_theme.py
@@ -0,0 +1,10 @@
+"""The venue's colour for the staff apps (plan step 4.6): setting venue.theme, in bootstrap."""
+
+
+def test_venue_theme_reaches_bootstrap(client, make_user, login):
+ owner = login(make_user(role="owner"))
+ assert client.get("/api/platform/bootstrap").json()["venue"]["theme"] == "amber" # the waiter's colour so far
+ assert client.put("/api/settings/venue.theme", headers=owner, json={"value": "blue"}).status_code == 200
+ assert client.get("/api/platform/bootstrap").json()["venue"]["theme"] == "blue"
+ r = client.put("/api/settings/venue.theme", headers=owner, json={"value": "neon"})
+ assert r.status_code in (400, 422)
diff --git a/manager_dashboard/src/pages/Settings/sections/VenueSettings.jsx b/manager_dashboard/src/pages/Settings/sections/VenueSettings.jsx
index 6a6c8c2..ab8b93c 100644
--- a/manager_dashboard/src/pages/Settings/sections/VenueSettings.jsx
+++ b/manager_dashboard/src/pages/Settings/sections/VenueSettings.jsx
@@ -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
@@ -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, ' ') }))} />
+
+
)
}
diff --git a/manager_dashboard/src/pages/Settings/sections/useSettings.js b/manager_dashboard/src/pages/Settings/sections/useSettings.js
index dce1ac3..cbb26af 100644
--- a/manager_dashboard/src/pages/Settings/sections/useSettings.js
+++ b/manager_dashboard/src/pages/Settings/sections/useSettings.js
@@ -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')
diff --git a/packages/i18n/locales/el/manager.json b/packages/i18n/locales/el/manager.json
index c296f02..901280b 100644
--- a/packages/i18n/locales/el/manager.json
+++ b/packages/i18n/locales/el/manager.json
@@ -360,7 +360,16 @@
"language": "Γλώσσα",
"languageHint": "Για όσους δεν έχουν διαλέξει δική τους, και για τα εκτυπωμένα δελτία και τις αναφορές.",
"timezone": "Ζώνη ώρας",
- "timezoneHint": "Όλες οι ώρες εμφανίζονται σε αυτή. Η ώρα εκεί τώρα: {{time}}."
+ "timezoneHint": "Όλες οι ώρες εμφανίζονται σε αυτή. Η ώρα εκεί τώρα: {{time}}.",
+ "theme": "Χρώμα",
+ "themeHint": "Το χρώμα έμφασης στα κινητά των σερβιτόρων.",
+ "themes": {
+ "amber": "Πορτοκαλί",
+ "teal": "Πετρόλ",
+ "blue": "Μπλε",
+ "violet": "Μωβ",
+ "rose": "Ροζ"
+ }
},
"print": {
"title": "Ειδοποιήσεις εκτύπωσης",
diff --git a/packages/i18n/locales/en/manager.json b/packages/i18n/locales/en/manager.json
index d936d36..dede973 100644
--- a/packages/i18n/locales/en/manager.json
+++ b/packages/i18n/locales/en/manager.json
@@ -360,7 +360,16 @@
"language": "Language",
"languageHint": "For staff who haven't chosen their own, and for printed tickets and reports.",
"timezone": "Time zone",
- "timezoneHint": "Every time is shown in it. The time there now: {{time}}."
+ "timezoneHint": "Every time is shown in it. The time there now: {{time}}.",
+ "theme": "Colour",
+ "themeHint": "The accent colour of the waiters' phones.",
+ "themes": {
+ "amber": "Amber",
+ "teal": "Teal",
+ "blue": "Blue",
+ "violet": "Violet",
+ "rose": "Rose"
+ }
},
"print": {
"title": "Print alerts",
diff --git a/packages/ui/src/tokens.css b/packages/ui/src/tokens.css
index db5ed98..274292d 100644
--- a/packages/ui/src/tokens.css
+++ b/packages/ui/src/tokens.css
@@ -41,6 +41,11 @@
--x-info-fg-rgb: 255 255 255;
--x-info-soft-rgb: 219 234 254;
--x-info-ink-rgb: 29 78 216;
+ /* special: offers, discounts, deals (violet; plan step 4.6) */
+ --x-special-rgb: 109 40 217;
+ --x-special-fg-rgb: 255 255 255;
+ --x-special-soft-rgb: 237 233 254;
+ --x-special-ink-rgb: 91 33 182;
--x-scrim-rgb: 15 23 42;
--x-accent-rgb: 15 118 110;
--x-accent-strong-rgb: 17 94 89;
@@ -76,6 +81,10 @@
--x-info-fg-rgb: 23 37 84;
--x-info-soft-rgb: 30 58 138;
--x-info-ink-rgb: 191 219 254;
+ --x-special-rgb: 167 139 250;
+ --x-special-fg-rgb: 30 16 64;
+ --x-special-soft-rgb: 59 31 110;
+ --x-special-ink-rgb: 221 214 254;
--x-scrim-rgb: 0 0 0;
--x-accent-rgb: 45 212 191;
--x-accent-strong-rgb: 94 234 212;
@@ -110,6 +119,10 @@
--x-info-fg-rgb: 23 37 84;
--x-info-soft-rgb: 30 58 138;
--x-info-ink-rgb: 191 219 254;
+ --x-special-rgb: 167 139 250;
+ --x-special-fg-rgb: 30 16 64;
+ --x-special-soft-rgb: 59 31 110;
+ --x-special-ink-rgb: 221 214 254;
--x-scrim-rgb: 0 0 0;
--x-accent-rgb: 45 212 191;
--x-accent-strong-rgb: 94 234 212;
@@ -366,6 +379,10 @@
--x-info-fg: rgb(var(--x-info-fg-rgb));
--x-info-soft: rgb(var(--x-info-soft-rgb));
--x-info-ink: rgb(var(--x-info-ink-rgb));
+ --x-special: rgb(var(--x-special-rgb));
+ --x-special-fg: rgb(var(--x-special-fg-rgb));
+ --x-special-soft: rgb(var(--x-special-soft-rgb));
+ --x-special-ink: rgb(var(--x-special-ink-rgb));
--x-scrim: rgb(var(--x-scrim-rgb));
--x-accent: rgb(var(--x-accent-rgb));
--x-accent-strong: rgb(var(--x-accent-strong-rgb));
@@ -373,6 +390,10 @@
--x-accent-soft: rgb(var(--x-accent-soft-rgb));
--x-accent-ink: rgb(var(--x-accent-ink-rgb));
--x-focus-ring: 0 0 0 3px rgb(var(--x-accent-rgb) / 0.35);
+ /* text on a colour the venue chose (a category, a course, a flag) or on a photo: always
+ white, with a shadow where the colour may be light (plan step 4.6) */
+ --x-on-colour-rgb: 255 255 255;
+ --x-on-colour: rgb(var(--x-on-colour-rgb));
}
/* For native controls (select popups, scrollbars) inside @xenia/ui components only.
diff --git a/packages/ui/tests/contrast.test.mjs b/packages/ui/tests/contrast.test.mjs
index 7a81319..1045c80 100644
--- a/packages/ui/tests/contrast.test.mjs
+++ b/packages/ui/tests/contrast.test.mjs
@@ -34,7 +34,7 @@ const pairs = [
['accent-ink', 'accent-soft', TEXT], ['accent-ink', 'surface', TEXT],
['accent', 'surface', UI], // switch on, focus, filled PIN dots
['ink-3', 'surface', UI], // switch off track
- ...['success', 'warning', 'danger', 'info'].flatMap(t => [
+ ...['success', 'warning', 'danger', 'info', 'special'].flatMap(t => [
[`${t}-fg`, t, TEXT], [`${t}-ink`, `${t}-soft`, TEXT], [`${t}-ink`, 'surface', TEXT], [t, 'surface', UI],
]),
]
diff --git a/tests/e2e/waiter.mjs b/tests/e2e/waiter.mjs
index 3125448..73fdb06 100644
--- a/tests/e2e/waiter.mjs
+++ b/tests/e2e/waiter.mjs
@@ -15,7 +15,7 @@ const vite = await startViteNative({ port: 5181, backendUrl: backend.url })
const APP = 'http://localhost:5181'
const TOKEN_KEY = 'xenia:dev:token'
const browser = await chromium.launch(BROWSER_CHANNEL ? { channel: BROWSER_CHANNEL } : {})
-const r = reporter('waiter: sign-in v2, lock, approvals (4.2), keys (4.3), server prices (4.4), languages (4.5), table history (4.7)')
+const r = reporter('waiter: sign-in v2, lock, approvals (4.2), keys (4.3), server prices (4.4), languages (4.5), table history (4.7), look (4.6)')
const errors = []
let failures = 0
@@ -274,6 +274,24 @@ try {
await a.getByTestId('menu-language-en').click()
await waitFor(async () => (await navText()).includes('Tables'), 8000, 300)
+ // ── 4.6: the look on the shared tokens: the venue's colour and light / dark reach the phone ──
+ const accentOf = () => a.evaluate(() => getComputedStyle(document.documentElement).getPropertyValue('--x-accent-rgb').trim())
+ r.check('4.6: the venue colour (default amber) is on the phone', await a.evaluate(() => document.documentElement.dataset.venueTheme) === 'amber')
+ await api('PUT', '/api/settings/venue.theme', { token: boss, body: { value: 'blue' } })
+ await a.reload()
+ await waitFor(async () => (await a.evaluate(() => document.documentElement.dataset.venueTheme)) === 'blue', 10_000, 300)
+ r.check('4.6: Settings → Venue → Colour: blue reaches the phone (its accent turns blue)',
+ await a.evaluate(() => document.documentElement.dataset.venueTheme) === 'blue' && (await accentOf()) === '96 165 250', await accentOf())
+ await api('PUT', '/api/settings/venue.theme', { token: boss, body: { value: 'amber' } })
+ await a.getByRole('button', { name: 'demo_maria' }).first().click({ timeout: 10_000 })
+ await a.getByRole('button', { name: /Light theme/ }).click()
+ const bg = await a.evaluate(() => getComputedStyle(document.body).backgroundColor)
+ r.check('4.6: light theme from the menu: the page turns light (tokens)', await a.evaluate(() => document.documentElement.dataset.theme) === 'light' && bg === 'rgb(248, 250, 252)', bg)
+ await a.screenshot({ path: path.join(OUT, 'waiter-light.png') })
+ await a.getByRole('button', { name: 'demo_maria' }).first().click({ timeout: 10_000 })
+ await a.getByRole('button', { name: /Dark theme/ }).click()
+ await a.reload()
+
// ── Signing out ends the session on the server: the second phone can sign in ─
await a.getByRole('button', { name: 'demo_maria' }).first().click({ timeout: 10_000 })
await a.getByRole('button', { name: /Sign out/ }).last().click()
diff --git a/tests/e2e/waiter_look.mjs b/tests/e2e/waiter_look.mjs
new file mode 100644
index 0000000..4eaa780
--- /dev/null
+++ b/tests/e2e/waiter_look.mjs
@@ -0,0 +1,93 @@
+// Screenshots of every waiter page, light and dark, on a phone-sized screen (plan step 4.6:
+// "the screenshots of every page are reviewed side by side with today's").
+//
+// node waiter_look.mjs