feat(signage): More settings for every widget (opacity, rotation, shadow, border, entrance animation, a logo's fit; text weight, highlight, typing out; date and clock formats; a logo in a QR code)

Folded under each widget card like Text and colours. The TV puts them on the element
that places the widget (fx), animations on translate / scale so its place's transform
stays (an older TV only fades); an entrance animates to the widget's own opacity.
Calibrating: a strict-mode remount no longer ends it. Plan 6R.17, F-115.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-22 15:01:42 +02:00
co-authored by Claude Opus 5.5
parent 1eb7e5e3a9
commit 673113aff7
11 changed files with 444 additions and 26 deletions
+74
View File
@@ -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": {
+74
View File
@@ -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": {
+99 -20
View File
@@ -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]) => (
<div key={i} data-widget={i} style={{ display: 'flex', flexDirection: 'column', alignItems: SELF[widgetAlign(w)], textAlign: widgetAlign(w), ...plate(w, true),
...(w.kind === 'ticker' ? { flex: 1, minWidth: 0, alignSelf: 'stretch', justifyContent: 'center' } : {}) }}>{body}</div>
<div key={i} data-widget={i} ref={animate(w)} style={{ display: 'flex', flexDirection: 'column', alignItems: SELF[widgetAlign(w)], textAlign: widgetAlign(w), ...plate(w, true),
...(w.kind === 'ticker' ? { flex: 1, minWidth: 0, alignSelf: 'stretch', justifyContent: 'center' } : {}), ...fx(w) }}>{body}</div>
))}
</div>
))}
@@ -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 (
<div key={i} data-widget={i} className="absolute" data-testid="signage-w-box" data-tight=""
<div key={i} data-widget={i} ref={animate(w)} className="absolute" data-testid="signage-w-box" data-tight=""
style={{ left: `${w.box.x}%`, top: `${w.box.y}%`, width: 'max-content', color: colour || '#fff', display: 'flex', flexDirection: 'column',
alignItems: SELF[widgetAlign(w)], textAlign: widgetAlign(w), ...plate(w, true) }}>
alignItems: SELF[widgetAlign(w)], textAlign: widgetAlign(w), ...plate(w, true), ...fx(w) }}>
{body}
</div>
)
}
if (w.position === 'custom') {
return (
<div key={i} data-widget={i} className="absolute" data-testid="signage-w-box"
style={{ left: `${w.box.x}%`, top: `${w.box.y}%`, width: `${w.box.w}%`, height: `${w.box.h}%`, containerType: 'size', color: colour || '#fff' }} {...CQ_BOX}>
<div key={i} data-widget={i} ref={animate(w)} className="absolute" data-testid="signage-w-box"
style={{ left: `${w.box.x}%`, top: `${w.box.y}%`, width: `${w.box.w}%`, height: `${w.box.h}%`, containerType: 'size', color: colour || '#fff', boxSizing: 'border-box', ...fx(w) }} {...CQ_BOX}>
<div style={{ width: '100%', height: '100%', display: 'flex', alignItems: VSELF[w.vertical] || 'center', justifyContent: SELF[widgetAlign(w)], textAlign: widgetAlign(w), ...plate(w) }}>
{body}
</div>
@@ -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 (
<div key={i} data-widget={i} className="absolute" style={{ ...CORNER[w.position], ...own, display: 'flex', flexDirection: 'column', color: colour || '#fff', ...plate(w, true) }}>
<div key={i} data-widget={i} ref={animate(w)} className="absolute" style={{ ...CORNER[w.position], ...own, display: 'flex', flexDirection: 'column', color: colour || '#fff', ...plate(w, true), ...fx(w, CORNER[w.position].transform) }}>
{body}
</div>
)
@@ -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 <span style={text(u, 3.4, weight)} data-testid={testid}>{str}</span>
return <span style={text(u, 3.4, weight)} data-testid={testid}>{w.text_effect === 'typewriter' ? <TypeText text={str} /> : str}</span>
}
// 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 <img src={m.src} alt="" style={{ height: cq(+(w.box.h * ts).toFixed(4), 'h'), width: 'auto', display: 'block' }} data-testid="signage-w-logo" />
return fit
? <img src={m.src} alt="" style={{ width: '100%', height: '100%', objectFit: 'contain', objectPosition: OBJECT_POSITION[widgetAlign(w)] }} data-testid="signage-w-logo" />
? <img src={m.src} alt="" style={{ width: '100%', height: '100%', objectFit: w.fit || 'contain', objectPosition: OBJECT_POSITION[widgetAlign(w)] }} data-testid="signage-w-logo" />
: <img src={m.src} alt="" style={{ height: cq(9 * s), maxWidth: cq(30 * s), objectFit: 'contain' }} data-testid="signage-w-logo" />
}
if (w.kind === 'name') {
if (!venue?.name) return null
const u = unit(4.2 * 1.15, textWidth(venue.name.length, 4.2))
return <span style={text(u, 4.2)} data-testid="signage-w-name">{venue.name}</span>
return <span style={text(u, 4.2)} data-testid="signage-w-name">{w.text_effect === 'typewriter' ? <TypeText text={venue.name} /> : venue.name}</span>
}
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 <span style={{ ...text(u, 4.6), fontVariantNumeric: 'tabular-nums' }} data-testid="signage-w-clock">{formatTime(now, w.clock_seconds ? 'timeSeconds' : 'time')}</span>
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 (
<span style={{ ...text(u, 4.6), fontVariantNumeric: 'tabular-nums' }} data-testid="signage-w-clock">
{parts.map((p, n) => <span key={n}>{n > 0 && <span style={{ opacity: hide ? 0 : 1 }}>{sep}</span>}{p}</span>)}
</span>
)
}
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 (
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: u(0.8) }} data-testid="signage-w-qr" data-link={link}>
<div style={{ background: w.qr_background || '#fff', padding: u(1), borderRadius: u(1), lineHeight: 0 }}>
<QRCodeSVG value={link} size={256} fgColor={w.qr_colour || '#000000'} bgColor={w.qr_background || '#ffffff'} style={{ width: u(14), height: u(14) }} />
<QRCodeSVG value={link} size={256} fgColor={w.qr_colour || '#000000'} bgColor={w.qr_background || '#ffffff'} style={{ width: u(14), height: u(14) }}
level={logo ? 'H' : 'M'} imageSettings={logo ? { src: logo.src, width: 64, height: 64, excavate: true } : undefined} />
</div>
{w.qr_caption && <span style={text(u, 2.4)}>{w.qr_caption}</span>}
</div>
@@ -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)}<span style={{ visibility: 'hidden' }}>{text.slice(n)}</span></>
}
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) ? (
<div data-widget={wp} style={{ position: 'absolute', left: `${cw.box.x}%`, top: `${cw.box.y}%`, width: 'max-content', display: 'flex', flexDirection: 'column',
alignItems: SELF[align], textAlign: align, ...plate(cw, true) }} data-testid="signage-w-box" data-tight="">{body}</div>
<div data-widget={wp} ref={animate(cw)} style={{ position: 'absolute', left: `${cw.box.x}%`, top: `${cw.box.y}%`, width: 'max-content', display: 'flex', flexDirection: 'column',
alignItems: SELF[align], textAlign: align, ...plate(cw, true), ...fx(cw) }} data-testid="signage-w-box" data-tight="">{body}</div>
) : own ? (
<div data-widget={wp} style={{ position: 'absolute', left: `${cw.box.x}%`, top: `${cw.box.y}%`, width: `${cw.box.w}%`, height: `${cw.box.h}%`,
containerType: 'size', display: 'flex', alignItems: VSELF[cw.vertical] || 'center', justifyContent: SELF[align], textAlign: align, ...plate(cw) }}
{...CQ_BOX} data-testid="signage-w-box">{body}</div>
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}</div>
) : (
<div data-widget={wp} style={{ display: 'flex', maxWidth: '100%', maxHeight: '100%', ...(cw.kind === 'menu' || cw.kind === 'stack' ? { width: '100%', height: '100%' } : {}), ...plate(cw, true) }}>{body}</div>
<div data-widget={wp} ref={animate(cw)} style={{ display: 'flex', maxWidth: '100%', maxHeight: '100%', ...(cw.kind === 'menu' || cw.kind === 'stack' ? { width: '100%', height: '100%' } : {}), ...plate(cw, true), ...fx(cw) }}>{body}</div>
))}
</div>
)