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
+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'