From 14d592d9639cf440c2da9c19ad77e50986a59b50 Mon Sep 17 00:00:00 2001 From: bonamin Date: Sat, 21 Nov 2026 17:26:16 +0200 Subject: [PATCH] feat(terminal): older TVs get a legacy build with a compatibility layer; modern output unchanged - @vitejs/plugin-legacy: browsers without import.meta.resolve (older than Chrome 105 / Firefox 106 / Safari 16.4) load a second copy built for Chrome 79 / Firefox 78 / Safari 13 with polyfills. The modern targets and the stylesheet stay on Vite's own defaults, so modern chunks are byte-identical to before (only plugin-legacy's 230-byte guard in the entry). - terminal/src/compat.js (legacy copy only): swaps in .compat.css (lightningcss for the older targets), sets container-size variables for signage slides, emulates flex gap. - @xenia/signage cq()/CQ_BOX: container units as before where supported, calc(var()) fallback otherwise; EmbeddedSlide no longer uses inline `inset`. - Shared Notice (@xenia/ui); "Devices that work" in Pair a device and Signage -> Screens (EN/EL). - tests/e2e/compat.mjs: modern browser loads nothing extra; a simulated older TV runs the legacy copy and the layer, pairs, and plays a slide at the same sizes. Co-Authored-By: Claude Opus 5.5 --- docs/DESIGN.md | 1 + .../src/pages/platform/DeviceSupport.jsx | 18 +++ .../src/pages/platform/DevicesPage.jsx | 2 + .../src/pages/signage/ScreensTab.jsx | 11 +- package-lock.json | 117 +++++++++++++- packages/i18n/locales/el/manager.json | 11 +- packages/i18n/locales/en/manager.json | 11 +- packages/signage/src/SlideView.jsx | 3 +- packages/signage/src/Slides.jsx | 57 +++---- packages/signage/src/cq.js | 21 +++ packages/signage/src/index.js | 1 + packages/signage/src/logic.js | 3 +- packages/signage/tests/logic.test.mjs | 22 +++ packages/ui/src/components.css | 23 +++ packages/ui/src/components/Notice.jsx | 32 ++++ packages/ui/src/index.js | 1 + terminal/package.json | 3 + terminal/src/apps/signage/SignageApp.jsx | 4 +- terminal/src/compat.js | 144 ++++++++++++++++++ terminal/src/main.jsx | 3 + terminal/vite.config.js | 34 ++++- tests/e2e/compat.mjs | 142 +++++++++++++++++ tests/e2e/run-all.mjs | 1 + 23 files changed, 625 insertions(+), 40 deletions(-) create mode 100644 manager_dashboard/src/pages/platform/DeviceSupport.jsx create mode 100644 packages/signage/src/cq.js create mode 100644 packages/ui/src/components/Notice.jsx create mode 100644 terminal/src/compat.js create mode 100644 tests/e2e/compat.mjs diff --git a/docs/DESIGN.md b/docs/DESIGN.md index b94d763..2466cbd 100644 --- a/docs/DESIGN.md +++ b/docs/DESIGN.md @@ -52,6 +52,7 @@ Every page is on `` except Inventory → Stock (a placeholder). Two-column | A colour (a venue's: data) | `ColourField` (`auto`, `opacity`, `presets`) | a field with its swatch and code; its panel (over the page) has 12 ready colours, the picker, the opacity (`#rrggbbaa`) and the code. `auto` = a first choice that leaves it to something else ("As the slide"). **Never** a bare `` | | An icon from a set | `IconPicker` (`icons` = { key: component }) | a field showing the icon; a grid of the set over the page, "No icon" first | | A whole number (seconds, counts) | `NumberInput` (`min`, `max`, `suffix`) | − / + on its sides, as tall as an input; it may be emptied while typing (`onChange(null)`): the form shows the error and blocks saving. **Never** clamp on every key (the user can't clear the field) | +| A note in a box (what works, a caution) | `Notice` (`tone`, `title`, `icon`, `items` = [{ tone, label, text }]) | a tinted box with a bar on its left; `items` are points with a tone dot and a bold label. **Never** a local `bg-info-soft` paragraph rebuilt per page | | A slider with its value | `Slider` (`suffix`) | framed and as tall as the fields beside it; the value sits as close to it as the frame's padding. **Never** a bare `` | | Fields that should wrap | `FieldRow` (`min`, `shade` on every other row) | each field keeps its least width; a row that wraps is framed (and tinted with `shade`), a row on one line looks like any row | | Toggles that go together (bold / italic / underline) | `Segmented multiple` | value is an array | diff --git a/manager_dashboard/src/pages/platform/DeviceSupport.jsx b/manager_dashboard/src/pages/platform/DeviceSupport.jsx new file mode 100644 index 0000000..dfb7388 --- /dev/null +++ b/manager_dashboard/src/pages/platform/DeviceSupport.jsx @@ -0,0 +1,18 @@ +// Which devices run the apps (2026-11-21): modern browsers run everything; older ones (a TV's built-in +// browser from 2021–2023) get the compatibility layer (terminal/vite.config.js, terminal/src/compat.js); +// older still, a blank page. Shown in the "Pair a device" dialog and on Signage → Screens. +import { useTranslation } from '@xenia/i18n' +import { Notice } from '@xenia/ui' +import { MonitorSmartphone } from 'lucide-react' + +export function DeviceSupport({ className }) { + const { t } = useTranslation('manager') + return ( + } title={t('devices.support.title')} className={className} data-testid="device-support" + items={[ + { tone: 'success', label: t('devices.support.bestLabel'), text: t('devices.support.best') }, + { tone: 'warning', label: t('devices.support.compatLabel'), text: t('devices.support.compat') }, + { tone: 'danger', label: t('devices.support.oldLabel'), text: t('devices.support.old') }, + ]} /> + ) +} diff --git a/manager_dashboard/src/pages/platform/DevicesPage.jsx b/manager_dashboard/src/pages/platform/DevicesPage.jsx index 8e236b0..a4c27a1 100644 --- a/manager_dashboard/src/pages/platform/DevicesPage.jsx +++ b/manager_dashboard/src/pages/platform/DevicesPage.jsx @@ -12,6 +12,7 @@ import { useCallback, useEffect, useMemo, useState } from 'react' import { useSearchParams } from 'react-router-dom' import toast from 'react-hot-toast' import { MonitorSmartphone, Plus } from 'lucide-react' +import { DeviceSupport } from './DeviceSupport' import { errorMessage, parseError } from '@xenia/api' import { useTranslation, useFormat } from '@xenia/i18n' import { Button, Dialog, EmptyState, Field, Input, Page, Select, Spinner } from '@xenia/ui' @@ -244,6 +245,7 @@ function PairDialog({ apps, usage, devices, appName, limitLabel, initialApp, onC setCode(normalizeCode(e.target.value))} autoComplete="off" spellCheck={false} className="font-mono tracking-[0.3em] text-center uppercase" autoFocus /> +