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:
@@ -342,6 +342,13 @@
|
||||
.x-switch-row__label { display: block; font-size: var(--x-text-body); line-height: var(--x-leading-body); font-weight: var(--x-weight-medium); color: var(--x-ink); cursor: pointer; }
|
||||
.x-switch-row__description { margin-top: var(--x-space-0-5); font-size: var(--x-text-label); line-height: var(--x-leading-label); color: var(--x-ink-2); }
|
||||
.x-switch-row--disabled .x-switch-row__label { cursor: not-allowed; opacity: 0.6; }
|
||||
/* boxed (2026-11-21): a switch in a row of fields, as tall and as framed as an input beside it */
|
||||
.x-switch-row--boxed {
|
||||
box-sizing: border-box; min-height: var(--x-control-md); padding: var(--x-space-2) var(--x-space-3);
|
||||
background: var(--x-surface); border: var(--x-border-width) solid var(--x-line); border-radius: var(--x-radius-control);
|
||||
}
|
||||
.x-switch-row--boxed .x-switch-row__label { font-size: var(--x-text-label); }
|
||||
.x-confirm__body { font-size: var(--x-text-body); line-height: var(--x-leading-body); color: var(--x-ink-2); }
|
||||
|
||||
/* ── ReasonPicker ───────────────────────────────────────────────────────────── */
|
||||
.x-reasons { display: grid; gap: var(--x-space-2); }
|
||||
@@ -514,6 +521,9 @@
|
||||
border: var(--x-border-width) solid var(--x-line-strong); border-radius: var(--x-radius-control); background: var(--x-surface-2);
|
||||
}
|
||||
.x-segmented--sm { min-height: var(--x-control-sm); }
|
||||
/* fill (2026-11-21): as wide as its column, the options sharing the width */
|
||||
.x-segmented--fill { display: flex; width: 100%; }
|
||||
.x-segmented--fill > .x-segmented__item { flex: 1 1 0; justify-content: center; }
|
||||
.x-segmented__item {
|
||||
display: inline-flex; align-items: center; gap: var(--x-space-1-5); padding: 0 var(--x-space-3);
|
||||
border: 0; border-radius: calc(var(--x-radius-control) - 3px); background: transparent; color: var(--x-ink-2);
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
import { useCallback, useState } from 'react'
|
||||
import { Button } from './Button.jsx'
|
||||
import { Dialog } from './Dialog.jsx'
|
||||
import { useLabels } from './labels.js'
|
||||
|
||||
/**
|
||||
* Asks before doing something: a small dialog inside the page, never the browser's confirm()
|
||||
* (2026-11-21). tone 'danger' for deleting / throwing work away.
|
||||
* <ConfirmDialog open title="Delete this slide?" confirmLabel="Delete" tone="danger"
|
||||
* onConfirm={remove} onCancel={close}>It goes from the playlist.</ConfirmDialog>
|
||||
*/
|
||||
export function ConfirmDialog({ open, title, children, confirmLabel, cancelLabel, tone = 'primary', onConfirm, onCancel, busy = false, testId }) {
|
||||
const labels = useLabels()
|
||||
return (
|
||||
<Dialog open={open} size="sm" title={title} onClose={onCancel}
|
||||
footer={<>
|
||||
<Button variant="secondary" onClick={onCancel} data-testid={testId ? `${testId}-cancel` : 'confirm-cancel'}>{cancelLabel ?? labels.cancel}</Button>
|
||||
<Button variant={tone === 'danger' ? 'danger' : 'primary'} loading={busy} onClick={onConfirm}
|
||||
data-testid={testId ? `${testId}-ok` : 'confirm-ok'}>{confirmLabel ?? labels.submit}</Button>
|
||||
</>}>
|
||||
{children && <div className="x-confirm__body">{children}</div>}
|
||||
</Dialog>
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* The same as a hook that answers with a promise:
|
||||
* const [confirm, confirmDialog] = useConfirm()
|
||||
* if (!(await confirm({ title, body, confirmLabel, tone: 'danger' }))) return
|
||||
* …render {confirmDialog} somewhere in the component.
|
||||
*/
|
||||
export function useConfirm() {
|
||||
const [ask, setAsk] = useState(null)
|
||||
const confirm = useCallback(opts => new Promise(resolve => setAsk({ ...opts, resolve })), [])
|
||||
const answer = value => { ask?.resolve(value); setAsk(null) }
|
||||
const dialog = ask ? (
|
||||
<ConfirmDialog open title={ask.title} confirmLabel={ask.confirmLabel} cancelLabel={ask.cancelLabel} tone={ask.tone} testId={ask.testId}
|
||||
onConfirm={() => answer(true)} onCancel={() => answer(false)}>{ask.body}</ConfirmDialog>
|
||||
) : null
|
||||
return [confirm, dialog]
|
||||
}
|
||||
@@ -42,15 +42,16 @@ export function FilterChip({ pressed = false, tone = 'neutral', count, size = 'm
|
||||
}
|
||||
|
||||
/**
|
||||
* A few mutually exclusive views (List / Map). options: [{ value, label, icon? }].
|
||||
* A few mutually exclusive views (List / Map). options: [{ value, label, icon?, ariaLabel? }]
|
||||
* (ariaLabel: the name of an option shown as an icon only). fill: as wide as its column, the options sharing it.
|
||||
* <Segmented value={view} onChange={setView} options={[…]} aria-label="View" />
|
||||
*/
|
||||
export function Segmented({ options = [], value, onChange, size = 'md', className, ...rest }) {
|
||||
export function Segmented({ options = [], value, onChange, size = 'md', fill = false, className, ...rest }) {
|
||||
return (
|
||||
<div role="group" className={cx('x-segmented', `x-segmented--${size}`, className)} {...rest}>
|
||||
<div role="group" className={cx('x-segmented', `x-segmented--${size}`, fill && 'x-segmented--fill', className)} {...rest}>
|
||||
{options.map(o => (
|
||||
<button key={o.value} type="button" aria-pressed={o.value === value} className={cx('x-segmented__item', o.value === value && 'x-segmented__item--on')}
|
||||
onClick={() => onChange?.(o.value)} data-testid={o.testId}>
|
||||
onClick={() => onChange?.(o.value)} data-testid={o.testId} aria-label={o.ariaLabel} title={o.ariaLabel}>
|
||||
{o.icon}{o.label}
|
||||
</button>
|
||||
))}
|
||||
|
||||
@@ -7,8 +7,9 @@ import { cx } from '../internal/cx.js'
|
||||
* onChange receives the new boolean. Without `label`, pass aria-label.
|
||||
* The whole row (label + description) is clickable.
|
||||
* info: an element right after the label (an <InfoTip>), not after the switch.
|
||||
* boxed: framed and as tall as an input, the text left and the switch right (a switch in a row of fields).
|
||||
*/
|
||||
export function Switch({ checked, onChange, label, description, info, disabled = false, id, className, ...rest }) {
|
||||
export function Switch({ checked, onChange, label, description, info, disabled = false, boxed = false, id, className, ...rest }) {
|
||||
const auto = useId()
|
||||
const switchId = id || auto
|
||||
const descId = `${switchId}-desc`
|
||||
@@ -31,7 +32,7 @@ export function Switch({ checked, onChange, label, description, info, disabled =
|
||||
|
||||
if (!label && !description) return <span className={cx('x-switch-bare', className)}>{control}</span>
|
||||
return (
|
||||
<div className={cx('x-switch-row', disabled && 'x-switch-row--disabled', className)}>
|
||||
<div className={cx('x-switch-row', boxed && 'x-switch-row--boxed', disabled && 'x-switch-row--disabled', className)}>
|
||||
<div className="x-switch-row__text">
|
||||
{label && (
|
||||
<span className="x-switch-row__head">
|
||||
|
||||
@@ -7,6 +7,7 @@ import { createContext, createElement, useContext } from 'react'
|
||||
|
||||
export const DEFAULT_LABELS = {
|
||||
close: 'Close',
|
||||
cancel: 'Cancel',
|
||||
dismiss: 'Dismiss',
|
||||
loading: 'Loading',
|
||||
moreInfo: 'More info',
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
export { Button, IconButton } from './components/Button.jsx'
|
||||
export { Dialog } from './components/Dialog.jsx'
|
||||
export { ConfirmDialog, useConfirm } from './components/ConfirmDialog.jsx'
|
||||
export { Sheet } from './components/Sheet.jsx'
|
||||
export { PrintArea, PrintSheet } from './components/PrintArea.jsx'
|
||||
export { ToastProvider } from './components/Toast.jsx'
|
||||
|
||||
Reference in New Issue
Block a user