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
@@ -1,13 +1,16 @@
// A slide drawn exactly as the TV draws it (@xenia/signage), in a box of the playlist's shape
// (plan step 5.6a). The slide is laid out on a full-size 1920 × 1080 (or 1080 × 1920) frame and
// scaled down to the box, so text, rows and menu pages match a real TV, not a small window.
// `editor` = { selected, onSelect, onPlace, label } (2026-11-21): the widgets can be picked, moved
// and sized on it (WidgetCanvas).
import { useEffect, useRef, useState } from 'react'
import { boardPages, SlideView } from '@xenia/signage'
import { boardPages, SlideView, WIDGET_HOSTS } from '@xenia/signage'
import WidgetCanvas from './WidgetCanvas'
const LONG = 1920
const SHORT = 1080
export default function SlidePreview({ slide, media, venue, orientation = 'landscape', page = 0, playing = false, className = '', testid = 'signage-preview' }) {
export default function SlidePreview({ slide, media, venue, orientation = 'landscape', page = 0, playing = false, className = '', testid = 'signage-preview', editor = null }) {
const [now, setNow] = useState(() => new Date())
const box = useRef(null)
const [scale, setScale] = useState(0)
@@ -29,12 +32,19 @@ export default function SlidePreview({ slide, media, venue, orientation = 'lands
}, [w])
const pages = slide?.kind === 'menu' ? boardPages(slide, 0, w, h) : null
return (
<div ref={box} className={`relative overflow-hidden rounded-control bg-black ${className}`} data-testid={testid} data-orientation={orientation}
<div ref={box} className={`relative rounded-control ${className}`} data-testid={testid} data-orientation={orientation}
style={{ aspectRatio: tall ? '9 / 16' : '16 / 9' }}>
{slide && scale > 0 && (
<div style={{ position: 'absolute', top: 0, left: 0, width: w, height: h, transform: `scale(${scale})`, transformOrigin: 'top left', containerType: 'size' }}>
<SlideView slide={slide} media={media} venue={venue} now={now} pages={pages} page={Math.min(page, (pages?.length || 1) - 1)} playing={playing} />
</div>
{/* the slide is clipped to its frame; the editor's handles may stick out of it */}
<div className="absolute inset-0 overflow-hidden rounded-control bg-black">
{slide && scale > 0 && (
<div style={{ position: 'absolute', top: 0, left: 0, width: w, height: h, transform: `scale(${scale})`, transformOrigin: 'top left', containerType: 'size' }}>
<SlideView slide={slide} media={media} venue={venue} now={now} pages={pages} page={Math.min(page, (pages?.length || 1) - 1)} playing={playing} />
</div>
)}
</div>
{editor && slide && scale > 0 && WIDGET_HOSTS.includes(slide.kind) && (
<WidgetCanvas boxRef={box} widgets={slide.content?.widgets || []} selected={editor.selected} onSelect={editor.onSelect}
onPlace={editor.onPlace} label={editor.label} />
)}
</div>
)