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:
@@ -3,7 +3,7 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import { WIDGET_HOSTS } from '@xenia/signage'
|
||||
import * as api from './signageApi'
|
||||
import { placeWidget } from './signageLogic'
|
||||
import { placeWidget, updateWidgetAt } from './signageLogic'
|
||||
|
||||
// what doesn't change what the server adds (where things sit, how they look): left out of the key
|
||||
const LOOK = new Set(['box', 'position', 'size', 'align', 'background', 'text_colour', 'accent_colour', 'font', 'text_size',
|
||||
@@ -43,12 +43,10 @@ export function useWidgetEditor(setDraft, slideKey, label) {
|
||||
const [state, setState] = useState({ key: slideKey, widget: null })
|
||||
const widget = state.key === slideKey ? state.widget : null
|
||||
const setWidget = w => setState({ key: slideKey, widget: w })
|
||||
const onPlace = (i, box) => setDraft(d => {
|
||||
const ws = d?.content?.widgets || []
|
||||
return { ...d, content: { ...d.content, widgets: ws.map((w, j) => (j === i ? placeWidget(w, box) : w)) } }
|
||||
})
|
||||
const onRemove = i => {
|
||||
setDraft(d => ({ ...d, content: { ...d.content, widgets: (d?.content?.widgets || []).filter((_, j) => j !== i) } }))
|
||||
// `widget` is a path: "2", or "2.1.0" for a widget inside a stack's part (owner review 5)
|
||||
const onPlace = (path, box) => setDraft(d => ({ ...d, content: { ...d.content, widgets: updateWidgetAt(d?.content?.widgets || [], path, w => placeWidget(w, box)) } }))
|
||||
const onRemove = path => {
|
||||
setDraft(d => ({ ...d, content: { ...d.content, widgets: updateWidgetAt(d?.content?.widgets || [], path, () => null) } }))
|
||||
setWidget(null)
|
||||
}
|
||||
return { widget, setWidget, editor: { selected: widget, onSelect: setWidget, onPlace, onRemove, label } }
|
||||
|
||||
Reference in New Issue
Block a user