feat(signage): venue badges, widgets' own look, widgets placed inside stacks, Save and leave, shared controls (owner review 5)

- Badges: the venue's list (setting signage.badges: names el/en, colours, an icon from a food and
  drink set) edited under Signage -> "Message & settings"; sent with the venue to screens and
  previews; several badges per product (MenuList.badges lists, a single one still read) in the
  shared multiple Dropdown; a board's badge colour / text colour override them (None = each own).
- Widgets: colour, background plate, font, bold / italic / underline, text size, QR colours;
  widgets in a stack's part get every setting, vertical alignment, and a custom box inside their
  place, picked (stack, then widget) and dragged on the preview (selection by path "2.1.0").
- Menu slides: vertical alignment of the list (board_valign); "Where the list sits" is now
  "Horizontal alignment".
- Message of the day: one component in the settings tab, on the Overview and from its widget.
- Leaving a slide with changes: "Save and leave" (ConfirmDialog altLabel).
- @xenia/ui: ColourField (with colour.js helpers), FieldRow (framed only while wrapped), Slider,
  IconPicker, Segmented multiple; native selects on the Overview and signage replaced by Dropdown,
  the device settings' colour input by ColourField.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-21 14:17:27 +02:00
co-authored by Claude Opus 5.5
parent aaa0914778
commit aa3fe85053
51 changed files with 1378 additions and 432 deletions
+35 -4
View File
@@ -321,8 +321,8 @@ const DOTS = { dotted: 'dotted', dashed: 'dashed', solid: 'solid' }
* board's text size): headings, names and prices each their own size, colour, font, bold / italic /
* underline and alignment (empty: the board's text size and font, the text colour for names and the
* accent colour for headings and prices); the dots between name and price; line and letter spacing
* (auto: 1.25 and normal; set on the list, never inherited from the page); photos' size and shape;
* the badges' colours (2026-11-21: their text the venue's, or white / black to read on them).
* (auto: 1.25 and normal; set on the list, never inherited from the page); photos' size and shape.
* Badges: badgeColours (owner review 5).
*/
export function menuLook(c = {}) {
const base = c.text_size || 100
@@ -346,8 +346,6 @@ export function menuLook(c = {}) {
dots: d.style === 'none'
? { borderBottom: 'none' }
: { borderBottom: `${+(0.08 * (d.size || 100) / 100).toFixed(3)}em ${DOTS[d.style] || 'dotted'} ${d.colour || 'currentColor'}`, opacity: d.colour ? 1 : 0.35 },
// badges: the accent (also the page dots), their text the venue's or one that reads on it
badge: { background: accent, color: c.badge_text_colour || readableOn(accent) },
title: c.heading_style?.colour || accent,
lineHeight: c.line_height || 1.25,
letterSpacing: c.letter_spacing != null ? `${c.letter_spacing}em` : 'normal',
@@ -358,6 +356,39 @@ export function menuLook(c = {}) {
}
}
/**
* The badges a venue has until it edits its own (owner review 5; the server's DEFAULTS in
* services/signage_badges.py): a screen that hasn't heard of the venue's list draws these.
*/
export const DEFAULT_BADGES = [
{ key: 'new', names: { el: 'Νέο', en: 'New' }, colour: '#22c55e', text_colour: null, icon: 'sparkles' },
{ key: 'chef', names: { el: 'Πρόταση σεφ', en: "Chef's pick" }, colour: '#f59e0b', text_colour: null, icon: 'chef-hat' },
{ key: 'offer', names: { el: 'Προσφορά', en: 'Offer' }, colour: '#ef4444', text_colour: null, icon: 'tag' },
{ key: 'popular', names: { el: 'Δημοφιλές', en: 'Popular' }, colour: '#f472b6', text_colour: null, icon: 'star' },
{ key: 'spicy', names: { el: 'Καυτερό', en: 'Spicy' }, colour: '#dc2626', text_colour: null, icon: 'flame' },
{ key: 'vegetarian', names: { el: 'Χορτοφαγικό', en: 'Vegetarian' }, colour: '#16a34a', text_colour: null, icon: 'sprout' },
{ key: 'vegan', names: { el: 'Vegan', en: 'Vegan' }, colour: '#15803d', text_colour: null, icon: 'vegan' },
]
/** A product's badges as their definitions (unknown keys left out; one badge stored as `badge` too). */
export function itemBadges(it, defs) {
const list = defs?.length ? defs : DEFAULT_BADGES
const keys = it?.badges?.length ? it.badges : it?.badge ? [it.badge] : []
return keys.map(k => list.find(d => d.key === k)).filter(Boolean)
}
/** A badge's colours on a board: the board's own for all its badges, else the badge's; text that reads. */
export function badgeColours(def, c = {}) {
const background = c.badge_colour || def?.colour || '#f59e0b'
return { background, color: c.badge_text_colour || def?.text_colour || readableOn(background) }
}
/** A badge's name in a language (the board's, else the screen's), else in the other one. */
export function badgeName(def, lang) {
const n = def?.names || {}
return n[lang] || n.el || n.en || def?.key || ''
}
/** A stack part's widgets (a part stored before owner review 4 has one `widget`). */
export function cellWidgets(c) {
return c?.widgets?.length ? c.widgets : c?.widget ? [c.widget] : []