@attraccess/plugin-status-wall 0.0.0-stage → 0.1.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1073 @@
1
+ import { r as importShared } from "./_virtual___federation_fn_import-D2E5es2p.js";
2
+ // \0rolldown/runtime.js
3
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod, mod.exports), cb = null), mod.exports);
4
+ // backend/permission-keys.ts
5
+ var STATUS_WALL_MANAGE = "status-wall.walls.manage";
6
+ // ../../../libs/plugins-frontend-sdk/src/lib/frontend.api-client.ts
7
+ var BASE_URL_GLOBAL = "__ATTRACCESS_API_BASE_URL__";
8
+ /** The API origin the host is talking to. Falls back to the current origin. */
9
+ function getApiBaseUrl() {
10
+ return window[BASE_URL_GLOBAL] ?? window.location.origin;
11
+ }
12
+ /** Thrown for any non-2xx response, carrying the status for callers that branch on it. */
13
+ var PluginApiError = class extends Error {
14
+ constructor(message, status) {
15
+ super(message);
16
+ this.status = status;
17
+ this.name = "PluginApiError";
18
+ }
19
+ };
20
+ /**
21
+ * Joins validation messages into one text. Messages that already end a sentence are separated by a space, so
22
+ * "The URL is too long." and "The token is short." never become "long., token".
23
+ */
24
+ function joinErrorMessages(parts) {
25
+ return parts.map((part) => part.trim()).filter(Boolean).reduce((joined, part) => {
26
+ if (joined === "") return part;
27
+ return /[.!?]$/.test(joined) ? `${joined} ${part}` : `${joined}, ${part}`;
28
+ }, "");
29
+ }
30
+ async function toError(res) {
31
+ try {
32
+ const body = await res.json();
33
+ const message = Array.isArray(body.message) ? joinErrorMessages(body.message) : body.message;
34
+ if (message) return new PluginApiError(message, res.status);
35
+ } catch {}
36
+ return new PluginApiError(`Request failed (HTTP ${res.status}).`, res.status);
37
+ }
38
+ /**
39
+ * Creates a client bound to `basePath`, which is resolved against the host's
40
+ * API origin. Plugin routes are mounted under `/api/<plugin-name>`, so that is
41
+ * the usual argument; pass nothing to address the host API directly.
42
+ */
43
+ function createPluginApiClient(basePath = "") {
44
+ const url = (path, query) => {
45
+ const target = new URL(`${basePath}${path}`, getApiBaseUrl());
46
+ Object.entries(query ?? {}).forEach(([key, value]) => {
47
+ if (value !== void 0 && value !== null) target.searchParams.set(key, String(value));
48
+ });
49
+ return target.toString();
50
+ };
51
+ const doFetch = (path, init) => fetch(url(path), {
52
+ credentials: "include",
53
+ ...init
54
+ });
55
+ return {
56
+ url,
57
+ fetch: doFetch,
58
+ async request(path, options = {}) {
59
+ const { body, query, headers, ...init } = options;
60
+ const res = await fetch(url(path, query), {
61
+ credentials: "include",
62
+ ...init,
63
+ headers: body === void 0 ? headers : {
64
+ "Content-Type": "application/json",
65
+ ...headers
66
+ },
67
+ body: body === void 0 ? void 0 : JSON.stringify(body)
68
+ });
69
+ if (!res.ok) throw await toError(res);
70
+ const text = await res.text();
71
+ return text.length > 0 ? JSON.parse(text) : null;
72
+ }
73
+ };
74
+ }
75
+ // ../../../libs/plugins-frontend-sdk/src/lib/frontend.license.ts
76
+ var { useCallback: useCallback$1, useEffect: useEffect$7, useState: useState$5 } = await importShared("react");
77
+ // ../../../node_modules/.pnpm/react@19.3.1/node_modules/react/cjs/react-jsx-runtime.production.js
78
+ /**
79
+ * @license React
80
+ * react-jsx-runtime.production.js
81
+ *
82
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
83
+ *
84
+ * This source code is licensed under the MIT license found in the
85
+ * LICENSE file in the root directory of this source tree.
86
+ */
87
+ var require_react_jsx_runtime_production = /* @__PURE__ */ __commonJSMin(((exports) => {
88
+ var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element");
89
+ var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
90
+ function jsxProd(type, config, maybeKey) {
91
+ var key = null;
92
+ void 0 !== maybeKey && (key = "" + maybeKey);
93
+ void 0 !== config.key && (key = "" + config.key);
94
+ if ("key" in config) {
95
+ maybeKey = {};
96
+ for (var propName in config) "key" !== propName && (maybeKey[propName] = config[propName]);
97
+ } else maybeKey = config;
98
+ config = maybeKey.ref;
99
+ return {
100
+ $$typeof: REACT_ELEMENT_TYPE,
101
+ type,
102
+ key,
103
+ ref: void 0 !== config ? config : null,
104
+ props: maybeKey
105
+ };
106
+ }
107
+ exports.Fragment = REACT_FRAGMENT_TYPE;
108
+ exports.jsx = jsxProd;
109
+ exports.jsxs = jsxProd;
110
+ }));
111
+ // ../../../libs/plugins-frontend-sdk/src/lib/frontend.live-updates.tsx
112
+ var import_jsx_runtime = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
113
+ module.exports = require_react_jsx_runtime_production();
114
+ })))();
115
+ var { createContext, useCallback, useContext, useEffect: useEffect$6, useRef: useRef$1 } = await importShared("react");
116
+ var contextKey = Symbol.for("attraccess.plugin.live-updates.context");
117
+ var contexts = globalThis;
118
+ contexts[contextKey] ??= createContext(null);
119
+ var identityKey = Symbol.for("attraccess.plugin.live-updates.identity");
120
+ var identities = globalThis;
121
+ identities[identityKey] ??= createContext(null);
122
+ // ../../../libs/plugins-frontend-sdk/src/lib/frontend.standard-drawer.tsx
123
+ var { StandardDrawer: SharedStandardDrawer } = await importShared("@attraccess/plugins-frontend-ui");
124
+ // ../../../libs/plugins-frontend-sdk/src/lib/frontend.standard-modal.tsx
125
+ var { StandardModal: SharedStandardModal } = await importShared("@attraccess/plugins-frontend-ui");
126
+ // frontend/src/api.ts
127
+ var api = createPluginApiClient("/api/status-wall");
128
+ var hostApi = createPluginApiClient("");
129
+ var listWalls = () => api.request("/walls");
130
+ var createWall = (input) => api.request("/walls", {
131
+ method: "POST",
132
+ body: input
133
+ });
134
+ var updateWall = (id, input) => api.request(`/walls/${id}`, {
135
+ method: "PUT",
136
+ body: input
137
+ });
138
+ var regenerateWallLink = (id) => api.request(`/walls/${id}/regenerate`, { method: "POST" });
139
+ var deleteWall = (id) => api.request(`/walls/${id}`, { method: "DELETE" });
140
+ var listResourceGroups = () => hostApi.request("/api/resource-groups");
141
+ var publicPath = (token) => `/public/${encodeURIComponent(token)}`;
142
+ var getWallSnapshot = (token) => api.request(publicPath(token));
143
+ var wallEventsUrl = (token) => api.url(`${publicPath(token)}/events`);
144
+ /** Resource images are served by the API, which may live on another origin than the app. */
145
+ var imageSrc = (imageUrl) => hostApi.url(imageUrl);
146
+ /** Path of the public screen of a wall, in this app. */
147
+ var wallPath = (token) => `/status-wall/${encodeURIComponent(token)}`;
148
+ var wallLink = (token) => `${window.location.origin}${wallPath(token)}`;
149
+ var en_default = {
150
+ sidebar: "Status walls",
151
+ failed: "That did not work",
152
+ common: {
153
+ "cancel": "Cancel",
154
+ "save": "Save",
155
+ "done": "Done"
156
+ },
157
+ page: {
158
+ "title": "Status walls",
159
+ "description": "Big-screen pages that show at a glance which machines are ready, in use or under maintenance. Screens open them by link, without signing in.",
160
+ "create": "New status wall",
161
+ "empty": "No status walls yet",
162
+ "loadFailed": "Could not load the status walls"
163
+ },
164
+ table: {
165
+ "name": "Name",
166
+ "shows": "Shows"
167
+ },
168
+ selection: {
169
+ "all": "All resources",
170
+ "groups": "{{count}} group(s)",
171
+ "resources": "{{count}} resource(s)"
172
+ },
173
+ actions: {
174
+ "open": "Open wall",
175
+ "link": "Show link",
176
+ "edit": "Edit",
177
+ "regenerate": "New link",
178
+ "delete": "Delete"
179
+ },
180
+ regenerate: {
181
+ "title": "New link for {{name}}?",
182
+ "body": "Screens that show the current link stop showing the wall and need the new link.",
183
+ "confirm": "Create new link"
184
+ },
185
+ "delete": {
186
+ "title": "Delete {{name}}?",
187
+ "body": "Screens that show this wall stop showing it. This cannot be undone.",
188
+ "confirm": "Delete"
189
+ },
190
+ form: {
191
+ "createTitle": "New status wall",
192
+ "editTitle": "Edit status wall",
193
+ "name": "Name",
194
+ "namePlaceholder": "e.g. Workshop hall",
195
+ "all": "Show all resources",
196
+ "groups": "Resource groups",
197
+ "noGroups": "There are no resource groups.",
198
+ "resources": "Resources",
199
+ "selectedCount": "{{count}} selected",
200
+ "needSelection": "Choose at least one group or resource.",
201
+ "create": "Create"
202
+ },
203
+ link: {
204
+ "title": "Link of {{name}}",
205
+ "body": "Open this link on the screen. Anyone with the link sees the wall without signing in; use \"New link\" to revoke it. Double-click the wall to switch to full screen.",
206
+ "url": "Wall link",
207
+ "copy": "Copy link",
208
+ "copied": "Copied",
209
+ "open": "Open"
210
+ },
211
+ state: {
212
+ "ready": "Ready",
213
+ "in-use": "In use",
214
+ "maintenance": "Maintenance"
215
+ },
216
+ display: {
217
+ "empty": "This wall shows no resources.",
218
+ "offline": "No connection to the server: the wall may be out of date",
219
+ "gone": {
220
+ "title": "This link is no longer valid",
221
+ "body": "Ask a manager for the current link of this status wall."
222
+ }
223
+ }
224
+ };
225
+ var de_default = {
226
+ sidebar: "Statuswände",
227
+ failed: "Das hat nicht geklappt",
228
+ common: {
229
+ "cancel": "Abbrechen",
230
+ "save": "Speichern",
231
+ "done": "Fertig"
232
+ },
233
+ page: {
234
+ "title": "Statuswände",
235
+ "description": "Seiten für große Bildschirme, die auf einen Blick zeigen, welche Maschinen frei, in Benutzung oder in Wartung sind. Bildschirme öffnen sie per Link, ohne Anmeldung.",
236
+ "create": "Neue Statuswand",
237
+ "empty": "Noch keine Statuswände",
238
+ "loadFailed": "Die Statuswände konnten nicht geladen werden"
239
+ },
240
+ table: {
241
+ "name": "Name",
242
+ "shows": "Zeigt"
243
+ },
244
+ selection: {
245
+ "all": "Alle Ressourcen",
246
+ "groups": "{{count}} Gruppe(n)",
247
+ "resources": "{{count}} Ressource(n)"
248
+ },
249
+ actions: {
250
+ "open": "Wand öffnen",
251
+ "link": "Link anzeigen",
252
+ "edit": "Bearbeiten",
253
+ "regenerate": "Neuer Link",
254
+ "delete": "Löschen"
255
+ },
256
+ regenerate: {
257
+ "title": "Neuer Link für {{name}}?",
258
+ "body": "Bildschirme mit dem bisherigen Link zeigen die Wand nicht mehr und brauchen den neuen Link.",
259
+ "confirm": "Neuen Link erstellen"
260
+ },
261
+ "delete": {
262
+ "title": "{{name}} löschen?",
263
+ "body": "Bildschirme mit dieser Wand zeigen sie nicht mehr. Das lässt sich nicht rückgängig machen.",
264
+ "confirm": "Löschen"
265
+ },
266
+ form: {
267
+ "createTitle": "Neue Statuswand",
268
+ "editTitle": "Statuswand bearbeiten",
269
+ "name": "Name",
270
+ "namePlaceholder": "z. B. Werkstatthalle",
271
+ "all": "Alle Ressourcen zeigen",
272
+ "groups": "Ressourcengruppen",
273
+ "noGroups": "Es gibt keine Ressourcengruppen.",
274
+ "resources": "Ressourcen",
275
+ "selectedCount": "{{count}} ausgewählt",
276
+ "needSelection": "Wähle mindestens eine Gruppe oder Ressource.",
277
+ "create": "Erstellen"
278
+ },
279
+ link: {
280
+ "title": "Link von {{name}}",
281
+ "body": "Öffne diesen Link auf dem Bildschirm. Wer den Link hat, sieht die Wand ohne Anmeldung; mit „Neuer Link“ widerrufst du ihn. Ein Doppelklick auf die Wand schaltet auf Vollbild.",
282
+ "url": "Link der Wand",
283
+ "copy": "Link kopieren",
284
+ "copied": "Kopiert",
285
+ "open": "Öffnen"
286
+ },
287
+ state: {
288
+ "ready": "Frei",
289
+ "in-use": "In Benutzung",
290
+ "maintenance": "Wartung"
291
+ },
292
+ display: {
293
+ "empty": "Diese Wand zeigt keine Ressourcen.",
294
+ "offline": "Keine Verbindung zum Server: Die Wand ist eventuell nicht aktuell",
295
+ "gone": {
296
+ "title": "Dieser Link ist nicht mehr gültig",
297
+ "body": "Frag eine verwaltende Person nach dem aktuellen Link dieser Statuswand."
298
+ }
299
+ }
300
+ };
301
+ // frontend/src/i18n.ts
302
+ var { useTranslations } = await importShared("@attraccess/plugins-frontend-ui");
303
+ var useStatusWallTranslations = () => useTranslations({
304
+ en: en_default,
305
+ de: de_default
306
+ }, { escapeValues: false });
307
+ // frontend/src/admin/WallFormModal.tsx
308
+ var { Button: Button$1, LabeledSwitch, ResourceSelector, StandardModal, StatusDialog: StatusDialog$2 } = await importShared("@attraccess/plugins-frontend-ui");
309
+ var { Description, Fieldset, Input: Input$1, Label, ModalBody, ModalFooter, ModalHeader, ModalHeading, TextField } = await importShared("@heroui/react");
310
+ var { useMutation: useMutation$1, useQuery: useQuery$2 } = await importShared("@tanstack/react-query");
311
+ var { useEffect: useEffect$5, useState: useState$4 } = await importShared("react");
312
+ var EMPTY = {
313
+ all: true,
314
+ resourceIds: [],
315
+ groupIds: []
316
+ };
317
+ var toggle = (list, id) => list.includes(id) ? list.filter((entry) => entry !== id) : [...list, id];
318
+ function WallFormModal({ isOpen, wall, onOpenChange, onSaved }) {
319
+ const { t } = useStatusWallTranslations();
320
+ const [name, setName] = useState$4("");
321
+ const [selection, setSelection] = useState$4(EMPTY);
322
+ const [error, setError] = useState$4(null);
323
+ useEffect$5(() => {
324
+ if (!isOpen) return;
325
+ setName(wall?.name ?? "");
326
+ setSelection(wall?.selection ?? EMPTY);
327
+ }, [isOpen, wall]);
328
+ const groups = useQuery$2({
329
+ queryKey: ["status-wall", "resource-groups"],
330
+ queryFn: listResourceGroups,
331
+ enabled: isOpen && !selection.all,
332
+ staleTime: 6e4
333
+ });
334
+ const save = useMutation$1({
335
+ mutationFn: () => {
336
+ const body = {
337
+ name: name.trim(),
338
+ selection
339
+ };
340
+ return wall ? updateWall(wall.id, body) : createWall(body);
341
+ },
342
+ onSuccess: (saved) => {
343
+ onSaved(saved, wall === null);
344
+ onOpenChange(false);
345
+ },
346
+ onError: (failure) => setError(failure instanceof Error ? failure.message : String(failure))
347
+ });
348
+ const hasSelection = selection.all || selection.resourceIds.length > 0 || selection.groupIds.length > 0;
349
+ const canSave = name.trim().length > 0 && hasSelection;
350
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(StandardModal, {
351
+ isOpen,
352
+ onOpenChange,
353
+ size: "md",
354
+ "data-cy": "status-wall-form",
355
+ children: [
356
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ModalHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ModalHeading, { children: wall ? t("form.editTitle") : t("form.createTitle") }) }),
357
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ModalBody, {
358
+ className: "sw:flex sw:flex-col sw:gap-4 sw:p-1",
359
+ children: [
360
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TextField, {
361
+ value: name,
362
+ onChange: setName,
363
+ isRequired: true,
364
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Label, { children: t("form.name") }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Input$1, {
365
+ maxLength: 100,
366
+ placeholder: t("form.namePlaceholder"),
367
+ "data-cy": "status-wall-form-name"
368
+ })]
369
+ }),
370
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LabeledSwitch, {
371
+ isSelected: selection.all,
372
+ onChange: (all) => setSelection({
373
+ ...selection,
374
+ all
375
+ }),
376
+ children: t("form.all")
377
+ }),
378
+ !selection.all && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
379
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Fieldset, { children: [
380
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Fieldset.Legend, { children: t("form.groups") }),
381
+ (groups.data ?? []).map((group) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LabeledSwitch, {
382
+ isSelected: selection.groupIds.includes(group.id),
383
+ onChange: () => setSelection({
384
+ ...selection,
385
+ groupIds: toggle(selection.groupIds, group.id)
386
+ }),
387
+ children: group.name
388
+ }, group.id)),
389
+ groups.data?.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
390
+ className: "sw:text-sm sw:text-muted",
391
+ children: t("form.noGroups")
392
+ })
393
+ ] }),
394
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Fieldset, { children: [
395
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Fieldset.Legend, { children: t("form.resources") }),
396
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ResourceSelector, {
397
+ selection: selection.resourceIds,
398
+ onSelectionChange: (resourceIds) => setSelection({
399
+ ...selection,
400
+ resourceIds
401
+ })
402
+ }),
403
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Description, { children: t("form.selectedCount", { count: selection.resourceIds.length }) })
404
+ ] }),
405
+ !hasSelection && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
406
+ className: "sw:text-sm sw:text-muted",
407
+ children: t("form.needSelection")
408
+ })
409
+ ] })
410
+ ]
411
+ }),
412
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ModalFooter, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$1, {
413
+ variant: "tertiary",
414
+ onPress: () => onOpenChange(false),
415
+ children: t("common.cancel")
416
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$1, {
417
+ variant: "primary",
418
+ isDisabled: !canSave,
419
+ isPending: save.isPending,
420
+ onPress: () => save.mutate(),
421
+ "data-cy": "status-wall-form-save",
422
+ children: wall ? t("common.save") : t("form.create")
423
+ })] })
424
+ ]
425
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StatusDialog$2, {
426
+ isOpen: error !== null,
427
+ onClose: () => setError(null),
428
+ status: "error",
429
+ title: t("failed"),
430
+ children: error ?? ""
431
+ })] });
432
+ }
433
+ // frontend/src/admin/WallLinkDialog.tsx
434
+ var { Button, StatusDialog: StatusDialog$1 } = await importShared("@attraccess/plugins-frontend-ui");
435
+ var { Input } = await importShared("@heroui/react");
436
+ var { CheckIcon: CheckIcon$1, CopyIcon, ExternalLinkIcon: ExternalLinkIcon$1 } = await importShared("lucide-react");
437
+ var { useEffect: useEffect$4, useState: useState$3 } = await importShared("react");
438
+ /** The public link of a wall, to copy onto a screen or open right here. */
439
+ function WallLinkDialog(props) {
440
+ const { t } = useStatusWallTranslations();
441
+ const [copied, setCopied] = useState$3(false);
442
+ const { wall } = props;
443
+ const link = wall ? wallLink(wall.token) : "";
444
+ useEffect$4(() => {
445
+ if (!copied) return;
446
+ const timer = setTimeout(() => setCopied(false), 3e3);
447
+ return () => clearTimeout(timer);
448
+ }, [copied]);
449
+ const copy = async () => {
450
+ try {
451
+ await navigator.clipboard.writeText(link);
452
+ setCopied(true);
453
+ } catch {
454
+ setCopied(false);
455
+ }
456
+ };
457
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StatusDialog$1, {
458
+ isOpen: wall !== null,
459
+ onClose: () => {
460
+ setCopied(false);
461
+ props.onClose();
462
+ },
463
+ status: "info",
464
+ title: t("link.title", { name: wall?.name ?? "" }),
465
+ closeLabel: t("common.done"),
466
+ "data-cy": "status-wall-link",
467
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
468
+ className: "sw:flex sw:flex-col sw:gap-3",
469
+ children: [
470
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: t("link.body") }),
471
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Input, {
472
+ readOnly: true,
473
+ fullWidth: true,
474
+ value: link,
475
+ "aria-label": t("link.url"),
476
+ onFocus: (event) => event.currentTarget.select(),
477
+ "data-cy": "status-wall-link-url"
478
+ }),
479
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
480
+ className: "sw:flex sw:flex-wrap sw:gap-2",
481
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, {
482
+ variant: "secondary",
483
+ onPress: () => void copy(),
484
+ "data-cy": "status-wall-link-copy",
485
+ children: [copied ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CheckIcon$1, { size: 16 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CopyIcon, { size: 16 }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
486
+ "aria-live": "polite",
487
+ children: copied ? t("link.copied") : t("link.copy")
488
+ })]
489
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, {
490
+ variant: "tertiary",
491
+ onPress: () => window.open(link, "_blank", "noopener"),
492
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ExternalLinkIcon$1, { size: 16 }), t("link.open")]
493
+ })]
494
+ })
495
+ ]
496
+ })
497
+ });
498
+ }
499
+ // frontend/src/admin/WallRowActions.tsx
500
+ var { TableRowActions } = await importShared("@attraccess/plugins-frontend-ui");
501
+ var { ExternalLinkIcon, LinkIcon: LinkIcon$1, PencilIcon, RefreshCwIcon, Trash2Icon } = await importShared("lucide-react");
502
+ function WallRowActions({ wall, isBusy, onShowLink, onEdit, onRegenerate, onDelete }) {
503
+ const { t } = useStatusWallTranslations();
504
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableRowActions, {
505
+ itemName: wall.name,
506
+ isPending: isBusy,
507
+ "data-cy": `status-wall-menu-${wall.id}`,
508
+ actions: [
509
+ {
510
+ key: "open",
511
+ label: t("actions.open"),
512
+ icon: ExternalLinkIcon,
513
+ onPress: () => window.open(wallLink(wall.token), "_blank", "noopener")
514
+ },
515
+ {
516
+ key: "link",
517
+ label: t("actions.link"),
518
+ icon: LinkIcon$1,
519
+ onPress: onShowLink
520
+ },
521
+ {
522
+ key: "edit",
523
+ label: t("actions.edit"),
524
+ icon: PencilIcon,
525
+ onPress: onEdit
526
+ },
527
+ {
528
+ key: "regenerate",
529
+ label: t("actions.regenerate"),
530
+ icon: RefreshCwIcon,
531
+ onPress: onRegenerate,
532
+ confirm: {
533
+ status: "warning",
534
+ title: t("regenerate.title", { name: wall.name }),
535
+ message: t("regenerate.body"),
536
+ confirmLabel: t("regenerate.confirm")
537
+ }
538
+ },
539
+ {
540
+ key: "delete",
541
+ label: t("actions.delete"),
542
+ icon: Trash2Icon,
543
+ tone: "danger",
544
+ onPress: onDelete,
545
+ confirm: {
546
+ title: t("delete.title", { name: wall.name }),
547
+ message: t("delete.body"),
548
+ confirmLabel: t("delete.confirm"),
549
+ confirmDataCy: `status-wall-delete-confirm-${wall.id}`
550
+ }
551
+ }
552
+ ]
553
+ });
554
+ }
555
+ // frontend/src/admin/WallsTable.tsx
556
+ var { EmptyState, TableActionsColumnHeader } = await importShared("@attraccess/plugins-frontend-ui");
557
+ var { Table, TableBody, TableCell, TableColumn, TableContent, TableHeader, TableRow, TableScrollContainer } = await importShared("@heroui/react");
558
+ function WallsTable({ walls, busyId, onShowLink, onEdit, onRegenerate, onDelete }) {
559
+ const { t, language } = useStatusWallTranslations();
560
+ const describe = ({ selection }) => {
561
+ if (selection.all) return t("selection.all");
562
+ const parts = [];
563
+ if (selection.groupIds.length) parts.push(t("selection.groups", { count: selection.groupIds.length }));
564
+ if (selection.resourceIds.length) parts.push(t("selection.resources", { count: selection.resourceIds.length }));
565
+ return parts.join(", ");
566
+ };
567
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Table, {
568
+ "data-cy": "status-wall-table",
569
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableScrollContainer, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TableContent, {
570
+ "aria-label": t("page.title"),
571
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TableHeader, { children: [
572
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableColumn, {
573
+ isRowHeader: true,
574
+ children: t("table.name")
575
+ }),
576
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableColumn, { children: t("table.shows") }),
577
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableColumn, {
578
+ id: "actions",
579
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableActionsColumnHeader, {})
580
+ })
581
+ ] }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableBody, {
582
+ items: walls,
583
+ dependencies: [busyId, language],
584
+ renderEmptyState: () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyState, { message: t("page.empty") }),
585
+ children: (wall) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TableRow, {
586
+ id: wall.id,
587
+ "data-cy": `status-wall-row-${wall.id}`,
588
+ children: [
589
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableCell, {
590
+ className: "sw:font-medium",
591
+ children: wall.name
592
+ }),
593
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableCell, {
594
+ className: "sw:text-muted",
595
+ children: describe(wall)
596
+ }),
597
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableCell, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(WallRowActions, {
598
+ wall,
599
+ isBusy: busyId === wall.id,
600
+ onShowLink: () => onShowLink(wall),
601
+ onEdit: () => onEdit(wall),
602
+ onRegenerate: () => onRegenerate(wall),
603
+ onDelete: () => onDelete(wall)
604
+ }) })
605
+ ]
606
+ }, wall.id)
607
+ })]
608
+ }) })
609
+ });
610
+ }
611
+ // frontend/src/admin/WallsPage.tsx
612
+ var { PageHeader, StatusAlert, StatusDialog, TableDataLoadingIndicator } = await importShared("@attraccess/plugins-frontend-ui");
613
+ var { useMutation, useQuery: useQuery$1, useQueryClient: useQueryClient$1 } = await importShared("@tanstack/react-query");
614
+ var { MonitorIcon: MonitorIcon$1, PlusIcon } = await importShared("lucide-react");
615
+ var { useState: useState$2 } = await importShared("react");
616
+ var WALLS_KEY = ["status-wall", "walls"];
617
+ /** Management of status walls: what each one shows and the link a screen opens. */
618
+ function WallsPage() {
619
+ const { t } = useStatusWallTranslations();
620
+ const queryClient = useQueryClient$1();
621
+ const walls = useQuery$1({
622
+ queryKey: WALLS_KEY,
623
+ queryFn: listWalls
624
+ });
625
+ const [formOpen, setFormOpen] = useState$2(false);
626
+ const [editing, setEditing] = useState$2(null);
627
+ const [linkWall, setLinkWall] = useState$2(null);
628
+ const [error, setError] = useState$2(null);
629
+ const action = useMutation({
630
+ mutationFn: ({ kind, wall }) => kind === "regenerate" ? regenerateWallLink(wall.id) : deleteWall(wall.id),
631
+ onSuccess: (result) => {
632
+ if (result) setLinkWall(result);
633
+ return queryClient.invalidateQueries({ queryKey: WALLS_KEY });
634
+ },
635
+ onError: (failure) => setError(failure instanceof Error ? failure.message : String(failure))
636
+ });
637
+ const run = (kind, wall) => action.mutateAsync({
638
+ kind,
639
+ wall
640
+ }).catch(() => void 0);
641
+ const openForm = (wall) => {
642
+ setEditing(wall);
643
+ setFormOpen(true);
644
+ };
645
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
646
+ className: "sw:mx-auto sw:flex sw:w-full sw:max-w-5xl sw:flex-col sw:gap-6 sw:p-4 sw:md:p-6",
647
+ children: [
648
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PageHeader, {
649
+ noMargin: true,
650
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MonitorIcon$1, { className: "sw:h-6 sw:w-6 sw:text-accent-soft-foreground" }),
651
+ title: t("page.title"),
652
+ subtitle: t("page.description"),
653
+ actions: [{
654
+ key: "create",
655
+ label: t("page.create"),
656
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PlusIcon, { className: "sw:h-4 sw:w-4" }),
657
+ variant: "primary",
658
+ onPress: () => openForm(null),
659
+ dataCy: "status-wall-create"
660
+ }]
661
+ }),
662
+ walls.error && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StatusAlert, {
663
+ status: "danger",
664
+ title: t("page.loadFailed"),
665
+ children: walls.error.message
666
+ }),
667
+ walls.isPending ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableDataLoadingIndicator, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(WallsTable, {
668
+ walls: walls.data ?? [],
669
+ busyId: action.isPending ? action.variables?.wall.id ?? null : null,
670
+ onShowLink: setLinkWall,
671
+ onEdit: openForm,
672
+ onRegenerate: (wall) => run("regenerate", wall),
673
+ onDelete: (wall) => run("delete", wall)
674
+ }),
675
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(WallFormModal, {
676
+ isOpen: formOpen,
677
+ wall: editing,
678
+ onOpenChange: setFormOpen,
679
+ onSaved: (saved, created) => {
680
+ if (created) setLinkWall(saved);
681
+ queryClient.invalidateQueries({ queryKey: WALLS_KEY });
682
+ }
683
+ }),
684
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(WallLinkDialog, {
685
+ wall: linkWall,
686
+ onClose: () => setLinkWall(null)
687
+ }),
688
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StatusDialog, {
689
+ isOpen: error !== null,
690
+ onClose: () => setError(null),
691
+ status: "error",
692
+ title: t("failed"),
693
+ children: error ?? ""
694
+ })
695
+ ]
696
+ });
697
+ }
698
+ // frontend/src/display/fitGrid.ts
699
+ /** Width divided by height of one tile: a picture with a status band below it. */
700
+ var TILE_ASPECT = 4 / 3;
701
+ /**
702
+ * The column count that makes `count` tiles of a fixed aspect as large as possible inside `width` x `height`, so a
703
+ * wall never scrolls. `gap` is the space between tiles.
704
+ */
705
+ function fitGrid(count, width, height, gap) {
706
+ if (count <= 0 || width <= 0 || height <= 0) return {
707
+ columns: 1,
708
+ tileWidth: 0
709
+ };
710
+ let best = {
711
+ columns: 1,
712
+ tileWidth: 0
713
+ };
714
+ for (let columns = 1; columns <= count; columns++) {
715
+ const rows = Math.ceil(count / columns);
716
+ const byWidth = (width - gap * (columns - 1)) / columns;
717
+ const byHeight = (height - gap * (rows - 1)) / rows * TILE_ASPECT;
718
+ const tileWidth = Math.floor(Math.min(byWidth, byHeight));
719
+ if (tileWidth > best.tileWidth) best = {
720
+ columns,
721
+ tileWidth
722
+ };
723
+ }
724
+ return best;
725
+ }
726
+ // frontend/src/display/useFitGrid.ts
727
+ var { useEffect: useEffect$3, useRef, useState: useState$1 } = await importShared("react");
728
+ /** Measures the element behind `ref` and fits `count` tiles into it (see {@link fitGrid}). */
729
+ function useFitGrid(count, gap) {
730
+ const ref = useRef(null);
731
+ const [size, setSize] = useState$1({
732
+ width: 0,
733
+ height: 0
734
+ });
735
+ useEffect$3(() => {
736
+ const element = ref.current;
737
+ if (!element) return;
738
+ const measure = () => setSize({
739
+ width: element.clientWidth,
740
+ height: element.clientHeight
741
+ });
742
+ measure();
743
+ const observer = new ResizeObserver(measure);
744
+ observer.observe(element);
745
+ return () => observer.disconnect();
746
+ }, []);
747
+ return {
748
+ ref,
749
+ ...fitGrid(count, size.width, size.height, gap)
750
+ };
751
+ }
752
+ // frontend/src/display/useNow.ts
753
+ var { useEffect: useEffect$2, useState } = await importShared("react");
754
+ /** The current time, refreshed every `intervalMs`. */
755
+ function useNow(intervalMs) {
756
+ const [now, setNow] = useState(() => /* @__PURE__ */ new Date());
757
+ useEffect$2(() => {
758
+ const timer = setInterval(() => setNow(/* @__PURE__ */ new Date()), intervalMs);
759
+ return () => clearInterval(timer);
760
+ }, [intervalMs]);
761
+ return now;
762
+ }
763
+ // frontend/src/display/useWakeLock.ts
764
+ var { useEffect: useEffect$1 } = await importShared("react");
765
+ /** Keeps the screen from going to sleep while the wall is shown, where the browser allows it. */
766
+ function useWakeLock() {
767
+ useEffect$1(() => {
768
+ const wakeLock = navigator.wakeLock;
769
+ if (!wakeLock) return;
770
+ let sentinel = null;
771
+ let active = true;
772
+ const acquire = () => {
773
+ if (document.visibilityState !== "visible") return;
774
+ wakeLock.request("screen").then((lock) => {
775
+ if (active) sentinel = lock;
776
+ else lock.release();
777
+ }).catch(() => void 0);
778
+ };
779
+ acquire();
780
+ document.addEventListener("visibilitychange", acquire);
781
+ return () => {
782
+ active = false;
783
+ document.removeEventListener("visibilitychange", acquire);
784
+ sentinel?.release().catch(() => void 0);
785
+ };
786
+ }, []);
787
+ }
788
+ // frontend/src/display/useWallSnapshot.ts
789
+ var { useQuery, useQueryClient } = await importShared("@tanstack/react-query");
790
+ var { useEffect } = await importShared("react");
791
+ /** Fallback refresh: picks up renamed or re-pictured resources and maintenance that starts on schedule. */
792
+ var POLL_INTERVAL_MS = 6e4;
793
+ /** Several changes in a burst (a session ends, another starts) cost one refetch. */
794
+ var CHANGE_DEBOUNCE_MS = 500;
795
+ /** Unknown, replaced and deleted links all answer 404. */
796
+ var isGone = (error) => error?.status === 404;
797
+ /** The wall behind a public link, refetched whenever the server reports a change and on a slow timer. */
798
+ function useWallSnapshot(token) {
799
+ const queryClient = useQueryClient();
800
+ const query = useQuery({
801
+ queryKey: [
802
+ "status-wall",
803
+ "snapshot",
804
+ token
805
+ ],
806
+ queryFn: () => getWallSnapshot(token),
807
+ refetchInterval: (current) => isGone(current.state.error) ? false : POLL_INTERVAL_MS,
808
+ refetchIntervalInBackground: true,
809
+ retry: (failures, error) => !isGone(error) && failures < 3
810
+ });
811
+ const gone = isGone(query.error);
812
+ useEffect(() => {
813
+ if (gone || typeof EventSource === "undefined") return;
814
+ const source = new EventSource(wallEventsUrl(token));
815
+ let timer;
816
+ const refresh = () => {
817
+ clearTimeout(timer);
818
+ timer = setTimeout(() => void queryClient.invalidateQueries({ queryKey: [
819
+ "status-wall",
820
+ "snapshot",
821
+ token
822
+ ] }), CHANGE_DEBOUNCE_MS);
823
+ };
824
+ source.addEventListener("changed", refresh);
825
+ let opened = false;
826
+ source.addEventListener("open", () => {
827
+ if (opened) refresh();
828
+ opened = true;
829
+ });
830
+ return () => {
831
+ clearTimeout(timer);
832
+ source.close();
833
+ };
834
+ }, [
835
+ token,
836
+ gone,
837
+ queryClient
838
+ ]);
839
+ return {
840
+ ...query,
841
+ gone
842
+ };
843
+ }
844
+ // frontend/src/display/elapsed.ts
845
+ /** Short elapsed time for a tile: "12 min", "2 h 05". */
846
+ function formatElapsed(since, now) {
847
+ if (!since) return null;
848
+ const minutes = Math.max(0, Math.floor((now.getTime() - new Date(since).getTime()) / 6e4));
849
+ if (minutes < 60) return `${minutes} min`;
850
+ return `${Math.floor(minutes / 60)} h ${String(minutes % 60).padStart(2, "0")}`;
851
+ }
852
+ // frontend/src/display/WallTile.tsx
853
+ var { CheckIcon, PackageIcon, PowerIcon, WrenchIcon } = await importShared("lucide-react");
854
+ var STATE_STYLES = {
855
+ ready: {
856
+ icon: CheckIcon,
857
+ tone: "sw:bg-success sw:text-success-foreground sw:border-success"
858
+ },
859
+ "in-use": {
860
+ icon: PowerIcon,
861
+ tone: "sw:bg-warning sw:text-warning-foreground sw:border-warning"
862
+ },
863
+ maintenance: {
864
+ icon: WrenchIcon,
865
+ tone: "sw:bg-danger sw:text-danger-foreground sw:border-danger"
866
+ }
867
+ };
868
+ /** One resource: its picture framed in its traffic-light colour, with name and state below. */
869
+ function WallTile({ tile, width, now, label }) {
870
+ const style = STATE_STYLES[tile.state];
871
+ const Icon = style.icon;
872
+ const elapsed = formatElapsed(tile.since, now);
873
+ const border = Math.max(3, Math.round(width * .03));
874
+ const font = Math.max(12, Math.round(width * .075));
875
+ const icon = Math.round(font * 1.3);
876
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
877
+ className: `sw:flex sw:flex-col sw:overflow-hidden sw:rounded-2xl sw:border-solid ${style.tone}`,
878
+ style: {
879
+ width,
880
+ height: width / TILE_ASPECT,
881
+ borderWidth: border
882
+ },
883
+ "aria-label": `${tile.name}: ${label}`,
884
+ "data-cy": `status-wall-tile-${tile.id}`,
885
+ "data-state": tile.state,
886
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
887
+ className: "sw:relative sw:min-h-0 sw:flex-1 sw:bg-surface",
888
+ children: tile.imageUrl ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", {
889
+ src: imageSrc(tile.imageUrl),
890
+ alt: "",
891
+ className: `sw:h-full sw:w-full sw:object-cover ${tile.state === "maintenance" ? "sw:grayscale" : ""}`
892
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
893
+ className: "sw:flex sw:h-full sw:w-full sw:items-center sw:justify-center sw:text-muted",
894
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PackageIcon, { style: {
895
+ width: width * .3,
896
+ height: width * .3
897
+ } })
898
+ })
899
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
900
+ className: "sw:flex sw:items-center sw:gap-2 sw:px-2",
901
+ style: {
902
+ fontSize: font,
903
+ paddingBlock: font * .3
904
+ },
905
+ children: [
906
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, {
907
+ className: "sw:shrink-0",
908
+ style: {
909
+ width: icon,
910
+ height: icon
911
+ }
912
+ }),
913
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
914
+ className: "sw:min-w-0 sw:flex-1 sw:truncate sw:font-bold sw:leading-tight",
915
+ children: tile.name
916
+ }),
917
+ elapsed && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
918
+ className: "sw:shrink-0 sw:font-semibold sw:tabular-nums sw:opacity-80",
919
+ style: { fontSize: font * .75 },
920
+ children: elapsed
921
+ })
922
+ ]
923
+ })]
924
+ });
925
+ }
926
+ // frontend/src/display/WallDisplayPage.tsx
927
+ var { Spinner } = await importShared("@heroui/react");
928
+ var { LinkIcon, WifiOffIcon } = await importShared("lucide-react");
929
+ var { useParams } = await importShared("react-router-dom");
930
+ var GAP = 16;
931
+ var STATES = [
932
+ "ready",
933
+ "in-use",
934
+ "maintenance"
935
+ ];
936
+ /** Toggles full screen, for a screen set up with a mouse: double-click anywhere. */
937
+ var toggleFullscreen = () => {
938
+ if (document.fullscreenElement) document.exitFullscreen().catch(() => void 0);
939
+ else document.documentElement.requestFullscreen?.().catch(() => void 0);
940
+ };
941
+ /** The public full-screen wall: every resource as a picture in its traffic-light colour, fitted to the screen. */
942
+ function WallDisplayPage() {
943
+ const { token = "" } = useParams();
944
+ const { t, language } = useStatusWallTranslations();
945
+ const wall = useWallSnapshot(token);
946
+ const now = useNow(15e3);
947
+ const tiles = wall.data?.tiles ?? [];
948
+ const grid = useFitGrid(tiles.length, GAP);
949
+ useWakeLock();
950
+ if (wall.gone) return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
951
+ className: "sw:flex sw:h-dvh sw:flex-col sw:items-center sw:justify-center sw:gap-4 sw:bg-background sw:p-8 sw:text-center sw:text-foreground",
952
+ "data-cy": "status-wall-gone",
953
+ children: [
954
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LinkIcon, { className: "sw:h-16 sw:w-16 sw:text-muted" }),
955
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
956
+ className: "sw:text-3xl sw:font-bold",
957
+ children: t("display.gone.title")
958
+ }),
959
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
960
+ className: "sw:text-xl sw:text-muted",
961
+ children: t("display.gone.body")
962
+ })
963
+ ]
964
+ });
965
+ const counts = STATES.map((state) => ({
966
+ state,
967
+ count: tiles.filter((tile) => tile.state === state).length
968
+ }));
969
+ const offline = wall.isError && wall.data !== void 0;
970
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
971
+ className: "sw:flex sw:h-dvh sw:flex-col sw:gap-4 sw:overflow-hidden sw:bg-background sw:p-4 sw:text-foreground",
972
+ onDoubleClick: toggleFullscreen,
973
+ "data-cy": "status-wall",
974
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("header", {
975
+ className: "sw:flex sw:flex-wrap sw:items-center sw:gap-x-6 sw:gap-y-2",
976
+ children: [
977
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", {
978
+ className: "sw:min-w-0 sw:flex-1 sw:truncate sw:text-3xl sw:font-bold",
979
+ children: wall.data?.name ?? ""
980
+ }),
981
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
982
+ className: "sw:flex sw:items-center sw:gap-3",
983
+ children: counts.map(({ state, count }) => {
984
+ const Icon = STATE_STYLES[state].icon;
985
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
986
+ className: `sw:flex sw:items-center sw:gap-2 sw:rounded-full sw:px-4 sw:py-1 sw:text-2xl sw:font-bold ${STATE_STYLES[state].tone}`,
987
+ title: t(`state.${state}`),
988
+ "data-cy": `status-wall-count-${state}`,
989
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { className: "sw:h-6 sw:w-6" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
990
+ className: "sw:tabular-nums",
991
+ children: count
992
+ })]
993
+ }, state);
994
+ })
995
+ }),
996
+ offline && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
997
+ title: t("display.offline"),
998
+ "data-cy": "status-wall-offline",
999
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(WifiOffIcon, {
1000
+ className: "sw:h-7 sw:w-7 sw:text-danger",
1001
+ "aria-label": t("display.offline")
1002
+ })
1003
+ }),
1004
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("time", {
1005
+ className: "sw:text-3xl sw:font-semibold sw:tabular-nums",
1006
+ children: now.toLocaleTimeString(language, {
1007
+ hour: "2-digit",
1008
+ minute: "2-digit"
1009
+ })
1010
+ })
1011
+ ]
1012
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("main", {
1013
+ ref: grid.ref,
1014
+ className: "sw:flex sw:min-h-0 sw:flex-1 sw:items-center sw:justify-center",
1015
+ children: wall.isPending ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, { size: "lg" }) : tiles.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
1016
+ className: "sw:text-2xl sw:text-muted",
1017
+ "data-cy": "status-wall-empty",
1018
+ children: t("display.empty")
1019
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
1020
+ className: "sw:grid sw:justify-center",
1021
+ style: {
1022
+ gap: GAP,
1023
+ gridTemplateColumns: `repeat(${grid.columns}, ${grid.tileWidth}px)`
1024
+ },
1025
+ children: tiles.map((tile) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(WallTile, {
1026
+ tile,
1027
+ width: grid.tileWidth,
1028
+ now,
1029
+ label: t(`state.${tile.state}`)
1030
+ }, tile.id))
1031
+ })
1032
+ })]
1033
+ });
1034
+ }
1035
+ // frontend/src/plugin.tsx
1036
+ var { useTranslationState } = await importShared("@attraccess/plugins-frontend-ui");
1037
+ var { MonitorIcon } = await importShared("lucide-react");
1038
+ var labels = () => useTranslationState.getState().language === "de" ? de_default : en_default;
1039
+ var StatusWallPlugin = class {
1040
+ getPluginName() {
1041
+ return "status-wall-plugin@0.1.0";
1042
+ }
1043
+ getDependencies() {
1044
+ return [];
1045
+ }
1046
+ init(store) {
1047
+ this.pluginStore = store;
1048
+ }
1049
+ activate() {}
1050
+ deactivate() {}
1051
+ onApiAuthStateChange(_authData) {}
1052
+ onApiEndpointChange(_endpoint) {}
1053
+ getRoutes() {
1054
+ return [{
1055
+ path: "/status-walls",
1056
+ authRequired: STATUS_WALL_MANAGE,
1057
+ element: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(WallsPage, {})
1058
+ }, {
1059
+ path: "/status-wall/:token",
1060
+ authRequired: false,
1061
+ noLayout: true,
1062
+ element: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(WallDisplayPage, {})
1063
+ }];
1064
+ }
1065
+ getSidebarItems() {
1066
+ return [{
1067
+ label: labels().sidebar,
1068
+ path: "/status-walls",
1069
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MonitorIcon, { className: "sw:h-5 sw:w-5" })
1070
+ }];
1071
+ }
1072
+ };
1073
+ export { StatusWallPlugin as default };