feat(signage): new widgets (shape, scrolling text, countdown, opening hours, Wi-Fi, contact details); the venue's opening hours on the server, edited on the Schedule page
Shapes: rectangle, circle, triangle, polygon, star or own corners, fill or gradient, border. Countdown: to a time every day or a date, from now / a span before / a set time, in venue time (the slide shows what is left right now). Opening hours, Wi-Fi (with a join-the-network code) and contact details read the venue's identity and opening hours (GET/PUT /api/identity/hours; Schedule -> Opening hours, shaded on its timeline); the editor warns with a link when they're missing. Plan 6R.15, F-112. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -100,8 +100,17 @@ export function inOpening(hour, open, close) {
|
||||
return a <= b ? hour >= a && hour < b : hour >= a || hour < b
|
||||
}
|
||||
|
||||
/** Is an hour mark inside any of a day's opening spans ([{from, to}], 6R.15: the venue's hours, kept on the server)? */
|
||||
export const inSpans = (hour, spans) => (spans || []).some(x => inOpening(hour, x.from, x.to))
|
||||
|
||||
/** Monday 0 … Sunday 6 of a "YYYY-MM-DD". */
|
||||
export const weekdayOf = d => (new Date(`${d}T12:00:00Z`).getUTCDay() + 6) % 7
|
||||
|
||||
/** Opening hours that can be saved: every span has both times and they differ. */
|
||||
export const hoursValid = days => days.every(d => d.every(x => /^\d\d:\d\d$/.test(x.from || '') && /^\d\d:\d\d$/.test(x.to || '') && x.from !== x.to))
|
||||
|
||||
/** The schedule's view settings kept in this browser (a per-viewer convenience). */
|
||||
export const VIEW_DEFAULTS = { view: 'people', mondayFirst: true, firstHour: 6, open: '', close: '' }
|
||||
export const VIEW_DEFAULTS = { view: 'people', mondayFirst: true, firstHour: 6 }
|
||||
const VIEW_KEY = 'xenia:schedule:view'
|
||||
export function loadView(storage = globalThis.localStorage) {
|
||||
try { return { ...VIEW_DEFAULTS, ...JSON.parse(storage?.getItem(VIEW_KEY) || '{}') } } catch { return { ...VIEW_DEFAULTS } }
|
||||
|
||||
Reference in New Issue
Block a user