feat(signage): menus play whole rounds, seconds fields with − / +, widget limit setting, widgets as big as their content (owner review 6)
- A menu board with pages plays whole rounds (menuMs rounds its seconds up); the editor says how long it really plays under "Seconds on screen", the card and the playlist total use it. - Seconds on screen / per page: shared NumberInput (− / +, may be emptied: an error under the field and Save blocked until filled; 1 s at least, server ge=1). - Performance (Signage -> Message & settings): widgets per slide (signage.max_widgets, 10 recommended, up to 50), checked by the server (signage.too_many_widgets) and the editor. - Text, clock, date, QR, weather, logo placed by hand: the box is exactly the content (its height x text size sets the size, the width follows; handles scale keeping the shape; text size grows the box); a slide's widget may run off the slide while 5 % stays on it. - Slider: the value as close to the slider as the frame's padding; floor and table-colour sliders use the shared Slider. Timeline cards' ring no longer clipped; larger playlist buttons. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -130,7 +130,7 @@ export function nextSlide(slides, current, local) {
|
||||
/** How long a slide stays, in ms; null = until its video ends (with a safety limit in the player). */
|
||||
export function slideMs(slide) {
|
||||
if (slide.kind === 'video' && slide.video_to_end) return null
|
||||
return Math.max(2, slide.duration_s || 10) * 1000
|
||||
return Math.max(1, slide.duration_s || 10) * 1000
|
||||
}
|
||||
|
||||
/** The frame's size and turn for a screen: CSS for the box that holds the slides. */
|
||||
@@ -215,14 +215,17 @@ export function menuPages(groups, perPage, headings = true) {
|
||||
|
||||
/** A menu slide's time: every page for its seconds, at least the slide's own time. */
|
||||
export function menuMs(slide, pageCount) {
|
||||
const per = Math.max(3, slide.content?.page_seconds || 10) * 1000
|
||||
return Math.max(slideMs(slide), pageCount > 1 ? pageCount * per : 0)
|
||||
// owner review 6 (2026-11-21): a board with pages plays whole rounds of them, never cut in the
|
||||
// middle: its seconds on screen rounded up to the next full round (10 s, 2 pages of 3 s → 12 s)
|
||||
if (!(pageCount > 1)) return slideMs(slide)
|
||||
const round = pageCount * Math.max(1, slide.content?.page_seconds || 10) * 1000
|
||||
return Math.max(1, Math.ceil(slideMs(slide) / round)) * round
|
||||
}
|
||||
|
||||
/** The page on screen `elapsedMs` into the slide (the pages go round while the slide lasts). */
|
||||
export function pageAt(pageCount, pageSeconds, elapsedMs) {
|
||||
if (pageCount <= 1 || !(elapsedMs > 0)) return 0 // the clock's last tick may be just before the slide began
|
||||
return Math.floor(elapsedMs / (Math.max(3, pageSeconds || 10) * 1000)) % pageCount // round and round while the slide lasts
|
||||
return Math.floor(elapsedMs / (Math.max(1, pageSeconds || 10) * 1000)) % pageCount // round and round while the slide lasts
|
||||
}
|
||||
|
||||
/** A weather code (WMO, as Open-Meteo sends it) → an icon name for the widget. */
|
||||
@@ -258,6 +261,10 @@ export function visibleGroups(groups) {
|
||||
|
||||
// ── widgets placed by hand (owner 2026-11-21) ─────────────────────────────────
|
||||
|
||||
/** Widgets whose box, placed by hand, is exactly their content (owner review 6): its height (× the
|
||||
* widget's text size) sets the size, its width follows. A menu or a stack fills its box. */
|
||||
export const TIGHT = ['logo', 'name', 'date', 'clock', 'message', 'text', 'qr', 'weather']
|
||||
|
||||
/** The slide kinds that carry widgets. */
|
||||
export const WIDGET_HOSTS = ['text', 'menu', 'blank']
|
||||
|
||||
|
||||
Reference in New Issue
Block a user