feat(signage): widget settings regrouped (main / Text and colours / More), alignment that lines up multi-line widgets, multi-line texts, gallery title, logos larger than the slide; calibration past the recognised resolution and shown the first time

Owner review 2026-11-23 of every widget:
- A widget card is its main settings (the row and what needs room under it: pictures, a gallery's
  pictures or folder, weather details and place, a countdown's start and end, reviews' stars and
  author, a scrolling text's speed, a shape's colours and border, QR caption), then "Text and
  colours" (new LookFields.jsx: text colour, plate, font, style, size, weight, highlight, shadow,
  QR colours; a logo's / gallery's border), then More settings (opacity, rotation, animation, fit,
  typing, blink, QR logo; shadow / border only where there is no Text and colours).
- Date format / separator and clock 12/24 / separator are main settings.
- Alignment only where it lines something up; the TV now aligns the lines of a text, the hours
  (centre: days and times meet in the middle), contact rows, Wi-Fi (code left / right / above),
  the weather's column / card / list / hourly, reviews (stars too), a countdown, a QR caption.
- Text and message: a 2-line textarea in its own row; Enter makes new lines (the TV sizes by the
  longest line and the number of lines).
- Gallery: a title above or below the pictures (title_position).
- A widget's box may reach 400 % of the slide (a logo zoomed in past the slide's edges saved again).
- "Auto" stays "Auto" in Greek; scrolling text Left / Right; reviews' stars choice no longer clipped;
  countdown "When it ends" hint as an info tip (fields level).

Calibration: an edge may go past the recognised window (down to -2000 px); the dialog's rows are
centred, "Each click moves" sits above its choice, the window size is labelled "Recognised
resolution" with what it means; the TV asks for its screen answer on every calibrate event and
while calibrating (the outline shows the first time), the dialog sends "on" again after 1.5 s.
NumberInput takes a leading minus when min < 0. E2E: waits for the Add-a-slide dialog to go.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-23 05:40:04 +02:00
co-authored by Claude Opus 5.5
parent 1b111c0e27
commit cd8218689c
20 changed files with 431 additions and 257 deletions
+24 -13
View File
@@ -1541,7 +1541,7 @@
"dragHint": "Η λίστα είναι σε επίπεδα: το widget στην κορυφή σχεδιάζεται πάνω από τα από κάτω, και ένα νέο widget μπαίνει στην κορυφή. Διαλέξτε ένα widget στην προεπισκόπηση ή εδώ, σύρετέ το (ή με τα βέλη) για να το μετακινήσετε και από τις λαβές για να αλλάξετε το μέγεθος· η θέση και το μέγεθος γράφουν τότε «Προσαρμοσμένο».",
"custom": "Προσαρμοσμένο",
"align": "Στοίχιση",
"alignAuto": "Αυτόματη",
"alignAuto": "Auto",
"dateStyle": "Μορφή",
"canvas": "Τα widgets της διαφάνειας: σύρετε ένα για μετακίνηση, τις λαβές για μέγεθος, τα βέλη για μικρές κινήσεις",
"earlier": "Πάνω (σχεδιάζεται κάτω από τα επόμενα)",
@@ -1594,8 +1594,7 @@
"backInPlace": "Πίσω σε στοίχιση",
"vertical": "Κάθετη στοίχιση",
"look": "Κείμενο και χρώματα",
"plateOnly": "Φόντο πίσω του",
"colour": "Χρώμα",
"colour": "Χρώμα κειμένου",
"asSlide": "Όπως η διαφάνεια",
"plate": "Φόντο πίσω του",
"noPlate": "Κανένα",
@@ -1633,8 +1632,8 @@
"text": "Το κείμενο",
"direction": "Κινείται",
"directions": {
"left": "Προς τα αριστερά",
"right": "Προς τα δεξιά"
"left": "Αριστερά",
"right": "Δεξιά"
},
"speed": "Ταχύτητα"
},
@@ -1717,7 +1716,14 @@
"noFolders": "Δεν υπάρχουν φάκελοι πολυμέσων ακόμη.",
"toMedia": "Φτιάξτε έναν στη σελίδα Πολυμέσα",
"add": "Προσθήκη εικόνων ή βίντεο",
"empty": "Η συλλογή είναι άδεια ακόμη: μένει κρυφή."
"empty": "Η συλλογή είναι άδεια ακόμη: μένει κρυφή.",
"title": "Τίτλος",
"titlePlaceholder": "Κανένας",
"titleAt": "Ο τίτλος μπαίνει",
"titleAts": {
"above": "Από πάνω",
"below": "Από κάτω"
}
},
"weatherLayout": "Διάταξη",
"weatherLayouts": {
@@ -1741,7 +1747,8 @@
"weatherHours": "Ώρες",
"weatherPlace": "Η τοποθεσία",
"weatherPlaceLabel": "Δείχνει το όνομά της",
"logoFromIdentity": "Χωρίς εικόνα: εμφανίζεται το λογότυπο του καταστήματος (Ρυθμίσεις → Ταυτότητα)."
"logoFromIdentity": "Χωρίς εικόνα: εμφανίζεται το λογότυπο του καταστήματος (Ρυθμίσεις → Ταυτότητα).",
"enterHint": "Με Enter αλλάζει γραμμή."
},
"tabs": {
"playlists": "Λίστες",
@@ -1986,21 +1993,25 @@
"open": "Βαθμονόμηση εικόνας",
"title": "Βαθμονόμηση εικόνας: {{name}}",
"intro": "Η τηλεόραση δείχνει τώρα τις άκρες της εικόνας με τέσσερα βέλη προς τα έξω. Μετακινήστε κάθε άκρη μέχρι το βέλος της να ακουμπά την άκρη της οθόνης ή διαλέξτε σχήμα. Οι αλλαγές φαίνονται αμέσως στην τηλεόραση.",
"window": "Το παράθυρο της τηλεόρασης: {{w}} × {{h}} px ({{shape}}).",
"window": "{{w}} × {{h}} px ({{shape}})",
"waiting": "Αναμονή για το μέγεθος της τηλεόρασης… Είναι ανοιχτή και δείχνει ψηφιακή σήμανση;",
"presets": "Σχήματα",
"full": "Όλη η οθόνη",
"step": "Κάθε κλικ μετακινεί",
"edges": {
"top": "Πάνω άκρη μέσα",
"right": "Δεξιά άκρη μέσα",
"bottom": "Κάτω άκρη μέσα",
"left": "Αριστερή άκρη μέσα"
"top": "Πάνω άκρη",
"right": "Δεξιά άκρη",
"bottom": "Κάτω άκρη",
"left": "Αριστερή άκρη"
},
"picture": "Η εικόνα: {{w}} × {{h}} px ({{shape}})",
"outside": "Έξω από την εικόνα η τηλεόραση μένει μαύρη.",
"reset": "Ξανά όλη η οθόνη",
"done": "Τέλος"
"done": "Τέλος",
"recognised": "Ανάλυση που αναγνωρίστηκε",
"recognisedHint": "Το μέγεθος που ανέφερε η ίδια η τηλεόραση. Αν η πραγματική της εικόνα είναι μεγαλύτερη ή μικρότερη, αλλάξτε την εδώ με τις άκρες από κάτω.",
"edgesHint": "Θετικός αριθμός φέρνει την άκρη μέσα· αρνητικός τη σπρώχνει έξω, πέρα από την ανάλυση που αναγνωρίστηκε.",
"past": "Μέρος της εικόνας περνά πλέον πέρα από την ανάλυση που αναγνωρίστηκε: αν η τηλεόραση δεν έχει πραγματικά εικόνα εκεί, αυτό το κομμάτι κόβεται."
},
"reviews": {
"title": "Κριτικές",
+23 -12
View File
@@ -1594,8 +1594,7 @@
"backInPlace": "Back to aligned",
"vertical": "Vertical alignment",
"look": "Text and colours",
"plateOnly": "Background plate",
"colour": "Colour",
"colour": "Text colour",
"asSlide": "As the slide",
"plate": "Background plate",
"noPlate": "None",
@@ -1633,8 +1632,8 @@
"text": "The text",
"direction": "Moves",
"directions": {
"left": "To the left",
"right": "To the right"
"left": "Left",
"right": "Right"
},
"speed": "Speed"
},
@@ -1717,7 +1716,14 @@
"noFolders": "No media folders yet.",
"toMedia": "Make one on the Media page",
"add": "Add pictures or videos",
"empty": "Nothing in the gallery yet: it stays hidden."
"empty": "Nothing in the gallery yet: it stays hidden.",
"title": "Title",
"titlePlaceholder": "None",
"titleAt": "Title goes",
"titleAts": {
"above": "Above",
"below": "Below"
}
},
"weatherLayout": "Layout",
"weatherLayouts": {
@@ -1741,7 +1747,8 @@
"weatherHours": "Hours",
"weatherPlace": "The place",
"weatherPlaceLabel": "Show its name",
"logoFromIdentity": "No picture chosen: the venue's logo (Settings → Identity) shows."
"logoFromIdentity": "No picture chosen: the venue's logo (Settings → Identity) shows.",
"enterHint": "Enter starts a new line."
},
"tabs": {
"playlists": "Playlists",
@@ -1986,21 +1993,25 @@
"open": "Calibrate the picture",
"title": "Calibrate the picture: {{name}}",
"intro": "The TV now shows its picture's edges with four arrows pointing out. Move each edge until its arrow just touches the edge of the screen, or pick a shape. Changes show on the TV at once.",
"window": "The TV's window: {{w}} × {{h}} px ({{shape}}).",
"window": "{{w}} × {{h}} px ({{shape}})",
"waiting": "Waiting for the TV to tell its size… Is it on and showing signage?",
"presets": "Shapes",
"full": "Whole screen",
"step": "Each click moves",
"edges": {
"top": "Top edge in",
"right": "Right edge in",
"bottom": "Bottom edge in",
"left": "Left edge in"
"top": "Top edge",
"right": "Right edge",
"bottom": "Bottom edge",
"left": "Left edge"
},
"picture": "The picture: {{w}} × {{h}} px ({{shape}})",
"outside": "Outside the picture the TV stays black.",
"reset": "Whole screen again",
"done": "Done"
"done": "Done",
"recognised": "Recognised resolution",
"recognisedHint": "The size the TV reported for itself. If its real picture is larger or smaller, change it right here with the edges below.",
"edgesHint": "A positive number moves that edge in; a negative one pushes it out, past the recognised resolution.",
"past": "Part of the picture now reaches past the recognised resolution: if the TV really has no picture there, that part is cut off."
},
"reviews": {
"title": "Reviews",
+64 -45
View File
@@ -167,6 +167,7 @@ const CORNER = {
'bottom-right': { bottom: cq(3), right: cq(3), alignItems: 'flex-end' },
}
const SELF = { left: 'flex-start', center: 'center', right: 'flex-end' }
const GRID = { left: 'start', center: 'center', right: 'end' } // a grid's items, by the widget's alignment
const placedBy = w => (w.position === 'custom' && w.box ? (TIGHT.includes(w.kind) ? 'tight' : true) : false)
const VSELF = { top: 'flex-start', middle: 'center', bottom: 'flex-end', auto: 'center' }
/** A widget's own colour and the plate behind it (owner review 5); `pad`: a plate that hugs it. */
@@ -265,7 +266,7 @@ export function Widgets({ widgets, media, venue, now, colour, extras, embed }) {
</div>
)
}
const own = w.align && w.align !== 'auto' ? { alignItems: SELF[w.align], textAlign: w.align } : {}
const own = w.align && w.align !== 'auto' ? { alignItems: SELF[w.align], textAlign: w.align } : { textAlign: widgetAlign(w) }
return (
<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}
@@ -283,9 +284,10 @@ const OBJECT_POSITION = { left: 'left center', center: 'center', right: 'right c
* the slide at size medium); `fit`: the widget fills its place instead (fitUnit: a stack's part);
* fit 'tight' (owner review 6): placed by hand, its box is exactly its content: the box's height
* (× its text size) sets the size and its width follows. `path`: the widget's place in the slide
* ("2", "2.1.0" inside a stack), for its extras.
* ("2", "2.1.0" inside a stack), for its extras. `align`: how its lines line up with each other (owner
* 2026-11-23: the lines of a text, the rows of the hours or contact details, the weather's parts…).
*/
function widgetBody(w, ctx, fit, path) {
function widgetBody(w, ctx, fit, path, align = widgetAlign(w)) {
const { media, venue, now, fmt, extras } = ctx
const { formatDate, formatTime } = fmt
const x = extras[path] || {}
@@ -300,10 +302,12 @@ function widgetBody(w, ctx, fit, path) {
}
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,
textShadow: w.background_colour ? undefined : `0 ${cq(0.2)} ${cq(0.8)} rgba(0,0,0,0.35)`, whiteSpace: fit ? 'pre' : 'pre-line',
...(w.font ? { fontFamily: FONTS[w.font] } : {}), ...(w.italic ? { fontStyle: 'italic' } : {}), ...(w.underline ? { textDecoration: 'underline' } : {}) })
// a text of several lines (Enter, owner 2026-11-23): sized by its longest line and how many there are
const line = (str, testid, weight) => {
const u = unit(3.4 * 1.15, textWidth(str.length, 3.4))
const rows = str.split('\n')
const u = unit(3.4 * 1.15 * rows.length, textWidth(Math.max(...rows.map(r => r.length)), 3.4))
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
@@ -353,7 +357,7 @@ function widgetBody(w, ctx, fit, path) {
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={{ display: 'flex', flexDirection: 'column', alignItems: SELF[align], textAlign: align, 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) }}
level={logo ? 'H' : 'M'} imageSettings={logo ? { src: logo.src, width: 64, height: 64, excavate: true } : undefined} />
@@ -362,7 +366,7 @@ function widgetBody(w, ctx, fit, path) {
</div>
)
}
if (w.kind === 'weather') return weatherBody(w, venue?.weather, unit, text, formatDate, ctx.t)
if (w.kind === 'weather') return weatherBody(w, venue?.weather, unit, text, formatDate, ctx.t, align)
if (w.kind === 'menu') return boxed(<MenuWidget board={w.board || {}} menu={x.menu} now={now} badges={venue?.badges} />, 'menu')
if (w.kind === 'stack') return boxed(<Stack w={w} path={path} ctx={ctx} />, 'stack')
// 6R.15
@@ -382,26 +386,26 @@ function widgetBody(w, ctx, fit, path) {
const label = w.text || ''
const u = unit((label ? 2.4 * 1.15 + 0.4 : 0) + 6 * 1.1, Math.max(textWidth(digits.length, 6) * 0.9, label ? textWidth(label.length, 2.4) : 0))
return (
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'inherit', gap: u(0.4) }} data-testid="signage-w-countdown" data-state={st.state} data-left={st.left}>
<div style={{ display: 'flex', flexDirection: 'column', alignItems: SELF[align], textAlign: align, gap: u(0.4) }} data-testid="signage-w-countdown" data-state={st.state} data-left={st.left}>
{label && <span style={text(u, 2.4, 600)}>{label}</span>}
<span style={{ ...text(u, 6, 800), lineHeight: 1.1, fontVariantNumeric: 'tabular-nums' }}>{digits}</span>
</div>
)
}
if (w.kind === 'hours') return hoursBody(w, ctx, unit, text)
if (w.kind === 'wifi') return wifiBody(w, venue?.identity?.wifi, unit, text)
if (w.kind === 'contact') return contactBody(w, venue?.identity?.contact, unit, text)
if (w.kind === 'hours') return hoursBody(w, ctx, unit, text, align)
if (w.kind === 'wifi') return wifiBody(w, venue?.identity?.wifi, unit, text, align)
if (w.kind === 'contact') return contactBody(w, venue?.identity?.contact, unit, text, align)
if (w.kind === 'gallery') {
const ids = w.gallery_source === 'folder' ? (x.gallery || []) : (w.media_ids || [])
const items = ids.map(id => media(id)).filter(Boolean)
if (!items.length) return null
return boxed(<Gallery w={w} items={items} now={now} />, 'gallery')
return boxed(<Gallery w={w} items={items} now={now} title={w.text ? text(n => cq(+(n * ts).toFixed(3), 'h'), 9, 700) : null} align={align} />, 'gallery')
}
if (w.kind === 'reviews') {
const list = (venue?.reviews || []).filter(r => r.stars >= (w.reviews_min || 4))
if (!list.length) return null
const r = list[pageAt(list.length, w.reviews_seconds || 8, now.getTime())]
return boxed(<ReviewBody w={w} r={r} fmt={fmt} n={list.length} />, 'reviews')
return boxed(<ReviewBody w={w} r={r} fmt={fmt} n={list.length} align={align} />, 'reviews')
}
return null
}
@@ -440,8 +444,11 @@ const GALLERY_IN = {
zoom: [{ opacity: 0, transform: 'scale(1.12)' }, { opacity: 1, transform: 'scale(1)' }],
}
/** A gallery (6R.16): its pictures and videos one after another, each for its seconds, coming in with its transition. */
function Gallery({ w, items, now }) {
/**
* A gallery (6R.16): its pictures and videos one after another, each for its seconds, coming in with
* its transition; its title above or below them (owner 2026-11-23), `title` = the title's text style.
*/
function Gallery({ w, items, now, title, align }) {
const i = pageAt(items.length, w.gallery_seconds || 5, now.getTime())
const m = items[i]
const el = useRef(null)
@@ -453,11 +460,15 @@ function Gallery({ w, items, now }) {
}, [i, frames])
const fit = { width: '100%', height: '100%', objectFit: w.gallery_fit || 'cover', display: 'block' }
return (
<div style={{ width: '100%', height: '100%', overflow: 'hidden', position: 'relative' }} data-testid="signage-w-gallery" data-index={i} data-count={items.length}>
<div key={`${i}-${m.src}`} ref={el} style={{ position: 'absolute', top: 0, right: 0, bottom: 0, left: 0 }}>
{m.kind === 'video'
? <video src={m.src} poster={m.poster} muted autoPlay loop playsInline style={fit} />
: <img src={m.src} alt="" style={fit} />}
<div style={{ width: '100%', height: '100%', display: 'flex', flexDirection: w.title_position === 'below' ? 'column-reverse' : 'column', gap: title ? '2%' : 0 }}
data-testid="signage-w-gallery" data-index={i} data-count={items.length}>
{title && <div style={{ ...title, flexShrink: 0, textAlign: align, overflow: 'hidden', textOverflow: 'ellipsis' }} data-testid="signage-w-gallery-title">{w.text}</div>}
<div style={{ flex: '1 1 0%', minHeight: 0, overflow: 'hidden', position: 'relative' }}>
<div key={`${i}-${m.src}`} ref={el} style={{ position: 'absolute', top: 0, right: 0, bottom: 0, left: 0 }}>
{m.kind === 'video'
? <video src={m.src} poster={m.poster} muted autoPlay loop playsInline style={fit} />
: <img src={m.src} alt="" style={fit} />}
</div>
</div>
</div>
)
@@ -467,7 +478,7 @@ function Gallery({ w, items, now }) {
* One of the venue's reviews (6R.19), the next one every few seconds: its stars, what they wrote,
* who and where. It fills its place: the text is sized from the place's size and the review's length.
*/
function ReviewBody({ w, r, fmt, n }) {
function ReviewBody({ w, r, fmt, n, align }) {
const box = useRef(null)
const [size, setSize] = useState(null)
useEffect(() => {
@@ -483,15 +494,17 @@ function ReviewBody({ w, r, fmt, n }) {
const who = [w.reviews_name !== false && r.name, r.source, r.date && fmt.formatDate(`${r.date}T12:00:00Z`, 'date')].filter(Boolean).join(' · ')
const font = { ...(w.font ? { fontFamily: FONTS[w.font] } : {}), ...(w.italic ? { fontStyle: 'italic' } : {}) }
return (
<div ref={box} style={{ width: '100%', height: '100%', overflow: 'hidden', display: 'flex', flexDirection: 'column', justifyContent: 'center', gap: f * 0.35, ...font }}
<div ref={box} style={{ width: '100%', height: '100%', overflow: 'hidden', display: 'flex', flexDirection: 'column', justifyContent: 'center', textAlign: align, gap: f * 0.35, ...font }}
data-testid="signage-w-reviews" data-count={n} data-name={r.name}>
{size && <>
{w.reviews_stars !== false && (
<div style={{ display: 'flex', gap: f * 0.15, justifyContent: 'inherit' }} aria-label={`${r.stars}/5`}>
<div style={{ display: 'flex', gap: f * 0.15, justifyContent: SELF[align] }} aria-label={`${r.stars}/5`}>
{[1, 2, 3, 4, 5].map(i => <Star key={i} style={{ width: f * 1.1, height: f * 1.1, color: STAR, fill: i <= r.stars ? STAR : 'none', opacity: i <= r.stars ? 1 : 0.4 }} aria-hidden="true" />)}
</div>
)}
<div style={{ fontSize: f, lineHeight: 1.35, fontWeight: w.bold ? 700 : 500, ...(w.underline ? { textDecoration: 'underline' } : {}) }}>“{r.text}”</div>
<div style={{ fontSize: f, lineHeight: 1.35, fontWeight: w.weight || (w.bold ? 700 : 500), ...(w.underline ? { textDecoration: 'underline' } : {}) }}>
<span style={w.highlight ? { background: w.highlight, padding: '0.05em 0.25em', borderRadius: '0.15em', boxDecorationBreak: 'clone', WebkitBoxDecorationBreak: 'clone' } : undefined}>“{r.text}”</span>
</div>
{who && <div style={{ fontSize: f * 0.72, fontWeight: 700, opacity: 0.85 }}>— {who}</div>}
</>}
</div>
@@ -563,7 +576,7 @@ const MONDAY = '2026-11-16' // a Monday: day names from the venue'
const dayShort = (fmt, i) => fmt.formatDate(`2026-11-${16 + i}T12:00:00Z`, 'weekday').slice(0, 3)
/** The opening hours (6R.15): the week (days with the same hours on one line) or today; today stands out. */
function hoursBody(w, ctx, unit, text) {
function hoursBody(w, ctx, unit, text, align = 'left') {
const { venue, now, fmt, t } = ctx
const hours = venue?.hours
if (!hours?.set) return null
@@ -573,14 +586,15 @@ function hoursBody(w, ctx, unit, text) {
const spansText = r => (r.spans.length ? r.spans.map(x => `${x.from}–${x.to}`).join(', ') : t('signage.closed'))
const widest = Math.max(...rows.map(r => daysText(r).length + 2 + spansText(r).length), w.text ? w.text.length : 0)
const u = unit((rows.length + (w.text ? 1.3 : 0)) * 3 * 1.35, textWidth(widest, 3))
// lined up (owner 2026-11-23): left / right: both columns to that side; centre: they meet in the middle
return (
<div style={{ display: 'grid', gridTemplateColumns: 'auto auto', columnGap: u(2), rowGap: u(0.4), alignItems: 'baseline', textAlign: 'left' }}
data-testid="signage-w-hours" data-rows={rows.length} data-start={MONDAY}>
{w.text && <span style={{ ...text(u, 3.4, 800), gridColumn: '1 / -1' }}>{w.text}</span>}
<div style={{ display: 'grid', gridTemplateColumns: 'auto auto', columnGap: u(2), rowGap: u(0.4), alignItems: 'baseline' }}
data-testid="signage-w-hours" data-rows={rows.length} data-start={MONDAY} data-align={align}>
{w.text && <span style={{ ...text(u, 3.4, 800), gridColumn: '1 / -1', textAlign: align }}>{w.text}</span>}
{rows.map(r => (
<span key={r.days.join()} style={{ display: 'contents' }} data-today={r.today ? 'true' : undefined}>
<span style={{ ...text(u, 3, r.today ? 800 : 600), opacity: r.today || w.hours_style === 'today' ? 1 : 0.85 }}>{daysText(r)}</span>
<span style={{ ...text(u, 3, r.today ? 800 : 500), fontVariantNumeric: 'tabular-nums' }}>{spansText(r)}</span>
<span style={{ ...text(u, 3, r.today ? 800 : 600), opacity: r.today || w.hours_style === 'today' ? 1 : 0.85, textAlign: align === 'left' ? 'left' : 'right' }}>{daysText(r)}</span>
<span style={{ ...text(u, 3, r.today ? 800 : 500), fontVariantNumeric: 'tabular-nums', textAlign: align === 'right' ? 'right' : 'left' }}>{spansText(r)}</span>
</span>
))}
</div>
@@ -588,24 +602,29 @@ function hoursBody(w, ctx, unit, text) {
}
/** The guests' Wi-Fi (6R.15, from the identity): its code to join, the network and the password. */
function wifiBody(w, wifi, unit, text) {
function wifiBody(w, wifi, unit, text, align = 'left') {
if (!wifi?.ssid) return null
const qr = w.wifi_qr !== false ? wifiQr(wifi) : ''
const pw = w.wifi_password !== false && wifi.security !== 'nopass' && wifi.password ? wifi.password : ''
const lines = [wifi.ssid, pw, wifi.note].filter(Boolean)
const chars = Math.max(...lines.map(l => l.length)) + 2
const u = unit(Math.max(qr ? 13 : 0, lines.length * 3.4 * 1.35), (qr ? 14.5 : 0) + textWidth(chars, 3.4))
// the code on the left (left), on the right (right), above the text (centre: owner 2026-11-23)
const stacked = align === 'center' && qr
const u = stacked ? unit(13 + 1.5 + lines.length * 3.4 * 1.35, Math.max(13, textWidth(chars, 3.4)))
: unit(Math.max(qr ? 13 : 0, lines.length * 3.4 * 1.35), (qr ? 14.5 : 0) + textWidth(chars, 3.4))
const icon = { width: u(3), height: u(3), flexShrink: 0 }
const row = { display: 'flex', alignItems: 'center', gap: u(0.8), justifyContent: SELF[align] }
return (
<div style={{ display: 'flex', alignItems: 'center', gap: u(1.5), textAlign: 'left' }} data-testid="signage-w-wifi">
<div style={{ display: 'flex', flexDirection: stacked ? 'column' : align === 'right' ? 'row-reverse' : 'row', alignItems: 'center', gap: u(1.5), textAlign: align }}
data-testid="signage-w-wifi" data-align={align}>
{qr && (
<div style={{ background: w.qr_background || '#fff', padding: u(0.7), borderRadius: u(0.8), lineHeight: 0 }}>
<QRCodeSVG value={qr} size={256} fgColor={w.qr_colour || '#000000'} bgColor={w.qr_background || '#ffffff'} style={{ width: u(11.5), height: u(11.5) }} />
</div>
)}
<div style={{ display: 'grid', gap: u(0.5) }}>
<span style={{ display: 'flex', alignItems: 'center', gap: u(0.8), ...text(u, 3.4, 800) }}><Wifi style={icon} aria-hidden="true" />{wifi.ssid}</span>
{pw && <span style={{ display: 'flex', alignItems: 'center', gap: u(0.8), ...text(u, 3.4, 600) }}><Lock style={icon} aria-hidden="true" />{pw}</span>}
<div style={{ display: 'grid', gap: u(0.5), justifyItems: GRID[align] }}>
<span style={{ ...row, ...text(u, 3.4, 800) }}><Wifi style={icon} aria-hidden="true" />{wifi.ssid}</span>
{pw && <span style={{ ...row, ...text(u, 3.4, 600) }}><Lock style={icon} aria-hidden="true" />{pw}</span>}
{wifi.note && <span style={{ ...text(u, 2.6, 500), opacity: 0.85 }}>{wifi.note}</span>}
</div>
</div>
@@ -616,12 +635,12 @@ const CONTACT_ICONS = { phone: Phone, phone2: Phone, email: Mail, address: MapPi
instagram: Camera, tiktok: Music, tripadvisor: Star, whatsapp: MessageCircle, viber: MessageCircle }
/** The venue's contact details (6R.15, from the identity): the chosen ones that are set, one a line with an icon. */
function contactBody(w, contact, unit, text) {
function contactBody(w, contact, unit, text, align = 'left') {
const rows = (w.contact_fields || ['phone', 'website', 'instagram']).filter(k => contact?.[k]).map(k => [k, contact[k]])
if (!rows.length) return null
const u = unit(rows.length * 3.2 * 1.4, textWidth(Math.max(...rows.map(([, v]) => v.length)) + 2, 3.2))
return (
<div style={{ display: 'grid', gap: u(0.6), textAlign: 'left' }} data-testid="signage-w-contact" data-rows={rows.length}>
<div style={{ display: 'grid', gap: u(0.6), justifyItems: GRID[align], textAlign: align }} data-testid="signage-w-contact" data-rows={rows.length} data-align={align}>
{rows.map(([k, v]) => {
const Icon = CONTACT_ICONS[k] || Globe
return (
@@ -640,7 +659,7 @@ function contactBody(w, contact, unit, text) {
* next hours; with the details chosen (feels like, humidity, wind, rain chance, sunrise / sunset,
* UV, in words) and the place's name. Older forecasts without the details just leave them out.
*/
function weatherBody(w, wx, unit, text, formatDate, t) {
function weatherBody(w, wx, unit, text, formatDate, t, align = 'left') {
if (!wx || wx.temperature == null) return null // no internet / no place: hidden (5.4c)
const from = w.weather_from || 0
const style = w.weather_style || 'both'
@@ -678,7 +697,7 @@ function weatherBody(w, wx, unit, text, formatDate, t) {
if (!hours.length) return null
const u = unit((place ? 3.2 : 0) + 3 + 5 + 3.6, hours.length * 9)
return (
<div style={{ display: 'grid', gap: u(0.6) }} data-testid="signage-w-weather" data-layout="hourly">
<div style={{ display: 'grid', gap: u(0.6), justifyItems: GRID[align] }} data-testid="signage-w-weather" data-layout="hourly">
{place && <span style={text(u, 2.6, 700)}>{place}</span>}
<div style={{ display: 'flex', gap: u(1.5) }}>
{hours.map(h => {
@@ -699,7 +718,7 @@ function weatherBody(w, wx, unit, text, formatDate, t) {
const list = days.slice(from, from + (w.weather_days || 3))
const u = unit((place ? 3.4 : 0) + list.length * 4.4, tw(4, 3) + 5 + tw(11, 3) + (want.has('rain') ? tw(5, 3) : 0) + 4)
return (
<div style={{ display: 'grid', gap: u(0.5) }} data-testid="signage-w-weather" data-layout="list">
<div style={{ display: 'grid', gap: u(0.5), justifyItems: GRID[align] }} data-testid="signage-w-weather" data-layout="list">
{place && <span style={text(u, 2.8, 700)}>{place}</span>}
<div style={{ display: 'grid', gridTemplateColumns: `auto auto auto${want.has('rain') ? ' auto' : ''}`, columnGap: u(1.6), rowGap: u(0.6), alignItems: 'center' }}>
{list.map((d, n) => {
@@ -737,7 +756,7 @@ function weatherBody(w, wx, unit, text, formatDate, t) {
const width = Math.max((pic ? 9 : 0) + (deg ? tw(main.label.length, 6) : 0), card ? detailW * 2 * 2.4 * 0.6 + 3 : tw(detailW, 2.6), tw(16, 2.4), place ? tw(place.length, 2.8) : 0)
const u = unit(lines * 4.2 + 3, width + 2)
return (
<div style={{ display: 'grid', gap: u(0.8), justifyItems: 'inherit', ...(card ? { padding: u(1.5), borderRadius: u(1.5), background: w.background_colour ? undefined : 'rgba(0,0,0,0.28)' } : {}) }}
<div style={{ display: 'grid', gap: u(0.8), justifyItems: GRID[align], textAlign: align, ...(card ? { padding: u(1.5), borderRadius: u(1.5), background: w.background_colour ? undefined : 'rgba(0,0,0,0.28)' } : {}) }}
data-testid="signage-w-weather" data-layout={layout} data-style={style} data-from={from}>
{place && <span style={{ ...text(u, 2.8, 700), opacity: 0.9 }}>{place}</span>}
<div style={{ display: 'flex', alignItems: 'center', gap: u(1.5) }}>
@@ -746,11 +765,11 @@ function weatherBody(w, wx, unit, text, formatDate, t) {
</div>
{words && <span style={{ ...text(u, 2.8, 600), opacity: 0.9 }} data-testid="signage-weather-words">{words}</span>}
{details.length > 0 && (
<div style={{ display: 'grid', gridTemplateColumns: card ? 'auto auto' : 'auto', columnGap: u(2), rowGap: u(0.5) }}>
<div style={{ display: 'grid', gridTemplateColumns: card ? 'auto auto' : 'auto', columnGap: u(2), rowGap: u(0.5), justifyItems: GRID[align] }}>
{detailEls({ u, s: 2.6 }, u(0.6))}
</div>
)}
{rest.length > 0 && <div style={{ display: card ? 'flex' : 'grid', gap: u(card ? 1.6 : 0.4), flexWrap: 'wrap' }}>{restEls(u, 2.4)}</div>}
{rest.length > 0 && <div style={{ display: card ? 'flex' : 'grid', gap: u(card ? 1.6 : 0.4), flexWrap: 'wrap', justifyContent: SELF[align], justifyItems: GRID[align] }}>{restEls(u, 2.4)}</div>}
</div>
)
}
@@ -820,7 +839,7 @@ function Stack({ w, path, ctx }) {
const wp = `${cp}.${k}`
const own = cw.position === 'custom' && cw.box
const align = cw.align && cw.align !== 'auto' ? cw.align : 'center'
const body = widgetBody(cw, ctx, own && TIGHT.includes(cw.kind) ? 'tight' : true, wp)
const body = widgetBody(cw, ctx, own && TIGHT.includes(cw.kind) ? 'tight' : true, wp, align)
return (
<div key={k} style={{ flex: '1 1 0%', minWidth: 0, minHeight: 0, overflow: 'hidden', containerType: 'size', position: 'relative',
...(own ? {} : { display: 'flex', alignItems: VSELF[cw.vertical] || 'center', justifyContent: SELF[align], textAlign: align }) }}
+5 -4
View File
@@ -481,10 +481,11 @@ export function fitBox(W, H, ratio) {
/** A screen's picture area in its window: the window minus the calibrated insets (never smaller than 50 px). */
export function pictureArea(win, area = {}) {
const l = Math.max(0, area.left || 0)
const t = Math.max(0, area.top || 0)
const width = Math.max(50, win.w - l - Math.max(0, area.right || 0))
const height = Math.max(50, win.h - t - Math.max(0, area.bottom || 0))
// below 0 an edge reaches past the window the TV reported (owner 2026-11-23): that part is cut off
const l = area.left || 0
const t = area.top || 0
const width = Math.max(50, win.w - l - (area.right || 0))
const height = Math.max(50, win.h - t - (area.bottom || 0))
return { left: l, top: t, width, height }
}
+2
View File
@@ -264,6 +264,8 @@ test('slide shapes: custom ratios, the canvas, the box a slide keeps on any scre
assert.deepEqual([c.left, c.top, c.width, c.height], [0, 60, 1920, 1080])
// calibration: the window minus the insets; the presets centre a shape
assert.deepEqual(pictureArea({ w: 1920, h: 1080 }, { left: 10, top: 0, right: 30, bottom: 20 }), { left: 10, top: 0, width: 1880, height: 1060 })
// below 0 an edge reaches past the window the TV reported (owner 2026-11-23)
assert.deepEqual(pictureArea({ w: 1920, h: 1080 }, { left: -40, top: -10, right: -40, bottom: 0 }), { left: -40, top: -10, width: 2000, height: 1090 })
assert.deepEqual(presetInsets({ w: 2560, h: 1080 }, '16:9'), { left: 320, top: 0, right: 320, bottom: 0 })
assert.deepEqual(presetInsets({ w: 1920, h: 1080 }, 'full'), { left: 0, top: 0, right: 0, bottom: 0 })
assert.equal(shapeName(2560, 1080), '21:9')
+9 -4
View File
@@ -11,11 +11,14 @@ const Icon = ({ d }) => (
* <NumberInput value={seconds} min={1} max={3600} onChange={setSeconds} suffix="s" />
* The field may be emptied while typing: onChange(null). The form shows its own error for an empty
* value and keeps it from being saved. A value over `max` is brought down; under `min`, brought up
* when the field is left. Inside a <Field> it takes the field's id.
* when the field is left. Inside a <Field> it takes the field's id. With a `min` below 0 a minus
* may be typed in front (2026-11-23).
*/
export function NumberInput({ value, onChange, min = 0, max = Infinity, step = 1, suffix, size = 'md', invalid = false, disabled = false, className, id, ...rest }) {
const labels = useLabels()
const [focus, setFocus] = useState(false)
const [draft, setDraft] = useState(null) // "-" typed, no digits yet
const signed = min < 0
const n = value === '' || value == null ? null : Number(value)
const clamp = v => Math.min(max, Math.max(min, v))
const stepBy = d => onChange?.(clamp((n ?? min) + d))
@@ -24,14 +27,16 @@ export function NumberInput({ value, onChange, min = 0, max = Infinity, step = 1
<button type="button" className="x-number__btn" onClick={() => stepBy(-step)} disabled={disabled || (n != null && n <= min)} aria-label={labels.decrease} tabIndex={-1}>
<Icon d="M5 12h14" />
</button>
<input id={id} type="text" inputMode="numeric" className="x-number__input" value={n == null ? '' : String(n)} disabled={disabled}
<input id={id} type="text" inputMode={signed ? 'text' : 'numeric'} className="x-number__input" value={draft ?? (n == null ? '' : String(n))} disabled={disabled}
aria-invalid={invalid || undefined}
onChange={e => {
const minus = signed && /^\s*-/.test(e.target.value)
const digits = e.target.value.replace(/\D/g, '')
onChange?.(digits === '' ? null : Math.min(max, Number(digits)))
setDraft(minus && digits === '' ? '-' : null)
onChange?.(digits === '' ? null : Math.min(max, (minus ? -1 : 1) * Number(digits)))
}}
onFocus={() => setFocus(true)}
onBlur={() => { setFocus(false); if (n != null && n < min) onChange?.(min) }}
onBlur={() => { setFocus(false); setDraft(null); if (n != null && n < min) onChange?.(min) }}
onKeyDown={e => {
if (e.key === 'ArrowUp') { e.preventDefault(); stepBy(step) }
if (e.key === 'ArrowDown') { e.preventDefault(); stepBy(-step) }