Add named wall displays: pages, order and speed per screen
An administrator can make named displays (Hall TV, Office monitor) under Settings -> Share links, each with an address of its own (/wall/hall-tv), the pages it rotates through in the board's order, and a rotation speed. The signed-in wall opens one from its address and can switch between them, and a wall share link can open one too. The address still wins over the display's speed, then the browser's choice. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
639408c0d0
commit
333146e8e3
24 files changed
+10411
-22
No files matched your search
@@ -2,7 +2,7 @@ import { useEffect, useState, type ReactNode } from "react";
|
||||
import type { WallGroup, WallTile } from "../api/client";
|
||||
import { formatDate, formatTime } from "../utils/date";
|
||||
import { formatRemaining } from "../utils/duration";
|
||||
import { groupMembers, pageOrOverview, ROTATE_CHOICES, stepPage, wallPages } from "../utils/wallPages";
|
||||
import { applyDisplay, groupMembers, pageOrOverview, ROTATE_CHOICES, stepPage, wallPages } from "../utils/wallPages";
|
||||
import { t } from "../i18n";
|
||||
|
||||
export const REFRESH_MS = 30_000;
|
||||
@@ -115,10 +115,13 @@ export default function WallView({
|
||||
idle,
|
||||
footerActions,
|
||||
rotation,
|
||||
display,
|
||||
}: {
|
||||
data: WallData;
|
||||
idle: boolean;
|
||||
footerActions: ReactNode;
|
||||
/** A named display: its name (shown in the footer) and which pages it rotates through, in order; none listed is every page. */
|
||||
display?: { name: string; pages: string[] } | null;
|
||||
/** How the pages rotate (seconds each, null for the overview alone) and how to change it; absent on a board that does not rotate. */
|
||||
rotation?: { seconds: number | null; onChange: (seconds: number | null) => void };
|
||||
}) {
|
||||
@@ -127,7 +130,7 @@ export default function WallView({
|
||||
|
||||
// The pages: the overview, what needs attention (while something does), and one for each group of integrations.
|
||||
const rotating = !!rotation && rotation.seconds !== null;
|
||||
const pages = wallPages(data);
|
||||
const pages = applyDisplay(wallPages(data), display?.pages ?? []);
|
||||
const pagesKey = pages.map((p) => p.id).join(",");
|
||||
const [pageId, setPageId] = useState("overview");
|
||||
const [paused, setPaused] = useState(false);
|
||||
@@ -287,6 +290,7 @@ export default function WallView({
|
||||
|
||||
<footer className="wall-footer">
|
||||
<span>
|
||||
{display?.name && <strong>{display.name} · </strong>}
|
||||
{data.updatedAt ? `Updated ${formatTime(data.updatedAt)}` : "Loading…"} · refreshes every {REFRESH_MS / 1000} s
|
||||
{rotating && pages.length > 1 && (
|
||||
<span className="wall-pager" aria-label={`Page ${pages.findIndex((p) => p.id === page.id) + 1} of ${pages.length}: ${page.label}`}>
|
||||
@@ -310,7 +314,7 @@ export default function WallView({
|
||||
value={rotation.seconds === null ? "off" : String(rotation.seconds)}
|
||||
onChange={(e) => {
|
||||
setPaused(false);
|
||||
setPageId("overview");
|
||||
setPageId(pages[0].id);
|
||||
rotation.onChange(e.target.value === "off" ? null : Number(e.target.value));
|
||||
}}
|
||||
>
|
||||
|
||||
Reference in new issue
Block a user