feat(manager): the venue's identity (Settings -> Identity): name, slogan, named colours, logos, guest Wi-Fi, contact details

Set once (GET/PUT /api/identity, venue.name + venue.identity); every colour field
offers the venue's colours first (VenueColoursProvider in @xenia/ui); signage screens
get the identity and the venue's time zone with their venue and are told on a change;
logos are protected in the media library; wifiQr() for the join-the-network code.
Plan 6R.14, F-111.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-22 13:10:58 +02:00
co-authored by Claude Opus 5.5
parent 1c8d45e00c
commit 2a38602d45
25 changed files with 663 additions and 8 deletions
+2 -1
View File
@@ -44,7 +44,8 @@
"colourOwn": "Δικό σας χρώμα",
"colourCode": "Κωδικός χρώματος",
"opacity": "Αδιαφάνεια",
"noIcon": "Χωρίς εικονίδιο"
"noIcon": "Χωρίς εικονίδιο",
"venueColours": "Τα χρώματα του καταστήματος"
},
"override": {
"title": "Έγκριση υπευθύνου",
+69 -1
View File
@@ -375,7 +375,8 @@
"fiscal": "Ταμειακή",
"development": "Developer",
"customer-display": "Οθόνη πελάτη",
"menu-tablets": "Tablet μενού"
"menu-tablets": "Tablet μενού",
"identity": "Ταυτότητα"
},
"mode": {
"password": "Κωδικός",
@@ -4343,5 +4344,72 @@
"deleted": "Η σκηνή διαγράφηκε.",
"deleteTitle": "Διαγραφή «{{name}}»;",
"deleteBody": "Οι κανόνες τιμών με αυτήν παύουν να ισχύουν· οι γραμμές οθονών που έπαιζαν μόνο σε αυτήν απενεργοποιούνται."
},
"identity": {
"title": "Η ταυτότητα του καταστήματος",
"intro": "Ορίζεται μία φορά και χρησιμοποιείται παντού: η ψηφιακή σήμανση, το ταμείο, η οθόνη πελάτη και οι εφαρμογές του προσωπικού δείχνουν το όνομα, τα χρώματα και τα λογότυπα του καταστήματος, και τα widgets Wi-Fi και επικοινωνίας παίρνουν τα στοιχεία τους από εδώ. Κάθε εφαρμογή μπορεί να έχει και τα δικά της.",
"save": "Αποθήκευση",
"saved": "Η ταυτότητα αποθηκεύτηκε",
"unsaved": "Μη αποθηκευμένες αλλαγές",
"undo": "Αναίρεση",
"name": {
"title": "Όνομα",
"name": "Το όνομα του καταστήματος",
"nameHint": "Στις οθόνες, στα δελτία και στις εφαρμογές πελατών.",
"slogan": "Σύνθημα",
"sloganHint": "Μια σύντομη γραμμή κάτω από το όνομα (προαιρετικό)."
},
"colours": {
"title": "Χρώματα",
"hint": "Τα χρώματα του καταστήματος, με ονόματα. Κάθε πεδίο χρώματος της ψηφιακής σήμανσης τα προτείνει πρώτα.",
"add": "Προσθήκη χρώματος",
"name": "Όνομα",
"colour": "Χρώμα",
"remove": "Αφαίρεση {{name}}",
"none": "Δεν υπάρχουν χρώματα ακόμη.",
"newName": "Χρώμα {{n}}",
"max": "Έως 12 χρώματα."
},
"logos": {
"title": "Λογότυπα",
"hint": "Εικόνες από τη βιβλιοθήκη πολυμέσων.",
"main": "Κύριο λογότυπο",
"light": "Για σκούρο φόντο",
"dark": "Για ανοιχτό φόντο",
"icon": "Μικρό τετράγωνο εικονίδιο"
},
"wifi": {
"title": "Wi-Fi για πελάτες",
"hint": "Εμφανίζεται από το widget Wi-Fi της ψηφιακής σήμανσης, με κωδικό που συνδέει στο δίκτυο.",
"ssid": "Όνομα δικτύου",
"password": "Κωδικός",
"security": "Ασφάλεια",
"securities": {
"WPA": "WPA / WPA2 / WPA3",
"WEP": "WEP (παλιό)",
"nopass": "Ανοιχτό (χωρίς κωδικό)"
},
"hidden": "Κρυφό δίκτυο",
"hiddenHint": "Το δίκτυο δεν εμφανίζεται στη λίστα δικτύων.",
"note": "Σημείωση",
"noteHint": "Π.χ. «Ζητήστε μας τον κωδικό» (προαιρετικό).",
"preview": "Σαρώστε για σύνδεση"
},
"contact": {
"title": "Στοιχεία επικοινωνίας",
"hint": "Εμφανίζονται από το widget επικοινωνίας. Τα κενά πεδία δεν εμφανίζονται.",
"phone": "Τηλέφωνο",
"phone2": "Δεύτερο τηλέφωνο",
"email": "Email",
"address": "Διεύθυνση",
"website": "Ιστότοπος",
"facebook": "Facebook",
"instagram": "Instagram",
"tiktok": "TikTok",
"tripadvisor": "Tripadvisor",
"google": "Σύνδεσμος Google Maps",
"whatsapp": "WhatsApp",
"viber": "Viber"
}
}
}
+2 -1
View File
@@ -44,7 +44,8 @@
"colourOwn": "Your own colour",
"colourCode": "Colour code",
"opacity": "Opacity",
"noIcon": "No icon"
"noIcon": "No icon",
"venueColours": "The venue's colours"
},
"override": {
"title": "Manager approval",
+69 -1
View File
@@ -375,7 +375,8 @@
"fiscal": "Fiscal device",
"development": "Developer",
"customer-display": "Customer display",
"menu-tablets": "Menu tablets"
"menu-tablets": "Menu tablets",
"identity": "Identity"
},
"mode": {
"password": "Password",
@@ -4343,5 +4344,72 @@
"deleted": "Scene deleted.",
"deleteTitle": "Delete \"{{name}}\"?",
"deleteBody": "Price rules with it stop applying; signage lines that played only in it are turned off."
},
"identity": {
"title": "The venue's identity",
"intro": "Set once, used everywhere: signage, the counter, the customer display and the staff apps show the venue's name, colours and logos, and the Wi-Fi and contact widgets read their details here. Each app can still use its own.",
"save": "Save",
"saved": "Identity saved",
"unsaved": "Unsaved changes",
"undo": "Undo",
"name": {
"title": "Name",
"name": "The venue's name",
"nameHint": "On screens, tickets and the customer apps.",
"slogan": "Slogan",
"sloganHint": "A short line under the name (optional)."
},
"colours": {
"title": "Colours",
"hint": "The venue's colours, with names. Every colour field in signage offers them first.",
"add": "Add a colour",
"name": "Name",
"colour": "Colour",
"remove": "Remove {{name}}",
"none": "No colours yet.",
"newName": "Colour {{n}}",
"max": "Up to 12 colours."
},
"logos": {
"title": "Logos",
"hint": "Pictures from the media library.",
"main": "Main logo",
"light": "For dark backgrounds",
"dark": "For light backgrounds",
"icon": "Small square icon"
},
"wifi": {
"title": "Wi-Fi for guests",
"hint": "Shown by the Wi-Fi widget on signage, with a code that joins the network.",
"ssid": "Network name",
"password": "Password",
"security": "Security",
"securities": {
"WPA": "WPA / WPA2 / WPA3",
"WEP": "WEP (old)",
"nopass": "Open (no password)"
},
"hidden": "Hidden network",
"hiddenHint": "The network doesn't show in the list of networks.",
"note": "A note",
"noteHint": "E.g. \"Ask us for the code\" (optional).",
"preview": "Scan to join"
},
"contact": {
"title": "Contact details",
"hint": "Shown by the contact widget. Empty fields don't show.",
"phone": "Phone",
"phone2": "Second phone",
"email": "Email",
"address": "Address",
"website": "Website",
"facebook": "Facebook",
"instagram": "Instagram",
"tiktok": "TikTok",
"tripadvisor": "Tripadvisor",
"google": "Google Maps link",
"whatsapp": "WhatsApp",
"viber": "Viber"
}
}
}
+1
View File
@@ -45,6 +45,7 @@ export function useUiLabels() {
selected: count => t('ui.selected', { count }),
pinProgress: (count, total) => t('ui.pinProgress', { count, total }),
colourOwn: t('ui.colourOwn'),
venueColours: t('ui.venueColours'),
colourCode: t('ui.colourCode'),
opacity: t('ui.opacity'),
noIcon: t('ui.noIcon'),
+11
View File
@@ -508,3 +508,14 @@ export function shapeName(w, h) {
const d = g(Math.round(w), Math.round(h)) || 1
return `${Math.round(w) / d}:${Math.round(h) / d}`
}
// ── the venue's identity (6R.14) ──────────────────────────────────────────────
/** The text of a QR code that joins a Wi-Fi network ("WIFI:T:WPA;S:…;P:…;;"), or '' without a network name. */
export function wifiQr(wifi) {
if (!wifi?.ssid) return ''
const esc = v => String(v).replace(/([\;,:"])/g, '\$1')
const sec = wifi.security === 'nopass' ? 'nopass' : wifi.security === 'WEP' ? 'WEP' : 'WPA'
const pw = sec !== 'nopass' && wifi.password ? `P:${esc(wifi.password)};` : ''
return `WIFI:T:${sec};S:${esc(wifi.ssid)};${pw}${wifi.hidden ? 'H:true;' : ''};`
}
+7
View File
@@ -270,3 +270,10 @@ test('slide shapes: custom ratios, the canvas, the box a slide keeps on any scre
assert.equal(shapeName(1920, 1200), '16:10')
assert.equal(shapeName(1000, 300), '10:3')
})
test('a Wi-Fi QR code: escaped, open networks without a password, hidden ones (6R.14)', async () => {
const { wifiQr } = await import('../src/logic.js')
assert.equal(wifiQr({ ssid: 'Xenia Guests', password: 'a;b:c', security: 'WPA' }), 'WIFI:T:WPA;S:Xenia Guests;P:a\;b\:c;;')
assert.equal(wifiQr({ ssid: 'Open', password: 'x', security: 'nopass', hidden: true }), 'WIFI:T:nopass;S:Open;H:true;;')
assert.equal(wifiQr({ password: 'x' }), '')
})
+1
View File
@@ -527,6 +527,7 @@
}
.x-colour__auto:hover { background: var(--x-surface-2); }
.x-colour__auto--on { border-color: var(--x-accent); background: var(--x-accent-soft); color: var(--x-accent-ink); }
.x-colour__venue { display: grid; gap: var(--x-space-2); padding-bottom: var(--x-space-2); border-bottom: 1px solid var(--x-line); }
.x-colour__presets { display: grid; grid-template-columns: repeat(6, 1fr); gap: var(--x-space-2); justify-items: center; }
.x-colour__preset { padding: 0; border: 0; background: none; border-radius: 999px; cursor: pointer; transition: transform var(--x-duration-fast) var(--x-ease); }
.x-colour__preset .x-swatch { width: 32px; height: 32px; }
@@ -4,6 +4,7 @@ import { Field, Input } from './Field.jsx'
import { Popover } from './Popover.jsx'
import { useLabels } from './labels.js'
import { COLOUR_PRESETS, joinAlpha, splitAlpha, typedColour } from './colour.js'
import { useVenueColours } from './venueColours.js'
/**
* The one colour field of the product (2026-11-21): its swatch and code, as tall as the fields
@@ -13,9 +14,11 @@ import { COLOUR_PRESETS, joinAlpha, splitAlpha, typedColour } from './colour.js'
* auto: { label, on, pick } — a first choice that leaves the colour to something else ("Automatic",
* "Each badge's own"); `on` shows it chosen (the field then reads its label).
* opacity: false hides the opacity (a colour that can't be see-through).
* The venue's own colours (VenueColoursProvider, its identity: 6R.14) come first, with their names.
*/
export function ColourField({ label, hint, value, onChange, presets = COLOUR_PRESETS, auto, opacity = true, className, testId }) {
const labels = useLabels()
const venue = useVenueColours()
const [open, setOpen] = useState(false)
const [typed, setTyped] = useState(null)
const btn = useRef(null)
@@ -36,6 +39,23 @@ export function ColourField({ label, hint, value, onChange, presets = COLOUR_PRE
<button type="button" className={cx('x-colour__auto', auto.on && 'x-colour__auto--on')} aria-pressed={!!auto.on}
onClick={() => { auto.pick(); close() }} data-testid={tid('auto')}>{auto.label}</button>
)}
{venue.length > 0 && (
<div className="x-colour__venue" data-testid={tid('venue')}>
<span className="x-colour__heading">{labels.venueColours}</span>
<div className="x-colour__presets">
{venue.map(({ name, colour }) => {
const c = colour.toLowerCase()
const chosen = !auto?.on && (rgb === c.slice(0, 7))
return (
<button key={`${name}${c}`} type="button" className={cx('x-colour__preset', chosen && 'x-colour__preset--on')} aria-label={name} aria-pressed={chosen} title={`${name} ${c}`}
onClick={() => { onChange(opacity ? (c.length === 9 ? c : joinAlpha(c, alpha)) : c.slice(0, 7)); close() }} data-testid={tid('venue-colour')}>
<Swatch colour={c} />
</button>
)
})}
</div>
</div>
)}
<div className="x-colour__presets">
{presets.map(c => {
const chosen = !auto?.on && rgb === c.toLowerCase()
+1
View File
@@ -22,6 +22,7 @@ export const DEFAULT_LABELS = {
noOptions: 'Nothing found',
selected: n => `${n} selected`,
colourOwn: 'Your own colour',
venueColours: "The venue's colours",
colourCode: 'Colour code',
opacity: 'Opacity',
noIcon: 'No icon',
@@ -0,0 +1,15 @@
import { createContext, createElement, useContext } from 'react'
// The venue's own colours (its identity, 6R.14): every ColourField offers them first. An app that
// knows them (the manager reads GET /api/identity) puts them at its root:
// <VenueColoursProvider colours={[{ name: 'Main', colour: '#1e3a8a' }, …]}>
const VenueColoursContext = createContext([])
export function VenueColoursProvider({ colours, children }) {
return createElement(VenueColoursContext.Provider, { value: colours || [] }, children)
}
/** The venue's colours in effect ([] when none are set). */
export function useVenueColours() {
return useContext(VenueColoursContext)
}
+1
View File
@@ -25,6 +25,7 @@ export { Dropdown } from './components/Dropdown.jsx'
export { Popover } from './components/Popover.jsx'
export { ColourField, Swatch } from './components/ColourField.jsx'
export { COLOUR_PRESETS, joinAlpha, splitAlpha, typedColour } from './components/colour.js'
export { VenueColoursProvider, useVenueColours } from './components/venueColours.js'
export { FieldRow } from './components/FieldRow.jsx'
export { Slider } from './components/Slider.jsx'
export { NumberInput } from './components/NumberInput.jsx'