feat(signage): Slides library, widgets placed on the preview, blank slides, slide editor rework

- Slides library (Alembic 0044, /api/signage/library): slides kept with a name and a
  description, added to playlists as copies ("Add a slide" → Your slides, "Keep in Slides"),
  or shown alone as a screen's default (device config `slide`, played as "slide:<id>",
  also as a schedule's fallback). Signage → Slides: gallery + a two-pane editor.
- Widgets moved and sized by hand on the preview (WidgetCanvas: handles, snapping, arrow
  keys): position/size "custom" with a box the TV draws the same; alignment per widget.
- Blank slides (background + widgets); menu boards narrower and placed left/centre/right.
- Slide editor reworked: name | show, transition effect | seconds; sections; text look on
  one row with ready colours; one card per widget, settings on one row.
- Questions inside the page (@xenia/ui ConfirmDialog/useConfirm), Switch boxed, Segmented
  fill; the timeline's drop line; schedule lines run on weekdays or smart days, not both;
  the playlist editor stays within 1080p with a long timeline.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-21 07:53:27 +02:00
co-authored by Claude Opus 5.5
parent 60e6a16217
commit 83551714f7
46 changed files with 1934 additions and 431 deletions
@@ -0,0 +1,34 @@
// What the two slide editors share (a playlist's slide, a library slide; 2026-11-21): a menu
// board's draft resolved by the server for its preview, and the preview's widget handles.
import { useEffect, useState } from 'react'
import * as api from './signageApi'
import { placeWidget } from './signageLogic'
/** A menu board's products as the server resolves the draft (only what changes the list counts). */
export function useMenuPreview(draft, setDraft) {
const c = draft?.kind === 'menu' ? draft.content || {} : null
const key = c ? JSON.stringify({ ...c, widgets: undefined, background: undefined }) : null
useEffect(() => {
if (!key) return undefined
const h = setTimeout(() => {
api.previewMenu(JSON.parse(key)).then(r => setDraft(d => (d && d.kind === 'menu' ? { ...d, menu: r.menu } : d))).catch(() => {})
}, 400)
return () => clearTimeout(h)
}, [key, setDraft])
}
/**
* The widget picked on the preview and how a move / resize there changes the draft.
* → { widget, setWidget, editor } (editor: SlidePreview's `editor` prop). Picks nothing when the
* slide changes (`slideKey`).
*/
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)) } }
})
return { widget, setWidget, editor: { selected: widget, onSelect: setWidget, onPlace, label } }
}