diff --git a/local_backend/routers/signage.py b/local_backend/routers/signage.py
index b0cc1f9..33b621f 100644
--- a/local_backend/routers/signage.py
+++ b/local_backend/routers/signage.py
@@ -256,7 +256,7 @@ class Widget(_Strict):
size: Literal["small", "medium", "large", "custom"] = "medium"
box: Optional[Box] = None # position "custom"
align: Literal["auto", "left", "center", "right"] = "auto" # inside its place; auto: by its corner / box
- media_id: Optional[int] = None # logo: a picture
+ media_id: Optional[int] = None # logo: a picture; QR: a logo in its middle (6R.17)
text: Optional[str] = Field(default=None, max_length=500) # message: this text instead of the venue's; text, ticker, a countdown's / hours' title
date_style: Literal["short", "long"] = "long"
clock_seconds: bool = False
@@ -323,6 +323,27 @@ class Widget(_Strict):
gallery_seconds: int = Field(default=5, ge=3, le=120)
gallery_transition: Literal["fade", "slide", "zoom", "none"] = "fade"
gallery_fit: Literal["cover", "contain"] = "cover"
+ # more settings (6R.17), every widget: on the element that places it
+ opacity: int = Field(default=100, ge=10, le=100)
+ rotation: int = Field(default=0, ge=-180, le=180)
+ shadow: Literal["none", "soft", "strong", "glow"] = "none"
+ shadow_colour: Optional[str] = Field(default=None, pattern=HEX)
+ border_width: int = Field(default=0, ge=0, le=20) # tenths of a usual unit
+ border_colour: Optional[str] = Field(default=None, pattern=HEX)
+ border_radius: int = Field(default=0, ge=0, le=100) # tenths of a usual unit
+ animation: Literal["none", "fade", "rise", "drop", "slide-left", "slide-right", "zoom", "pop", "pulse", "float"] = "none"
+ animation_delay: int = Field(default=0, ge=0, le=50) # tenths of a second
+ fit: Literal["contain", "cover", "fill"] = "contain" # a logo / picture in its box
+ # texts
+ weight: Optional[int] = Field(default=None, ge=100, le=900) # None: as the widget usually is (bold switch)
+ highlight: Optional[str] = Field(default=None, pattern=HEX) # a marker behind the text
+ text_effect: Literal["none", "typewriter"] = "none"
+ # dates and clocks
+ date_format: Optional[Literal["long", "short", "weekday", "day_month", "weekday_day_month", "numeric", "numeric_short", "iso"]] = None
+ date_separator: Optional[Literal["/", ".", "-", " "]] = None
+ clock_format: Literal["24", "12"] = "24"
+ clock_separator: Literal[":", "."] = ":"
+ clock_blink: bool = False
@model_validator(mode="after")
def _place(self):
diff --git a/local_backend/tests/test_identity.py b/local_backend/tests/test_identity.py
index 748a35b..39d3acf 100644
--- a/local_backend/tests/test_identity.py
+++ b/local_backend/tests/test_identity.py
@@ -99,3 +99,20 @@ def test_reviews_typed_in_by_hand(client, owner_h, screens, sent):
assert client.get("/api/signage/reviews", headers=owner_h).json()["reviews"][1]["name"] == "John"
assert client.put("/api/signage/reviews", headers=owner_h, json={"reviews": [{"name": "x", "stars": 6, "text": "y"}]}).status_code == 422
assert client.put("/api/signage/reviews", headers=owner_h, json={"reviews": [{"name": "x", "stars": 5, "text": ""}]}).status_code == 422
+
+
+def test_more_settings_of_widgets(client, owner_h, media_dir):
+ from tests.test_signage import playlist, slide
+ logo = up(client, owner_h, jpeg(200, 200)).json()
+ p = playlist(client, owner_h)
+ w = {"kind": "date", "opacity": 60, "rotation": -15, "shadow": "glow", "border_width": 4, "border_colour": "#ff0000", "border_radius": 20,
+ "animation": "pop", "animation_delay": 5, "weight": 300, "highlight": "#ffff0080", "text_effect": "typewriter",
+ "date_format": "numeric", "date_separator": "."}
+ q = {"kind": "qr", "media_id": logo["id"], "clock_format": "12", "clock_blink": True}
+ s = slide(client, owner_h, p["id"], "blank", content={"widgets": [w, q]})
+ got = s["content"]["widgets"][0]
+ assert {k: got[k] for k in w} == w
+ assert s["content"]["widgets"][1]["media_id"] == logo["id"]
+ for bad in ({"kind": "date", "opacity": 5}, {"kind": "date", "animation": "spin"}, {"kind": "date", "date_separator": "|"}, {"kind": "clock", "weight": 1000}):
+ r = client.post(f"/api/signage/playlists/{p['id']}/slides", headers=owner_h, json={"kind": "blank", "content": {"widgets": [bad]}})
+ assert err(r) == "signage.content_invalid", bad
diff --git a/manager_dashboard/src/pages/signage/CalibrateDialog.jsx b/manager_dashboard/src/pages/signage/CalibrateDialog.jsx
index c6ec00e..daeb5aa 100644
--- a/manager_dashboard/src/pages/signage/CalibrateDialog.jsx
+++ b/manager_dashboard/src/pages/signage/CalibrateDialog.jsx
@@ -24,10 +24,13 @@ export default function CalibrateDialog({ screen, onClose, onSaved }) {
const timer = useRef(null)
const latest = useRef(area)
- // on while open; off when closed
+ // on while open; off when closed (a moment later, so a remount, as React's strict mode does in
+ // development, never sends "off" after "on")
+ const alive = useRef(0)
useEffect(() => {
+ const mine = ++alive.current
api.calibrateScreen(screen.id, true).catch(err => toast.error(errorMessage(err, t)))
- return () => { api.calibrateScreen(screen.id, false).catch(() => {}) }
+ return () => { setTimeout(() => { if (alive.current === mine) api.calibrateScreen(screen.id, false).catch(() => {}) }, 300) }
}, [screen.id]) // eslint-disable-line react-hooks/exhaustive-deps
// the TV's window size (it reports it when it starts and when it changes)
useEffect(() => {
diff --git a/manager_dashboard/src/pages/signage/MoreSettings.jsx b/manager_dashboard/src/pages/signage/MoreSettings.jsx
new file mode 100644
index 0000000..a98b102
--- /dev/null
+++ b/manager_dashboard/src/pages/signage/MoreSettings.jsx
@@ -0,0 +1,121 @@
+// "More settings" of a widget (6R.17, owner 2026-11-22), folded away like "Text and colours":
+// for every widget its opacity, rotation (steps or any angle), shadow, border and an entrance
+// animation; a logo's fit; for texts the weight, a highlight behind them and typing themselves out;
+// date and clock formats; a logo in the middle of a QR code. The TV draws them (Slides.jsx `fx`,
+// `animate`, `dateText`).
+import { useState } from 'react'
+import { ChevronDown, SlidersHorizontal } from 'lucide-react'
+import { useTranslation } from '@xenia/i18n'
+import { ColourField, Dropdown, Field, FieldRow, Segmented, Slider, Switch } from '@xenia/ui'
+import { MediaPick } from './SignageFields'
+import { moreChanged, WIDGET_COLOURS } from './signageLogic'
+
+const TEXTS = ['name', 'date', 'clock', 'message', 'text', 'countdown', 'hours', 'wifi', 'contact', 'ticker', 'reviews', 'weather']
+const TYPED = ['name', 'message', 'text']
+const ANIMATIONS = ['none', 'fade', 'rise', 'drop', 'slide-left', 'slide-right', 'zoom', 'pop', 'pulse', 'float']
+const DELAYS = [0, 5, 10, 15, 20, 30, 50]
+const WEIGHTS = [100, 200, 300, 400, 500, 600, 700, 800, 900]
+const DATE_FORMATS = ['long', 'weekday_day_month', 'day_month', 'weekday', 'numeric', 'numeric_short', 'iso']
+
+export default function MoreSettings({ w, set, media = {}, onMedia }) {
+ const { t } = useTranslation('manager')
+ const [open, setOpen] = useState(false)
+ const k = 'signage.more'
+ const text = TEXTS.includes(w.kind)
+ const numeric = ['numeric', 'numeric_short', 'iso'].includes(w.date_format)
+ return (
+
+
setOpen(o => !o)} aria-expanded={open} data-testid="signage-widget-more-toggle"
+ className="justify-self-start flex items-center gap-1.5 text-label font-medium text-ink-2 hover:text-ink">
+ {t(`${k}.title`)}
+ {moreChanged(w) && }
+
+
+ {open && (
+
+ set({ opacity })} testId="signage-more-opacity" />
+
+ set({ rotation })}
+ options={[0, 90, 180, -90].map(r => ({ value: r, label: `${r}°` }))} data-testid="signage-more-rotation-steps" />
+
+ set({ rotation })} testId="signage-more-rotation" />
+
+ set({ shadow })} data-testid="signage-more-shadow"
+ options={['none', 'soft', 'strong', 'glow'].map(x => ({ value: x, label: t(`${k}.shadows.${x}`) }))} />
+
+ {w.shadow && w.shadow !== 'none' && (
+ set({ shadow_colour })}
+ auto={{ label: t(`${k}.usual`), on: !w.shadow_colour, pick: () => set({ shadow_colour: null }) }} />
+ )}
+ set({ border_width })} testId="signage-more-border" />
+ {w.border_width > 0 && (
+ set({ border_colour })} />
+ )}
+ set({ border_radius })} />
+
+ set({ animation })} data-testid="signage-more-animation"
+ options={ANIMATIONS.map(x => ({ value: x, label: t(`${k}.animations.${x}`) }))} />
+
+ {w.animation && w.animation !== 'none' && !['pulse', 'float'].includes(w.animation) && (
+
+ set({ animation_delay: Number(v) })}
+ options={DELAYS.map(d => ({ value: d, label: t(`${k}.seconds`, { n: d / 10 }) }))} />
+
+ )}
+ {w.kind === 'logo' && (
+
+ set({ fit })}
+ options={['contain', 'cover', 'fill'].map(x => ({ value: x, label: t(`${k}.fits.${x}`) }))} />
+
+ )}
+ {text && (
+
+ set({ weight: v === '' ? null : Number(v) })} data-testid="signage-more-weight"
+ options={[{ value: '', label: t(`${k}.usual`) }, ...WEIGHTS.map(n => ({ value: n, label: t(`${k}.weights.${n}`) }))]} />
+
+ )}
+ {text && (
+ set({ highlight })} testId="signage-more-highlight"
+ auto={{ label: t(`${k}.noHighlight`), on: !w.highlight, pick: () => set({ highlight: null }) }} />
+ )}
+ {TYPED.includes(w.kind) && (
+
+ set({ text_effect: on ? 'typewriter' : 'none' })}
+ label={t(`${k}.typewriter`)} data-testid="signage-more-typewriter" />
+
+ )}
+ {w.kind === 'date' && (
+
+ set({ date_format })} data-testid="signage-more-date-format"
+ options={DATE_FORMATS.map(x => ({ value: x, label: t(`${k}.dateFormats.${x}`) }))} />
+
+ )}
+ {w.kind === 'date' && numeric && (
+
+ set({ date_separator })}
+ options={['/', '.', '-', ' '].map(x => ({ value: x, label: x === ' ' ? t(`${k}.space`) : x }))} />
+
+ )}
+ {w.kind === 'clock' && <>
+
+ set({ clock_format })} data-testid="signage-more-clock-format"
+ options={['24', '12'].map(x => ({ value: x, label: t(`${k}.clockFormats.${x}`) }))} />
+
+
+ set({ clock_separator })} options={[':', '.'].map(x => ({ value: x, label: x }))} />
+
+
+ set({ clock_blink })} label={t(`${k}.blinkLabel`)} />
+
+ >}
+ {w.kind === 'qr' && (
+
+ { onMedia?.(item); set({ media_id: item.id }) }} onRemove={() => set({ media_id: null })} />
+
+ )}
+
+ )}
+
+ )
+}
diff --git a/manager_dashboard/src/pages/signage/WidgetsEditor.jsx b/manager_dashboard/src/pages/signage/WidgetsEditor.jsx
index c444aea..b87fa34 100644
--- a/manager_dashboard/src/pages/signage/WidgetsEditor.jsx
+++ b/manager_dashboard/src/pages/signage/WidgetsEditor.jsx
@@ -37,6 +37,7 @@ import MessageOfTheDay from './MessageOfTheDay'
import { usePerformance } from './usePerformance'
import * as api from './signageApi'
import MenuEditor from './MenuEditor'
+import MoreSettings from './MoreSettings'
import { MoreBelowFields as MoreBelow, MoreInlineFields as MoreInline } from './MoreWidgetFields'
import { MediaPick, Section } from './SignageFields'
import {
@@ -138,6 +139,7 @@ export default function WidgetsEditor({ widgets = [], onChange, media, onMedia,
set(i, patch)} />
set(i, patch)} />
+ set(i, patch)} media={media} onMedia={onMedia} />
set(i, patch)} media={media} onMedia={onMedia} extras={extras} path={String(i)} depth={0}
selected={selected} onSelect={onSelect} />
@@ -463,6 +465,7 @@ function StackFields({ w, set, media, onMedia, extras, path, depth, selected, on
)}
+
)
diff --git a/manager_dashboard/src/pages/signage/signageLogic.js b/manager_dashboard/src/pages/signage/signageLogic.js
index 437d932..e0f476c 100644
--- a/manager_dashboard/src/pages/signage/signageLogic.js
+++ b/manager_dashboard/src/pages/signage/signageLogic.js
@@ -410,3 +410,12 @@ export const MENU_LOOK_DEFAULTS = {
/** Line spacing (× the text) and letter spacing (em) offered beside "Auto". */
export const LINE_HEIGHTS = [0.9, 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.75, 2, 2.5]
export const LETTER_SPACINGS = [-0.05, -0.02, 0.02, 0.05, 0.1, 0.15, 0.2, 0.3]
+
+// a widget's "More settings" (6R.17)
+/** Has any of these been changed from the usual? (the dot on the toggle) */
+export function moreChanged(w) {
+ return !!((w.opacity ?? 100) < 100 || w.rotation || (w.shadow && w.shadow !== 'none') || w.border_width || w.border_radius
+ || (w.animation && w.animation !== 'none') || w.weight || w.highlight || (w.text_effect && w.text_effect !== 'none')
+ || w.date_format || w.date_separator || w.clock_format === '12' || (w.clock_separator && w.clock_separator !== ':') || w.clock_blink
+ || (w.kind === 'qr' && w.media_id) || (w.fit && w.fit !== 'contain'))
+}
diff --git a/manager_dashboard/tests/signage.test.mjs b/manager_dashboard/tests/signage.test.mjs
index 74f5908..4638971 100644
--- a/manager_dashboard/tests/signage.test.mjs
+++ b/manager_dashboard/tests/signage.test.mjs
@@ -1,7 +1,7 @@
// The signage editor's helpers (plan step 5.6a).
import { test } from 'node:test'
import assert from 'node:assert/strict'
-import { fitsOrientation, mediaEntry, misfits, moved, slideBody, slideFromTemplate, TEMPLATES, totalSeconds, windowParts } from '../src/pages/signage/signageLogic.js'
+import { fitsOrientation, moreChanged, mediaEntry, misfits, moved, slideBody, slideFromTemplate, TEMPLATES, totalSeconds, windowParts } from '../src/pages/signage/signageLogic.js'
test('templates fill their texts in the manager\'s language and copy their content', () => {
const tpl = TEMPLATES.find(x => x.key === 'happyHour')
@@ -119,3 +119,12 @@ test('owner review 6: a box off the slide (a strip stays), a tight box scaled ke
assert.equal(secondsMissing({ kind: 'blank', duration_s: 5, content: { widgets: [{ kind: 'stack', cells: [{ widgets: [{ kind: 'menu', board: { page_seconds: null } }] }] }] } }), true)
assert.equal(secondsMissing({ kind: 'menu', duration_s: 5, content: { page_seconds: 3 } }), false)
})
+
+test("a widget's More settings: changed or as usual (6R.17)", () => {
+ assert.equal(moreChanged({ kind: 'clock' }), false)
+ assert.equal(moreChanged({ kind: 'clock', opacity: 100, shadow: 'none', animation: 'none', clock_separator: ':' }), false)
+ assert.equal(moreChanged({ kind: 'clock', clock_format: '12' }), true)
+ assert.equal(moreChanged({ kind: 'date', rotation: -15 }), true)
+ assert.equal(moreChanged({ kind: 'qr', media_id: 4 }), true)
+ assert.equal(moreChanged({ kind: 'logo', media_id: 4 }), false)
+})
diff --git a/packages/i18n/locales/el/manager.json b/packages/i18n/locales/el/manager.json
index b2d6902..10d80e4 100644
--- a/packages/i18n/locales/el/manager.json
+++ b/packages/i18n/locales/el/manager.json
@@ -1978,6 +1978,80 @@
"name": "Όνομα",
"source": "Πού",
"date": "Ημερομηνία"
+ },
+ "more": {
+ "title": "Περισσότερες ρυθμίσεις",
+ "opacity": "Αδιαφάνεια",
+ "rotation": "Περιστροφή",
+ "angle": "Οποιαδήποτε γωνία",
+ "shadow": "Σκιά",
+ "shadows": {
+ "none": "Καμία",
+ "soft": "Απαλή",
+ "strong": "Έντονη",
+ "glow": "Λάμψη"
+ },
+ "shadowColour": "Χρώμα σκιάς",
+ "usual": "Όπως συνήθως",
+ "border": "Περίγραμμα",
+ "borderColour": "Χρώμα περιγράμματος",
+ "radius": "Στρογγυλεμένες γωνίες",
+ "animation": "Εμφανίζεται με",
+ "animations": {
+ "none": "Τίποτα (απλώς εκεί)",
+ "fade": "Σβήσιμο",
+ "rise": "Άνοδο",
+ "drop": "Πτώση",
+ "slide-left": "Κύλιση από δεξιά",
+ "slide-right": "Κύλιση από αριστερά",
+ "zoom": "Μεγέθυνση",
+ "pop": "Αναπήδηση",
+ "pulse": "Παλμό, συνέχεια",
+ "float": "Αιώρηση, συνέχεια"
+ },
+ "delay": "Μετά από",
+ "seconds": "{{n}} δ.",
+ "fits": {
+ "contain": "Ολόκληρο (χωράει μέσα)",
+ "cover": "Γεμίζει το πλαίσιο (κομμένο)",
+ "fill": "Τεντωμένο στο πλαίσιο"
+ },
+ "weight": "Πάχος",
+ "weights": {
+ "100": "Πολύ λεπτά",
+ "200": "Πολύ ελαφριά",
+ "300": "Ελαφριά",
+ "400": "Κανονικά",
+ "500": "Μεσαία",
+ "600": "Ημι-έντονα",
+ "700": "Έντονα",
+ "800": "Πολύ έντονα",
+ "900": "Μαύρα"
+ },
+ "highlight": "Επισήμανση",
+ "noHighlight": "Χωρίς επισήμανση",
+ "typing": "Όταν εμφανίζεται",
+ "typewriter": "Γράφεται γράμμα-γράμμα",
+ "dateFormat": "Μορφή ημερομηνίας",
+ "dateFormats": {
+ "long": "Κυριακή 22 Νοεμβρίου 2026",
+ "weekday_day_month": "Κυριακή 22 Νοεμβρίου",
+ "day_month": "22 Νοεμβρίου",
+ "weekday": "Κυριακή",
+ "numeric": "22/11/2026",
+ "numeric_short": "22/11",
+ "iso": "2026-11-22"
+ },
+ "separator": "Διαχωριστικό",
+ "space": "Κενό",
+ "clockFormat": "Ρολόι",
+ "clockFormats": {
+ "24": "24ωρο",
+ "12": "12ωρο (π.μ. / μ.μ.)"
+ },
+ "blink": "Διαχωριστικό",
+ "blinkLabel": "Αναβοσβήνει κάθε δευτερόλεπτο",
+ "qrLogo": "Λογότυπο στη μέση του κωδικού"
}
},
"overview": {
diff --git a/packages/i18n/locales/en/manager.json b/packages/i18n/locales/en/manager.json
index b114bdc..ddbbf2f 100644
--- a/packages/i18n/locales/en/manager.json
+++ b/packages/i18n/locales/en/manager.json
@@ -1978,6 +1978,80 @@
"name": "Name",
"source": "Where",
"date": "Date"
+ },
+ "more": {
+ "title": "More settings",
+ "opacity": "Opacity",
+ "rotation": "Turn",
+ "angle": "Any angle",
+ "shadow": "Shadow",
+ "shadows": {
+ "none": "None",
+ "soft": "Soft",
+ "strong": "Strong",
+ "glow": "Glow"
+ },
+ "shadowColour": "Shadow colour",
+ "usual": "As usual",
+ "border": "Border",
+ "borderColour": "Border colour",
+ "radius": "Rounded corners",
+ "animation": "Comes in with",
+ "animations": {
+ "none": "Nothing (just there)",
+ "fade": "Fade",
+ "rise": "Rise",
+ "drop": "Drop",
+ "slide-left": "Slide from the right",
+ "slide-right": "Slide from the left",
+ "zoom": "Zoom",
+ "pop": "Pop",
+ "pulse": "Pulse, all the time",
+ "float": "Float, all the time"
+ },
+ "delay": "After",
+ "seconds": "{{n}} s",
+ "fits": {
+ "contain": "Whole (fits inside)",
+ "cover": "Fills the box (cropped)",
+ "fill": "Stretched to the box"
+ },
+ "weight": "Weight",
+ "weights": {
+ "100": "Thin",
+ "200": "Extra light",
+ "300": "Light",
+ "400": "Regular",
+ "500": "Medium",
+ "600": "Semi-bold",
+ "700": "Bold",
+ "800": "Extra bold",
+ "900": "Black"
+ },
+ "highlight": "Highlight",
+ "noHighlight": "No highlight",
+ "typing": "When it appears",
+ "typewriter": "Types itself out",
+ "dateFormat": "Date format",
+ "dateFormats": {
+ "long": "Sunday 22 November 2026",
+ "weekday_day_month": "Sunday 22 November",
+ "day_month": "22 November",
+ "weekday": "Sunday",
+ "numeric": "22/11/2026",
+ "numeric_short": "22/11",
+ "iso": "2026-11-22"
+ },
+ "separator": "Separator",
+ "space": "Space",
+ "clockFormat": "Clock",
+ "clockFormats": {
+ "24": "24 hours",
+ "12": "12 hours (am / pm)"
+ },
+ "blink": "Separator",
+ "blinkLabel": "Blinks every second",
+ "qrLogo": "A logo in the middle of the code"
}
},
"overview": {
diff --git a/packages/signage/src/Slides.jsx b/packages/signage/src/Slides.jsx
index 0c15181..12d5434 100644
--- a/packages/signage/src/Slides.jsx
+++ b/packages/signage/src/Slides.jsx
@@ -174,6 +174,45 @@ const plate = (w, pad) => ({
...(w.colour ? { color: w.colour } : {}),
...(w.background_colour ? { background: w.background_colour, borderRadius: cq(1.2), ...(pad ? { padding: `${cq(0.8)} ${cq(1.6)}` } : {}) } : {}),
})
+// ── a widget's more settings (6R.17): opacity, rotation, shadow, border, an entrance animation ──
+const SHADOWS = { soft: [0.3, 1.2], strong: [0.6, 2.4], glow: [0, 2] }
+/** Its look on the element that places it (wrapper): `base` = the transform its place already has. */
+function fx(w, base) {
+ const out = {}
+ if (w.opacity != null && w.opacity < 100) out.opacity = w.opacity / 100
+ if (w.shadow && w.shadow !== 'none') {
+ const [y, blur] = SHADOWS[w.shadow] || SHADOWS.soft
+ out.filter = `drop-shadow(0 ${cq(y)} ${cq(blur)} ${w.shadow_colour || (w.shadow === 'glow' ? '#ffffffcc' : '#00000099')})`
+ }
+ if (w.border_width) out.border = `${cq(+(w.border_width / 10).toFixed(2))} solid ${w.border_colour || '#ffffff'}`
+ if (w.border_radius) out.borderRadius = cq(+(w.border_radius / 10).toFixed(2))
+ const t = [base, w.rotation ? `rotate(${w.rotation}deg)` : null].filter(Boolean).join(' ')
+ if (t) out.transform = t
+ return out
+}
+// entrance animations (on `translate` / `scale`, so its place's `transform` stays; an older TV only fades)
+const ANIMATIONS = {
+ fade: [[{ opacity: 0 }, { opacity: 1 }], {}],
+ rise: [[{ opacity: 0, translate: '0 30%' }, { opacity: 1, translate: '0 0' }], {}],
+ drop: [[{ opacity: 0, translate: '0 -30%' }, { opacity: 1, translate: '0 0' }], {}],
+ 'slide-left': [[{ opacity: 0, translate: '40% 0' }, { opacity: 1, translate: '0 0' }], {}],
+ 'slide-right': [[{ opacity: 0, translate: '-40% 0' }, { opacity: 1, translate: '0 0' }], {}],
+ zoom: [[{ opacity: 0, scale: '0.6' }, { opacity: 1, scale: '1' }], {}],
+ pop: [[{ opacity: 0, scale: '0.3' }, { opacity: 1, scale: '1.12', offset: 0.7 }, { opacity: 1, scale: '1' }], {}],
+ pulse: [[{ scale: '1' }, { scale: '1.06' }, { scale: '1' }], { duration: 2000, iterations: Infinity }],
+ float: [[{ translate: '0 0' }, { translate: '0 -4%' }, { translate: '0 0' }], { duration: 3000, iterations: Infinity }],
+}
+/** A ref that starts its animation when the widget appears (again when the animation is changed). */
+const animate = w => el => {
+ const name = w.animation && w.animation !== 'none' ? `${w.animation}:${w.animation_delay || 0}` : ''
+ if (!el || el.dataset.xAnim === name || !el.animate) return
+ el.dataset.xAnim = name
+ el.getAnimations?.().forEach(a => a.cancel())
+ const a = ANIMATIONS[w.animation]
+ const to = (w.opacity ?? 100) / 100 // it comes in to its own opacity
+ if (a) el.animate(a[0].map(f => (f.opacity === 1 ? { ...f, opacity: to } : f)), { duration: 800, easing: 'ease-out', fill: 'backwards', delay: (w.animation_delay || 0) * 100, ...a[1] })
+}
+
// a menu, a stack, a shape or a scrolling text in a corner or a bar has no box of its own: it gets one of this size (cqmin)
const BOXED = { menu: [48, 56], stack: [60, 36], shape: [18, 18], ticker: [80, 7], reviews: [56, 24], gallery: [40, 30] }
@@ -200,8 +239,8 @@ export function Widgets({ widgets, media, venue, now, colour, extras, embed }) {
style={{ ...pos, display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: cq(3), padding: `${cq(2)} ${cq(4)}`,
background: 'rgba(0,0,0,0.35)', color: colour || '#fff', minHeight: cq(9) }}>
{bar(where).map(([w, i, body]) => (
- {body}
+ {body}
))}
))}
@@ -209,17 +248,17 @@ export function Widgets({ widgets, media, venue, now, colour, extras, embed }) {
if (w.position === 'custom' && TIGHT.includes(w.kind)) {
// as big as what it shows, from its box's top-left corner (it may run off the slide)
return (
-
+ alignItems: SELF[widgetAlign(w)], textAlign: widgetAlign(w), ...plate(w, true), ...fx(w) }}>
{body}
)
}
if (w.position === 'custom') {
return (
-
+
{body}
@@ -228,7 +267,7 @@ export function Widgets({ widgets, media, venue, now, colour, extras, embed }) {
}
const own = w.align && w.align !== 'auto' ? { alignItems: SELF[w.align], textAlign: w.align } : {}
return (
-
+
{body}
)
@@ -259,12 +298,13 @@ function widgetBody(w, ctx, fit, path) {
const f = fitUnit(height, width)
return n => f(n * Math.min(1, ts))
}
- const text = (u, size, weight = 700) => ({ fontSize: u(size), fontWeight: w.bold === false ? 400 : w.bold ? Math.max(weight, 800) : weight, lineHeight: 1.15,
+ const text = (u, size, weight = 700) => ({ fontSize: u(size), fontWeight: w.weight || (w.bold === false ? 400 : w.bold ? Math.max(weight, 800) : weight), lineHeight: 1.15,
+ ...(w.highlight ? { background: w.highlight, padding: '0.05em 0.25em', borderRadius: '0.15em', boxDecorationBreak: 'clone', WebkitBoxDecorationBreak: 'clone' } : {}),
textShadow: w.background_colour ? undefined : `0 ${cq(0.2)} ${cq(0.8)} rgba(0,0,0,0.35)`, whiteSpace: fit ? 'nowrap' : undefined,
...(w.font ? { fontFamily: FONTS[w.font] } : {}), ...(w.italic ? { fontStyle: 'italic' } : {}), ...(w.underline ? { textDecoration: 'underline' } : {}) })
const line = (str, testid, weight) => {
const u = unit(3.4 * 1.15, textWidth(str.length, 3.4))
- return
{str}
+ return
{w.text_effect === 'typewriter' ? : str}
}
// a menu or a stack fills a box: its own, or (in a corner / bar) one of a usual size
const boxed = (body, kind) => (fit ? body : (
@@ -275,18 +315,28 @@ function widgetBody(w, ctx, fit, path) {
if (!m) return null
if (fit === 'tight') return
return fit
- ?
+ ?
:
}
if (w.kind === 'name') {
if (!venue?.name) return null
const u = unit(4.2 * 1.15, textWidth(venue.name.length, 4.2))
- return
{venue.name}
+ return
{w.text_effect === 'typewriter' ? : venue.name}
}
- if (w.kind === 'date') return line(formatDate(now, w.date_style === 'short' ? 'date' : 'dateLong'), 'signage-w-date')
+ if (w.kind === 'date') return line(dateText(fmt, now, w), 'signage-w-date')
if (w.kind === 'clock') {
- const u = unit(4.6 * 1.15, textWidth(w.clock_seconds ? 8 : 5, 4.6)) // its usual width: the size stays as the minutes turn
- return
{formatTime(now, w.clock_seconds ? 'timeSeconds' : 'time')}
+ const twelve = w.clock_format === '12'
+ const u = unit(4.6 * 1.15, textWidth((w.clock_seconds ? 8 : 5) + (twelve ? 3 : 0), 4.6)) // its usual width: the size stays as the minutes turn
+ const raw = twelve ? fmt.formatDateTime(now, { hour: 'numeric', minute: '2-digit', ...(w.clock_seconds ? { second: '2-digit' } : {}), hour12: true })
+ : formatTime(now, w.clock_seconds ? 'timeSeconds' : 'time')
+ const sep = w.clock_separator || ':'
+ const parts = raw.split(/[:.]/)
+ const hide = w.clock_blink && now.getSeconds() % 2 === 1
+ return (
+
+ {parts.map((p, n) => {n > 0 && {sep} }{p} )}
+
+ )
}
if (w.kind === 'message') {
const msg = w.text || venue?.message
@@ -296,12 +346,14 @@ function widgetBody(w, ctx, fit, path) {
if (w.kind === 'qr') {
const link = x.link || w.link
if (!link) return null
+ const logo = w.media_id ? media(w.media_id) : null // 6R.17: a logo in its middle
const caption = w.qr_caption ? 2.4 * 1.15 + 0.8 : 0
const u = unit(16 + caption, Math.max(16, w.qr_caption ? textWidth(w.qr_caption.length, 2.4) : 0))
return (
-
+
{w.qr_caption &&
{w.qr_caption} }
@@ -351,6 +403,33 @@ function widgetBody(w, ctx, fit, path) {
return null
}
+/** A text that types itself out when it appears (6R.17), about 18 letters a second. */
+function TypeText({ text }) {
+ const [n, setN] = useState(0)
+ useEffect(() => {
+ setN(0)
+ const id = setInterval(() => setN(k => (k >= text.length ? (clearInterval(id), k) : k + 1)), 55)
+ return () => clearInterval(id)
+ }, [text])
+ // the rest is there but hidden, so the widget keeps its size while it types
+ return <>{text.slice(0, n)}
{text.slice(n)} >
+}
+
+const DATE_FORMATS = {
+ long: 'dateLong', short: 'date', weekday: 'weekday',
+ day_month: { day: 'numeric', month: 'long' },
+ weekday_day_month: { weekday: 'long', day: 'numeric', month: 'long' },
+ numeric: { day: '2-digit', month: '2-digit', year: 'numeric' },
+ numeric_short: { day: '2-digit', month: '2-digit' },
+}
+/** A date widget's text (6R.17): its format, and the separator of a numeric one. */
+function dateText(fmt, now, w) {
+ const f = w.date_format || (w.date_style === 'short' ? 'short' : 'long')
+ if (f === 'iso') return fmt.formatDateTime(now, { year: 'numeric', month: '2-digit', day: '2-digit' }).split(/\D+/).filter(Boolean).reverse().join(w.date_separator || '-')
+ const out = fmt.formatDateTime(now, DATE_FORMATS[f] || 'dateLong')
+ return (f === 'numeric' || f === 'numeric_short' || f === 'short') && w.date_separator ? out.split(/\D+/).filter(Boolean).join(w.date_separator) : out
+}
+
const STAR = '#fbbf24'
const GALLERY_IN = {
fade: [{ opacity: 0 }, { opacity: 1 }],
@@ -645,14 +724,14 @@ function Stack({ w, path, ctx }) {
...(own ? {} : { display: 'flex', alignItems: VSELF[cw.vertical] || 'center', justifyContent: SELF[align], textAlign: align }) }}
{...CQ_BOX} data-testid="signage-stack-place" data-place={wp}>
{body && (own && TIGHT.includes(cw.kind) ? (
-
{body}
+
{body}
) : own ? (
{body}
+ containerType: 'size', display: 'flex', alignItems: VSELF[cw.vertical] || 'center', justifyContent: SELF[align], textAlign: align, ...plate(cw), ...fx(cw) }}
+ {...CQ_BOX} ref={animate(cw)} data-testid="signage-w-box">{body}
) : (
-
{body}
+
{body}
))}
)
diff --git a/tests/e2e/signage.mjs b/tests/e2e/signage.mjs
index 2f5f067..22192fc 100644
--- a/tests/e2e/signage.mjs
+++ b/tests/e2e/signage.mjs
@@ -594,11 +594,13 @@ try {
const wl = await api('POST', '/api/signage/playlists', { token: boss, body: { name: 'New widgets', orientation: 'landscape' } })
await api('POST', `/api/signage/playlists/${wl.id}/slides`, { token: boss, body: { kind: 'blank', duration_s: 60, content: { widgets: [
{ kind: 'shape', position: 'custom', box: { x: 2, y: 2, w: 10, h: 15 }, shape: 'star' },
- { kind: 'countdown', position: 'top-center', countdown_to: '2099-01-01T00:00', text: 'Opening in' },
+ { kind: 'countdown', position: 'top-center', countdown_to: '2099-01-01T00:00', text: 'Opening in', opacity: 60, rotation: 10, shadow: 'strong', animation: 'pop' },
{ kind: 'hours', position: 'top-left' }, { kind: 'wifi', position: 'bottom-right' }, { kind: 'contact', position: 'bottom-left' },
{ kind: 'ticker', position: 'top-bar', text: 'Fresh fish today' },
{ kind: 'reviews', position: 'custom', box: { x: 30, y: 40, w: 40, h: 25 } },
- { kind: 'gallery', position: 'custom', box: { x: 75, y: 30, w: 20, h: 20 }, gallery_source: 'folder', gallery_folder: dishes.id }] } } })
+ { kind: 'gallery', position: 'custom', box: { x: 75, y: 30, w: 20, h: 20 }, gallery_source: 'folder', gallery_folder: dishes.id },
+ { kind: 'date', position: 'custom', box: { x: 5, y: 80, w: 20, h: 6 }, date_format: 'numeric', date_separator: '.' },
+ { kind: 'clock', position: 'custom', box: { x: 30, y: 80, w: 20, h: 6 }, clock_format: '12', clock_separator: '.' }] } } })
await api('PUT', `/api/signage/screens/${dev.id}`, { token: boss, body: { playlist_id: wl.id } })
const widgetsOn = async () => (await Promise.all(['shape', 'countdown', 'hours', 'wifi', 'contact', 'ticker', 'reviews', 'gallery'].map(k => tv.getByTestId(`signage-w-${k}`).count()))).every(n => n === 1)
r.check('6R.15: a shape, a countdown, the opening hours, Wi-Fi (from the identity), contact details and a scrolling text on the TV',
@@ -607,6 +609,12 @@ try {
&& await tv.getByTestId('signage-w-wifi').locator('svg').count() > 0)
r.check('6R.16: a gallery of a media folder shows its picture (kept on the TV)', await tv.getByTestId('signage-w-gallery').getAttribute('data-count') === '1'
&& (await tv.getByTestId('signage-w-gallery').locator('img').getAttribute('src')).startsWith('blob:'))
+ await sleep(1200) // its entrance (pop) is over
+ const cdBox = await tv.getByTestId('signage-w-countdown').evaluate(el => { const b = el.closest('[data-widget]'); const cs = getComputedStyle(b); return { o: cs.opacity, t: cs.transform, f: cs.filter } })
+ r.check('6R.17: More settings on the TV: opacity, turned, a shadow', cdBox.o === '0.6' && cdBox.t !== 'none' && cdBox.f.includes('drop-shadow'), JSON.stringify(cdBox))
+ const dateTxt = await tv.getByTestId('signage-w-date').textContent()
+ const clockTxt = await tv.getByTestId('signage-w-clock').textContent()
+ r.check('6R.17: a numeric date with dots, a 12-hour clock with a dot', /^\d\d\.\d\d\.\d{4}$/.test(dateTxt) && /^\d{1,2}\.\d\d\s?(am|pm|AM|PM|π\.μ\.|μ\.μ\.)$/i.test(clockTxt), `${dateTxt} | ${clockTxt}`)
r.check('6R.19: a review typed in by hand shows (the 2-star one is left out)', await tv.getByTestId('signage-w-reviews').getAttribute('data-count') === '1'
&& (await tv.getByTestId('signage-w-reviews').textContent()).includes('Best octopus'))
r.check('6R.15: the countdown runs (days left to 2099)', /^\d+d \d\d:\d\d:\d\d$/.test((await tv.getByTestId('signage-w-countdown').textContent()).replace('Opening in', '').trim()))