feat: the venue's identity in every app: its colour as the accent of the waiters' phones and every terminal screen, customer display looks on the identity, the signage logo widget falls back to the venue's logo
Settings -> Venue -> accent "The venue's identity" (venue.theme = identity): bootstrap carries the identity's first colour and logos; @xenia/ui applyVenueTheme makes the accent tokens (light and dark, readable foregrounds) from it. A display look's "Colours and logo" can be the venue's identity. Plan 6R.20, F-117. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+13
-3
@@ -6,11 +6,11 @@
|
||||
// retries by itself while the server can't be reached (unattended screens)
|
||||
// Terminal pairing → sign-in → the device's own app, or a "can't run" screen
|
||||
// The screen follows the device, not the URL; only the dev pages have routes.
|
||||
import { lazy, Suspense } from 'react'
|
||||
import { lazy, Suspense, useEffect } from 'react'
|
||||
import { BrowserRouter, Route, Routes } from 'react-router-dom'
|
||||
import { AccessProvider } from '@xenia/access'
|
||||
import { AccessProvider, useAccess } from '@xenia/access'
|
||||
import { createI18n } from '@xenia/i18n'
|
||||
import { Spinner, ToastProvider } from '@xenia/ui'
|
||||
import { applyVenueTheme, Spinner, ToastProvider } from '@xenia/ui'
|
||||
import client from './api/client'
|
||||
import DeviceProvider from './device/DeviceProvider'
|
||||
import { useDevice } from './device/context'
|
||||
@@ -30,12 +30,22 @@ function Root() {
|
||||
return (
|
||||
<AccessProvider client={client} token={sessionKey} i18n={i18n} loading={loading} autoRetryMs={AUTO_RETRY_MS}>
|
||||
<ToastProvider placement="bottom-center">
|
||||
<VenueAccent />
|
||||
<Terminal />
|
||||
</ToastProvider>
|
||||
</AccessProvider>
|
||||
)
|
||||
}
|
||||
|
||||
/** The venue's own colour as the accent of every screen when the venue chose it (6R.20, Settings →
|
||||
* Venue → "The venue's identity"); otherwise the screens keep their own accent. */
|
||||
function VenueAccent() {
|
||||
const venue = useAccess()?.venue
|
||||
const colour = venue?.theme === 'identity' ? venue?.identity?.colour : null
|
||||
useEffect(() => { applyVenueTheme(colour ? 'identity' : null, colour) }, [colour])
|
||||
return null
|
||||
}
|
||||
|
||||
export default function App() {
|
||||
return (
|
||||
<BrowserRouter>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// change re-reads it (`display.settings`). GET /api/display/state on start and reconnect.
|
||||
import { useCallback, useEffect, useRef, useState } from 'react'
|
||||
import { useFormat, useTranslation } from '@xenia/i18n'
|
||||
import { applyTheme, getStoredTheme } from '@xenia/ui'
|
||||
import { applyTheme, applyVenueTheme, getStoredTheme } from '@xenia/ui'
|
||||
import { QrCode } from '@xenia/ui/qr'
|
||||
import client from '../../api/client'
|
||||
import { useLiveEvent, useLiveEvents } from '../../device/context'
|
||||
@@ -45,6 +45,13 @@ export default function CustomerDisplayApp() {
|
||||
applyTheme(theme)
|
||||
return () => { applyTheme(getStoredTheme()) }
|
||||
}, [theme])
|
||||
// a look on the venue's identity (6R.20): its colour is the accent while the display shows it
|
||||
const accent = data?.idle?.accent
|
||||
useEffect(() => {
|
||||
if (!accent) return undefined
|
||||
applyVenueTheme('identity', accent)
|
||||
return () => { applyVenueTheme(null) }
|
||||
}, [accent])
|
||||
|
||||
if (!data) return <main className="absolute inset-0 bg-canvas" data-testid="app-customer_display" />
|
||||
const view = viewOf(state, receivedAt, now)
|
||||
|
||||
@@ -109,6 +109,13 @@ export default function SignageApp() {
|
||||
}, [calib])
|
||||
|
||||
const kept = useKeptMedia(useMemo(() => mediaUrls(data), [data]))
|
||||
// the venue's logos from the TV's kept copies too (a logo widget without its own picture, 6R.20)
|
||||
const venue = useMemo(() => {
|
||||
const v = data?.venue
|
||||
const logos = v?.identity?.logos
|
||||
if (!logos) return v
|
||||
return { ...v, identity: { ...v.identity, logos: Object.fromEntries(Object.entries(logos).map(([k, l]) => [k, l && { ...l, card: kept[l.card] || l.card }])) } }
|
||||
}, [data, kept])
|
||||
const playlist = playlistNow(data, now)
|
||||
const tz = data?.schedule?.timezone
|
||||
const screen = data?.screen
|
||||
@@ -122,7 +129,7 @@ export default function SignageApp() {
|
||||
data-testid="signage-area" data-area={`${pic.left},${pic.top},${pic.width},${pic.height}`}>
|
||||
<div style={frameStyle(screen?.rotation, pic)} {...CQ_BOX} data-testid="signage-frame" data-rotation={screen?.rotation ?? 0}>
|
||||
{playlist?.slides?.length
|
||||
? <Player key={playlist.id} playlist={playlist} kept={kept} tz={tz} venue={data?.venue} now={now} frame={frame} fit={screen?.fit} />
|
||||
? <Player key={playlist.id} playlist={playlist} kept={kept} tz={tz} venue={venue} now={now} frame={frame} fit={screen?.fit} />
|
||||
: <Empty text={data ? t('signage.nothing') : t('signage.starting')} />}
|
||||
</div>
|
||||
{calibrating && <Calibration pic={pic} name={screen?.name} />}
|
||||
|
||||
Reference in New Issue
Block a user