feat(manager): signage screens, schedules, the message of the day and the weather's town (platform-v2 step 5.6c)

Signage gets tabs:
- Screens: every paired signage TV with what it plays (a playlist, or a
  schedule that wins over it), its shape and rotation, a warning when a
  playlist was made for the other shape; a link to pair one in Devices.
- Schedules: lines (a playlist on days / between hours that may pass midnight /
  between dates, with a priority) and the playlist for the rest of the time;
  "now: …" per schedule; the screens on it.
- Message and weather: the message of the day for every screen; the
  weather's town from a search (°C / °F), now / fetched at, "no forecast"
  when the server can't reach the service, fetch now, remove; says the
  weather needs internet and the widget hides without it.
- e2e signage.mjs +6 (message saved, weather section, choosing a playlist and
  turning the picture move the TV, a schedule built in the manager plays what
  it picks now); a crash is reported as a failed check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 23:20:44 +02:00
co-authored by Claude Opus 5.5
parent 5f6b51fb8b
commit 6c982e3139
9 changed files with 518 additions and 8 deletions
@@ -1,6 +1,6 @@
// Signage (plan steps 5.6a-c): the venue's playlists for its TVs. Pick one to edit its timeline
// and slides; make a new one for a landscape or a portrait screen. Which screen plays what, the
// schedules, the message of the day and the weather's place: the other tabs (5.6c).
// Signage (plan steps 5.6a-c): the venue's playlists for its TVs (pick one to edit its timeline and
// slides; make a new one for a landscape or a portrait screen), which screen plays what, the
// schedules, the message of the day and the weather's town: one tab each.
// Backend: /api/signage (routers/signage.py).
import { useCallback, useEffect, useState } from 'react'
import toast from 'react-hot-toast'
@@ -10,12 +10,18 @@ import { useTranslation } from '@xenia/i18n'
import { Button, Dialog, EmptyState, Field, Input, Select, Spinner } from '@xenia/ui'
import * as api from './signageApi'
import PlaylistEditor from './PlaylistEditor'
import SchedulesTab from './SchedulesTab'
import ScreensTab from './ScreensTab'
import SignageSettingsTab from './SignageSettingsTab'
const TABS = ['playlists', 'screens', 'schedules', 'settings']
export default function SignagePage() {
const { t } = useTranslation('manager')
const [list, setList] = useState(null)
const [current, setCurrent] = useState(null)
const [creating, setCreating] = useState(false)
const [tab, setTab] = useState('playlists')
const load = useCallback(async () => {
try { const l = await api.listPlaylists(); setList(l); return l } catch (err) { toast.error(errorMessage(err, t)); return null }
@@ -28,7 +34,19 @@ export default function SignagePage() {
<h1 className="text-heading font-semibold text-ink">{t('signage.pageTitle')}</h1>
<p className="text-body text-ink-2 max-w-3xl">{t('signage.intro')}</p>
</header>
{!list ? <div className="flex justify-center p-6"><Spinner /></div> : (
<div className="flex flex-wrap gap-1 border-b border-line" role="tablist" aria-label={t('signage.pageTitle')}>
{TABS.map(k => (
<button key={k} type="button" role="tab" aria-selected={tab === k} onClick={() => setTab(k)} data-testid={`signage-tab-${k}`}
className={`px-3 py-2 -mb-px border-b-2 text-label font-medium transition-colors duration-fast
${tab === k ? 'border-accent text-accent-ink' : 'border-transparent text-ink-2 hover:text-ink'}`}>
{t(`signage.tabs.${k}`)}
</button>
))}
</div>
{tab === 'screens' && <ScreensTab />}
{tab === 'schedules' && <SchedulesTab />}
{tab === 'settings' && <SignageSettingsTab />}
{tab !== 'playlists' ? null : !list ? <div className="flex justify-center p-6"><Spinner /></div> : (
<div className="grid gap-5 xl:grid-cols-[14rem_1fr]">
<nav className="grid gap-2 content-start" aria-label={t('signage.playlists')}>
<span className="text-label font-medium text-ink-2">{t('signage.playlists')}</span>