@nivaro/react 0.3.44 → 0.3.46
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.
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +75 -7
- package/dist/shared/components/BaseMap.js +149 -103
- package/dist/shared/components/CollectionBrowserView.js +1390 -1358
- package/dist/shared/components/DataTable.js +356 -334
- package/dist/shared/components/ProfileView.js +16 -21
- package/dist/shared/components/command-center/CommandCenterView.js +331 -352
- package/dist/shared/components/command-center/Customize.js +353 -0
- package/dist/shared/components/command-center/Header.js +296 -0
- package/dist/shared/components/command-center/KioskLinks.js +198 -0
- package/dist/shared/components/command-center/PeekPanel.js +146 -0
- package/dist/shared/components/command-center/announce.js +13 -0
- package/dist/shared/components/command-center/api.js +26 -0
- package/dist/shared/components/command-center/board-prefs.js +99 -0
- package/dist/shared/components/command-center/freshness.js +29 -0
- package/dist/shared/components/command-center/layout.js +56 -0
- package/dist/shared/components/command-center/panels/AttentionPanel.js +135 -0
- package/dist/shared/components/command-center/panels/Banner.js +75 -0
- package/dist/shared/components/command-center/panels/BoardSettings.js +223 -0
- package/dist/shared/components/command-center/panels/FeedPanel.js +149 -0
- package/dist/shared/components/command-center/panels/FlowPanel.js +159 -0
- package/dist/shared/components/command-center/panels/ForecastPanel.js +247 -0
- package/dist/shared/components/command-center/panels/MapLegend.js +266 -0
- package/dist/shared/components/command-center/panels/MapPanel.js +224 -0
- package/dist/shared/components/command-center/panels/PartnersPanel.js +52 -0
- package/dist/shared/components/command-center/panels/PeoplePanel.js +264 -0
- package/dist/shared/components/command-center/panels/RegionPicker.js +91 -0
- package/dist/shared/components/command-center/panels/SystemPanel.js +173 -0
- package/dist/shared/components/command-center/panels/ThroughputPanel.js +310 -0
- package/dist/shared/components/command-center/panels/TimeBar.js +231 -0
- package/dist/shared/components/command-center/panels/TrafficPanel.js +15 -0
- package/dist/shared/components/command-center/panels/WorkloadPanel.js +85 -0
- package/dist/shared/components/command-center/panels/attention-actions.js +267 -0
- package/dist/shared/components/command-center/panels/map-shared.js +95 -0
- package/dist/shared/components/command-center/panels/registry.js +96 -0
- package/dist/shared/components/command-center/shell-hooks.js +118 -0
- package/dist/shared/components/command-center/shortcuts.js +37 -0
- package/dist/shared/components/command-center/state.js +12 -0
- package/dist/shared/components/command-center/theme.js +84 -0
- package/dist/shared/components/command-center/time.js +52 -0
- package/dist/shared/components/command-center/url-state.js +54 -0
- package/dist/shared/components/command-center/work-links.js +32 -0
- package/dist/shared/components/imports/ImportConsole.js +48 -47
- package/dist/shared/components/monitoring/TrafficMiniMap.js +111 -70
- package/dist/shared/components/notifications/TestMyRules.js +39 -38
- package/dist/shared/components/profile/TeamsConnect.js +2 -2
- package/dist/shared/components/queue/QueueQuickFilters.js +81 -63
- package/dist/shared/components/queue/QueueWorklist.js +598 -586
- package/dist/shared/lib/quick-filter-cascade.js +29 -0
- package/package.json +1 -1
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { jsxs as i, jsx as t, Fragment as F } from "react/jsx-runtime";
|
|
2
|
+
import { Check as W, Copy as K } from "lucide-react";
|
|
3
|
+
import { useState as l, useId as w } from "react";
|
|
4
|
+
import { SimpleSelect as k } from "../ui/SimpleSelect.js";
|
|
5
|
+
import { useKioskLinks as M, useCreateKioskLink as j, useRevokeKioskLink as A } from "./board-prefs.js";
|
|
6
|
+
import { formatAge as I } from "./freshness.js";
|
|
7
|
+
import { useCc as P } from "./state.js";
|
|
8
|
+
import { MUTED as U, FOCUS as s, FAINT as N, BUTTON as p } from "./theme.js";
|
|
9
|
+
const O = "text-[13px] font-semibold text-[var(--cc-strong)]", $ = "h-8 w-full rounded-md border border-[var(--cc-border)] bg-[var(--cc-panel)] px-2.5 text-[12.5px] text-[var(--cc-text)] placeholder:text-[var(--cc-faint)]";
|
|
10
|
+
function R(a, o) {
|
|
11
|
+
if (a.expired || !a.expires_at) return "Expired";
|
|
12
|
+
const n = Math.ceil((new Date(a.expires_at).getTime() - o) / 864e5);
|
|
13
|
+
return n <= 1 ? "Expires today" : `Expires in ${n} days`;
|
|
14
|
+
}
|
|
15
|
+
function B({ url: a }) {
|
|
16
|
+
const [o, n] = l(!1), c = w();
|
|
17
|
+
return /* @__PURE__ */ i("div", { className: "space-y-1.5 rounded-md border border-nvr-cyan/40 bg-[var(--cc-chip)] p-2.5", children: [
|
|
18
|
+
/* @__PURE__ */ t("label", { htmlFor: c, className: "block text-[12px] font-medium text-[var(--cc-text)]", children: "Copy this address now — it won’t be shown again" }),
|
|
19
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
|
|
20
|
+
/* @__PURE__ */ t(
|
|
21
|
+
"input",
|
|
22
|
+
{
|
|
23
|
+
id: c,
|
|
24
|
+
readOnly: !0,
|
|
25
|
+
value: a,
|
|
26
|
+
onFocus: (r) => r.currentTarget.select(),
|
|
27
|
+
className: `${$} font-mono text-[11.5px] ${s}`
|
|
28
|
+
}
|
|
29
|
+
),
|
|
30
|
+
/* @__PURE__ */ i(
|
|
31
|
+
"button",
|
|
32
|
+
{
|
|
33
|
+
type: "button",
|
|
34
|
+
className: `${p} inline-flex shrink-0 items-center gap-1 ${s}`,
|
|
35
|
+
onClick: () => {
|
|
36
|
+
var r;
|
|
37
|
+
(r = navigator.clipboard) == null || r.writeText(a).then(
|
|
38
|
+
() => n(!0),
|
|
39
|
+
() => n(!1)
|
|
40
|
+
);
|
|
41
|
+
},
|
|
42
|
+
children: [
|
|
43
|
+
o ? /* @__PURE__ */ t(W, { className: "h-3.5 w-3.5", "aria-hidden": !0 }) : /* @__PURE__ */ t(K, { className: "h-3.5 w-3.5", "aria-hidden": !0 }),
|
|
44
|
+
o ? "Copied" : "Copy"
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
] })
|
|
49
|
+
] });
|
|
50
|
+
}
|
|
51
|
+
function Y() {
|
|
52
|
+
var v;
|
|
53
|
+
const a = P(), o = M(a.isAdmin), n = j(), c = A(), [r, u] = l(""), [h, C] = l("30"), [b, T] = l(""), [x, _] = l(null), [L, m] = l(null), d = w(), f = Date.now(), g = ((v = a.config) == null ? void 0 : v.regions) ?? [], E = (e) => {
|
|
54
|
+
var y;
|
|
55
|
+
return e ? ((y = g.find((D) => D.id === e)) == null ? void 0 : y.label) ?? "A region" : "Everywhere";
|
|
56
|
+
}, S = () => {
|
|
57
|
+
r.trim() && n.mutate(
|
|
58
|
+
{
|
|
59
|
+
label: r.trim(),
|
|
60
|
+
expires_in_days: Number(h),
|
|
61
|
+
region: b || null,
|
|
62
|
+
map_collection: a.mapCollection
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
onSuccess: (e) => {
|
|
66
|
+
_(`${window.location.origin}${e.url}`), u("");
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
};
|
|
71
|
+
return /* @__PURE__ */ i(
|
|
72
|
+
"section",
|
|
73
|
+
{
|
|
74
|
+
className: "space-y-2 border-t border-[var(--cc-border)] pt-4",
|
|
75
|
+
"aria-labelledby": `${d}-h`,
|
|
76
|
+
children: [
|
|
77
|
+
/* @__PURE__ */ t("h3", { id: `${d}-h`, className: O, children: "Wallboard links" }),
|
|
78
|
+
/* @__PURE__ */ t("p", { className: `text-[12px] ${U}`, children: "Show this board on a screen without signing in. The screen sees what you can see, read only, in TV mode." }),
|
|
79
|
+
/* @__PURE__ */ i(
|
|
80
|
+
"form",
|
|
81
|
+
{
|
|
82
|
+
className: "space-y-2",
|
|
83
|
+
onSubmit: (e) => {
|
|
84
|
+
e.preventDefault(), S();
|
|
85
|
+
},
|
|
86
|
+
children: [
|
|
87
|
+
/* @__PURE__ */ t("label", { htmlFor: d, className: "sr-only", children: "Which screen is this link for" }),
|
|
88
|
+
/* @__PURE__ */ t(
|
|
89
|
+
"input",
|
|
90
|
+
{
|
|
91
|
+
id: d,
|
|
92
|
+
value: r,
|
|
93
|
+
onChange: (e) => u(e.target.value),
|
|
94
|
+
placeholder: "Which screen? e.g. Dispatch wall",
|
|
95
|
+
maxLength: 80,
|
|
96
|
+
className: `${$} ${s}`
|
|
97
|
+
}
|
|
98
|
+
),
|
|
99
|
+
/* @__PURE__ */ i("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
100
|
+
/* @__PURE__ */ t(
|
|
101
|
+
k,
|
|
102
|
+
{
|
|
103
|
+
ariaLabel: "How long the link works",
|
|
104
|
+
value: h,
|
|
105
|
+
onChange: C,
|
|
106
|
+
className: "h-8 text-[12.5px]",
|
|
107
|
+
options: [
|
|
108
|
+
{ value: "1", label: "Works for 1 day" },
|
|
109
|
+
{ value: "7", label: "Works for 7 days" },
|
|
110
|
+
{ value: "30", label: "Works for 30 days" },
|
|
111
|
+
{ value: "90", label: "Works for 90 days" }
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
),
|
|
115
|
+
/* @__PURE__ */ t(
|
|
116
|
+
k,
|
|
117
|
+
{
|
|
118
|
+
ariaLabel: "Region the screen shows",
|
|
119
|
+
value: b,
|
|
120
|
+
onChange: T,
|
|
121
|
+
className: "h-8 text-[12.5px]",
|
|
122
|
+
options: [
|
|
123
|
+
{ value: "", label: "Everywhere" },
|
|
124
|
+
...g.map((e) => ({ value: e.id, label: e.label }))
|
|
125
|
+
]
|
|
126
|
+
}
|
|
127
|
+
)
|
|
128
|
+
] }),
|
|
129
|
+
/* @__PURE__ */ t("div", { className: "flex justify-end", children: /* @__PURE__ */ t(
|
|
130
|
+
"button",
|
|
131
|
+
{
|
|
132
|
+
type: "submit",
|
|
133
|
+
disabled: !r.trim() || n.isPending,
|
|
134
|
+
className: `rounded-md bg-nvr-cyan px-2.5 py-1 text-[11.5px] font-medium text-white disabled:opacity-50 ${s}`,
|
|
135
|
+
children: n.isPending ? "Making the link…" : "Make a link"
|
|
136
|
+
}
|
|
137
|
+
) }),
|
|
138
|
+
n.isError && /* @__PURE__ */ t("p", { role: "alert", className: "text-[12px] text-[var(--cc-bad-text)]", children: "Couldn’t make the link. Try again." })
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
),
|
|
142
|
+
x && /* @__PURE__ */ t(B, { url: x }),
|
|
143
|
+
(o.data ?? []).length > 0 && /* @__PURE__ */ t("ul", { className: "divide-y divide-[var(--cc-border)] rounded-md border border-[var(--cc-border)]", children: (o.data ?? []).map((e) => /* @__PURE__ */ i("li", { className: "flex items-center gap-2 px-2.5 py-2", children: [
|
|
144
|
+
/* @__PURE__ */ i("div", { className: "min-w-0 flex-1", children: [
|
|
145
|
+
/* @__PURE__ */ t("p", { className: "truncate text-[12.5px] font-medium text-[var(--cc-text)]", children: e.label }),
|
|
146
|
+
/* @__PURE__ */ t(
|
|
147
|
+
"p",
|
|
148
|
+
{
|
|
149
|
+
className: `truncate text-[11.5px] ${e.expired ? "text-[var(--cc-warn-text)]" : N}`,
|
|
150
|
+
children: [
|
|
151
|
+
E(e.region),
|
|
152
|
+
R(e, f),
|
|
153
|
+
e.created_by_name ? `made by ${e.created_by_name}` : null,
|
|
154
|
+
// A screen showing the link checks in every few minutes.
|
|
155
|
+
e.last_viewed_at ? `last on screen ${I(f - new Date(e.last_viewed_at).getTime())}` : "not opened yet"
|
|
156
|
+
].filter(Boolean).join(" · ")
|
|
157
|
+
}
|
|
158
|
+
)
|
|
159
|
+
] }),
|
|
160
|
+
L === e.id ? /* @__PURE__ */ i(F, { children: [
|
|
161
|
+
/* @__PURE__ */ t(
|
|
162
|
+
"button",
|
|
163
|
+
{
|
|
164
|
+
type: "button",
|
|
165
|
+
className: `${p} ${s}`,
|
|
166
|
+
onClick: () => m(null),
|
|
167
|
+
children: "Keep"
|
|
168
|
+
}
|
|
169
|
+
),
|
|
170
|
+
/* @__PURE__ */ t(
|
|
171
|
+
"button",
|
|
172
|
+
{
|
|
173
|
+
type: "button",
|
|
174
|
+
className: `rounded-md bg-[var(--cc-bad-bg)] px-2.5 py-1 text-[11.5px] font-medium text-[var(--cc-bad-text)] ${s}`,
|
|
175
|
+
disabled: c.isPending,
|
|
176
|
+
onClick: () => c.mutate(e.id, { onSettled: () => m(null) }),
|
|
177
|
+
children: "Turn off"
|
|
178
|
+
}
|
|
179
|
+
)
|
|
180
|
+
] }) : /* @__PURE__ */ t(
|
|
181
|
+
"button",
|
|
182
|
+
{
|
|
183
|
+
type: "button",
|
|
184
|
+
className: `${p} ${s}`,
|
|
185
|
+
"aria-label": `Turn off the link for ${e.label}`,
|
|
186
|
+
onClick: () => m(e.id),
|
|
187
|
+
children: "Turn off"
|
|
188
|
+
}
|
|
189
|
+
)
|
|
190
|
+
] }, e.id)) }),
|
|
191
|
+
o.isError && /* @__PURE__ */ t("p", { className: `text-[12px] ${N}`, children: "Couldn’t load the wallboard links." })
|
|
192
|
+
]
|
|
193
|
+
}
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
export {
|
|
197
|
+
Y as KioskLinks
|
|
198
|
+
};
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { jsxs as l, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as y, useMutation as k } from "@tanstack/react-query";
|
|
3
|
+
import { ExternalLink as C } from "lucide-react";
|
|
4
|
+
import { useState as w, useEffect as $ } from "react";
|
|
5
|
+
import { toast as b } from "sonner";
|
|
6
|
+
import { useNivaroClient as P } from "../../context.js";
|
|
7
|
+
import { post as T } from "../../lib/commands.js";
|
|
8
|
+
import { cn as p } from "../../lib/utils.js";
|
|
9
|
+
import { useCcQuery as S } from "./api.js";
|
|
10
|
+
import { CcSidePanel as E, slaWords as U } from "./panels/map-shared.js";
|
|
11
|
+
import { useCc as A } from "./state.js";
|
|
12
|
+
import { MUTED as u, FOCUS as v, BUTTON as x, FAINT as d } from "./theme.js";
|
|
13
|
+
function z() {
|
|
14
|
+
var r;
|
|
15
|
+
const e = A(), s = e.peek, m = () => e.setPeek(null), i = S(
|
|
16
|
+
"/peek",
|
|
17
|
+
s ? { collection: s.collection, id: s.id } : {},
|
|
18
|
+
{ enabled: !!s, lenses: !1, retry: !1, staleTime: 15e3 }
|
|
19
|
+
), a = i.data, o = i.isError && ((r = i.error) == null ? void 0 : r.status) === 404;
|
|
20
|
+
return /* @__PURE__ */ l(
|
|
21
|
+
E,
|
|
22
|
+
{
|
|
23
|
+
peek: !0,
|
|
24
|
+
open: !!s,
|
|
25
|
+
label: "Record preview",
|
|
26
|
+
title: a ? a.title : o ? "Not available" : "Loading…",
|
|
27
|
+
subtitle: a == null ? void 0 : a.collection_label,
|
|
28
|
+
onClose: m,
|
|
29
|
+
footer: a && /* @__PURE__ */ l(
|
|
30
|
+
"button",
|
|
31
|
+
{
|
|
32
|
+
type: "button",
|
|
33
|
+
onClick: () => {
|
|
34
|
+
e.navigate(e.recordUrl(a.collection, a.id)), m();
|
|
35
|
+
},
|
|
36
|
+
className: p(x, v, "inline-flex items-center gap-1.5"),
|
|
37
|
+
children: [
|
|
38
|
+
/* @__PURE__ */ n(C, { className: "h-3.5 w-3.5", "aria-hidden": "true" }),
|
|
39
|
+
" Open full record"
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
),
|
|
43
|
+
children: [
|
|
44
|
+
i.isLoading && /* @__PURE__ */ n(M, {}),
|
|
45
|
+
o && /* @__PURE__ */ n("p", { className: `text-[12px] ${u}`, children: "This record is not there any more, or you do not have access to it." }),
|
|
46
|
+
i.isError && !o && /* @__PURE__ */ n("p", { className: "text-[12px] text-[var(--cc-bad-text)]", children: "Could not load this record." }),
|
|
47
|
+
a && /* @__PURE__ */ n(q, { rec: a, canAct: !e.kiosk })
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
function M() {
|
|
53
|
+
return /* @__PURE__ */ n("div", { className: "space-y-2", "aria-hidden": "true", children: [70, 45, 90, 60].map((e) => /* @__PURE__ */ n(
|
|
54
|
+
"div",
|
|
55
|
+
{
|
|
56
|
+
className: "h-3 animate-pulse rounded bg-[var(--cc-chip-hover)]",
|
|
57
|
+
style: { width: `${e}%` }
|
|
58
|
+
},
|
|
59
|
+
e
|
|
60
|
+
)) });
|
|
61
|
+
}
|
|
62
|
+
function q({ rec: e, canAct: s }) {
|
|
63
|
+
const m = P(), i = y(), [a, o] = w(null);
|
|
64
|
+
$(() => {
|
|
65
|
+
if (!a) return;
|
|
66
|
+
const t = setTimeout(() => o(null), 6e3);
|
|
67
|
+
return () => clearTimeout(t);
|
|
68
|
+
}, [a]);
|
|
69
|
+
const r = k({
|
|
70
|
+
mutationFn: (t) => m.request(
|
|
71
|
+
T(
|
|
72
|
+
`/pipelines/instance/${encodeURIComponent(e.collection)}/${encodeURIComponent(e.id)}/transition`,
|
|
73
|
+
{ transition_id: t }
|
|
74
|
+
)
|
|
75
|
+
),
|
|
76
|
+
onSuccess: (t, c) => {
|
|
77
|
+
var f;
|
|
78
|
+
const g = ((f = e.transitions.find((N) => N.key === c)) == null ? void 0 : f.label) ?? "Moved";
|
|
79
|
+
b.success(`${g} — done`), o(null), i.invalidateQueries({ queryKey: ["command-center"] });
|
|
80
|
+
},
|
|
81
|
+
onError: (t) => {
|
|
82
|
+
o(null), b.error(t.message || "That move did not go through");
|
|
83
|
+
}
|
|
84
|
+
}), h = U(e.sla);
|
|
85
|
+
return /* @__PURE__ */ l("div", { className: "space-y-4 text-[12px]", children: [
|
|
86
|
+
/* @__PURE__ */ l("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
87
|
+
e.state && /* @__PURE__ */ l("span", { className: "inline-flex items-center gap-1.5 rounded-full bg-[var(--cc-chip)] px-2 py-0.5", children: [
|
|
88
|
+
/* @__PURE__ */ n(
|
|
89
|
+
"span",
|
|
90
|
+
{
|
|
91
|
+
className: "h-2 w-2 rounded-full",
|
|
92
|
+
style: { background: e.state.color ?? "#00a5cc" },
|
|
93
|
+
"aria-hidden": "true"
|
|
94
|
+
}
|
|
95
|
+
),
|
|
96
|
+
e.state.label
|
|
97
|
+
] }),
|
|
98
|
+
h && /* @__PURE__ */ n(
|
|
99
|
+
"span",
|
|
100
|
+
{
|
|
101
|
+
className: p(
|
|
102
|
+
"rounded-full px-2 py-0.5 font-medium",
|
|
103
|
+
e.sla === "breached" ? "bg-red-500/15 text-[var(--cc-bad-text)]" : "bg-amber-500/15 text-[var(--cc-warn-text)]"
|
|
104
|
+
),
|
|
105
|
+
children: h
|
|
106
|
+
}
|
|
107
|
+
),
|
|
108
|
+
e.sla === "ok" && /* @__PURE__ */ n("span", { className: `rounded-full bg-[var(--cc-chip)] px-2 py-0.5 ${u}`, children: "SLA on time" }),
|
|
109
|
+
!e.state && /* @__PURE__ */ n("span", { className: d, children: "Not in a pipeline" })
|
|
110
|
+
] }),
|
|
111
|
+
/* @__PURE__ */ l("div", { children: [
|
|
112
|
+
/* @__PURE__ */ n("p", { className: `mb-1 ${d}`, children: "Owners" }),
|
|
113
|
+
e.owners.length > 0 ? /* @__PURE__ */ n("p", { className: "text-[var(--cc-text)]", children: e.owners.map((t) => t.name).join(", ") }) : /* @__PURE__ */ n("p", { className: u, children: "Nobody owns this step" })
|
|
114
|
+
] }),
|
|
115
|
+
e.facts.length > 0 && /* @__PURE__ */ n("dl", { className: "grid grid-cols-[auto_1fr] gap-x-3 gap-y-1.5", children: e.facts.map((t) => /* @__PURE__ */ l("div", { className: "contents", children: [
|
|
116
|
+
/* @__PURE__ */ n("dt", { className: d, children: t.label }),
|
|
117
|
+
/* @__PURE__ */ n("dd", { className: "min-w-0 break-words text-[var(--cc-text)]", children: t.value })
|
|
118
|
+
] }, t.label)) }),
|
|
119
|
+
s && e.transitions.length > 0 && /* @__PURE__ */ l("div", { children: [
|
|
120
|
+
/* @__PURE__ */ n("p", { className: `mb-1.5 ${d}`, children: "Move it" }),
|
|
121
|
+
/* @__PURE__ */ n("div", { className: "flex flex-wrap gap-1.5", children: e.transitions.map((t) => {
|
|
122
|
+
const c = a === t.key;
|
|
123
|
+
return /* @__PURE__ */ n(
|
|
124
|
+
"button",
|
|
125
|
+
{
|
|
126
|
+
type: "button",
|
|
127
|
+
disabled: r.isPending,
|
|
128
|
+
onClick: () => c ? r.mutate(t.key) : o(t.key),
|
|
129
|
+
"aria-label": c ? `Confirm: ${t.label}` : t.label,
|
|
130
|
+
className: p(
|
|
131
|
+
x,
|
|
132
|
+
v,
|
|
133
|
+
c && "border-nvr-cyan bg-nvr-cyan text-white hover:bg-nvr-cyan"
|
|
134
|
+
),
|
|
135
|
+
children: r.isPending && c ? "Moving…" : c ? `Confirm ${t.label}` : t.label
|
|
136
|
+
},
|
|
137
|
+
t.key
|
|
138
|
+
);
|
|
139
|
+
}) }),
|
|
140
|
+
a && !r.isPending && /* @__PURE__ */ n("p", { className: `mt-1.5 ${d}`, role: "status", children: "Click again to confirm. Some moves ask for more on the full record." })
|
|
141
|
+
] })
|
|
142
|
+
] });
|
|
143
|
+
}
|
|
144
|
+
export {
|
|
145
|
+
z as PeekPanel
|
|
146
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
function i(n) {
|
|
2
|
+
return Array.isArray(n) ? n.length : n && typeof n == "object" && Array.isArray(n.items) ? n.items.length : null;
|
|
3
|
+
}
|
|
4
|
+
function r(n, t) {
|
|
5
|
+
if (n === null || t === null || n === t) return "";
|
|
6
|
+
if (t === 0) return "Nothing needs attention now.";
|
|
7
|
+
const e = t === 1 ? "1 item needs attention" : `${t} items need attention`;
|
|
8
|
+
return t > n ? `${e} — ${t - n} new.` : `${e}.`;
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
r as attentionAnnouncement,
|
|
12
|
+
i as attentionCount
|
|
13
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useQuery as f } from "@tanstack/react-query";
|
|
2
|
+
import { useNivaroClient as g } from "../../context.js";
|
|
3
|
+
import { get as p } from "../../lib/commands.js";
|
|
4
|
+
import { useCc as y } from "./state.js";
|
|
5
|
+
function q(e, r) {
|
|
6
|
+
return {
|
|
7
|
+
...r ?? {},
|
|
8
|
+
...e.region ? { region: e.region } : {},
|
|
9
|
+
...e.at ? { at: new Date(e.at).toISOString() } : {}
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
function Q(e, r, o) {
|
|
13
|
+
const s = g(), { region: c, at: u, kiosk: t } = y(), { lenses: i, ...m } = o ?? {}, n = {
|
|
14
|
+
...i !== !1 ? q({ region: c, at: u }, r) : r ?? {},
|
|
15
|
+
...t ? { kiosk: t } : {}
|
|
16
|
+
};
|
|
17
|
+
return f({
|
|
18
|
+
queryKey: ["command-center", e, n],
|
|
19
|
+
queryFn: () => s.request(p(`/command-center${e}`, n)).then((a) => a.data),
|
|
20
|
+
...m
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
q as ccParams,
|
|
25
|
+
Q as useCcQuery
|
|
26
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { useQuery as c, useQueryClient as a, useMutation as i } from "@tanstack/react-query";
|
|
2
|
+
import { useNivaroClient as o } from "../../context.js";
|
|
3
|
+
import { get as l, put as d, post as f, del as q } from "../../lib/commands.js";
|
|
4
|
+
const s = ["command-center", "prefs"], y = ["command-center", "role-defaults"], m = ["command-center", "kiosk-links"], k = {
|
|
5
|
+
layout: null,
|
|
6
|
+
theme: "app",
|
|
7
|
+
saved_views: [],
|
|
8
|
+
role_default: null,
|
|
9
|
+
tv_cycle_seconds: 30
|
|
10
|
+
};
|
|
11
|
+
function _(t) {
|
|
12
|
+
const n = o();
|
|
13
|
+
return c({
|
|
14
|
+
queryKey: s,
|
|
15
|
+
queryFn: () => n.request(l("/command-center/prefs")).then((e) => e.data),
|
|
16
|
+
enabled: t,
|
|
17
|
+
staleTime: 5 * 6e4,
|
|
18
|
+
retry: !1
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
function p() {
|
|
22
|
+
const t = o(), n = a();
|
|
23
|
+
return i({
|
|
24
|
+
mutationFn: (e) => t.request(d("/command-center/prefs", e)).then((r) => r.data),
|
|
25
|
+
onMutate: async (e) => {
|
|
26
|
+
await n.cancelQueries({ queryKey: s });
|
|
27
|
+
const r = n.getQueryData(s);
|
|
28
|
+
return n.setQueryData(s, { ...k, ...r ?? {}, ...e }), { before: r };
|
|
29
|
+
},
|
|
30
|
+
onError: (e, r, u) => {
|
|
31
|
+
u != null && u.before && n.setQueryData(s, u.before);
|
|
32
|
+
},
|
|
33
|
+
onSuccess: (e) => n.setQueryData(s, e)
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function Q(t) {
|
|
37
|
+
const n = o();
|
|
38
|
+
return c({
|
|
39
|
+
queryKey: y,
|
|
40
|
+
queryFn: () => n.request(l("/command-center/role-defaults")).then((e) => e.data),
|
|
41
|
+
enabled: t
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
function S() {
|
|
45
|
+
const t = o(), n = a();
|
|
46
|
+
return i({
|
|
47
|
+
mutationFn: (e) => t.request(d("/command-center/role-defaults", e)).then((r) => r.data),
|
|
48
|
+
onSuccess: (e) => {
|
|
49
|
+
n.setQueryData(y, e), n.invalidateQueries({ queryKey: s });
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
function h(t) {
|
|
54
|
+
const n = o();
|
|
55
|
+
return c({
|
|
56
|
+
queryKey: m,
|
|
57
|
+
queryFn: () => n.request(l("/command-center/kiosk-links")).then((e) => e.data),
|
|
58
|
+
enabled: t
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function D() {
|
|
62
|
+
const t = o(), n = a();
|
|
63
|
+
return i({
|
|
64
|
+
mutationFn: (e) => t.request(f("/command-center/kiosk-links", e)).then((r) => r.data),
|
|
65
|
+
onSuccess: () => void n.invalidateQueries({ queryKey: m })
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
function E() {
|
|
69
|
+
const t = o(), n = a();
|
|
70
|
+
return i({
|
|
71
|
+
mutationFn: (e) => t.request(q(`/command-center/kiosk-links/${e}`)),
|
|
72
|
+
onSuccess: () => void n.invalidateQueries({ queryKey: m })
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
function L(t) {
|
|
76
|
+
const n = o();
|
|
77
|
+
return c({
|
|
78
|
+
queryKey: ["command-center", "kiosk-info", t],
|
|
79
|
+
queryFn: () => n.request(l("/command-center/kiosk", { kiosk: t })).then((e) => e.data),
|
|
80
|
+
enabled: !!t,
|
|
81
|
+
// Re-checked every few minutes, so a revoked or expired link leaves the wall promptly.
|
|
82
|
+
refetchInterval: 5 * 6e4,
|
|
83
|
+
retry: 1
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
export {
|
|
87
|
+
k as DEFAULT_PREFS,
|
|
88
|
+
m as KIOSK_LINKS_KEY,
|
|
89
|
+
s as PREFS_KEY,
|
|
90
|
+
y as ROLE_DEFAULTS_KEY,
|
|
91
|
+
_ as useCcPrefs,
|
|
92
|
+
Q as useCcRoleDefaults,
|
|
93
|
+
D as useCreateKioskLink,
|
|
94
|
+
L as useKioskInfo,
|
|
95
|
+
h as useKioskLinks,
|
|
96
|
+
E as useRevokeKioskLink,
|
|
97
|
+
p as useSaveCcPrefs,
|
|
98
|
+
S as useSaveRoleDefault
|
|
99
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const u = 2;
|
|
2
|
+
function i(n) {
|
|
3
|
+
const t = Math.max(0, Math.floor(n / 1e3));
|
|
4
|
+
if (t < 2) return "just now";
|
|
5
|
+
if (t < 60) return `${t}s ago`;
|
|
6
|
+
const r = Math.floor(t / 60);
|
|
7
|
+
if (r < 60) return `${r}m ago`;
|
|
8
|
+
const o = Math.floor(r / 60);
|
|
9
|
+
return o < 24 ? `${o}h ago` : `${Math.floor(o / 24)}d ago`;
|
|
10
|
+
}
|
|
11
|
+
function a(n) {
|
|
12
|
+
return new Date(n).toLocaleTimeString([], { hour: "numeric", minute: "2-digit" });
|
|
13
|
+
}
|
|
14
|
+
function f(n) {
|
|
15
|
+
const { updatedAt: t, failures: r, now: o } = n;
|
|
16
|
+
if (!t) return r >= 2 ? { kind: "failed" } : { kind: "loading" };
|
|
17
|
+
const e = `Updated ${i(o - t)}`;
|
|
18
|
+
return r >= 2 ? { kind: "stale", since: a(t), label: e } : { kind: "fresh", label: e };
|
|
19
|
+
}
|
|
20
|
+
function s(n, t) {
|
|
21
|
+
return Math.max(0, n - t);
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
u as STALE_AFTER_FAILURES,
|
|
25
|
+
a as clockTime,
|
|
26
|
+
s as countFailures,
|
|
27
|
+
i as formatAge,
|
|
28
|
+
f as freshness
|
|
29
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
function s(n, r) {
|
|
2
|
+
return n ?? r ?? null;
|
|
3
|
+
}
|
|
4
|
+
function u(n, r) {
|
|
5
|
+
const o = new Set(n), i = new Set((r == null ? void 0 : r.hidden) ?? []), c = /* @__PURE__ */ new Set(), a = [];
|
|
6
|
+
for (const e of (r == null ? void 0 : r.order) ?? [])
|
|
7
|
+
o.has(e) && !c.has(e) && (c.add(e), a.push(e));
|
|
8
|
+
return n.forEach((e, t) => {
|
|
9
|
+
if (c.has(e)) return;
|
|
10
|
+
c.add(e);
|
|
11
|
+
const f = n.slice(0, t).reverse().find((l) => a.includes(l));
|
|
12
|
+
a.splice(f ? a.indexOf(f) + 1 : 0, 0, e);
|
|
13
|
+
}), a.map((e) => ({ key: e, visible: !i.has(e) }));
|
|
14
|
+
}
|
|
15
|
+
function d(n, r, o) {
|
|
16
|
+
const i = new Set(o), c = ((r == null ? void 0 : r.order) ?? []).filter((e) => !i.has(e)), a = ((r == null ? void 0 : r.hidden) ?? []).filter((e) => !i.has(e));
|
|
17
|
+
return {
|
|
18
|
+
order: [
|
|
19
|
+
...n.map((e) => e.key),
|
|
20
|
+
...c.filter((e) => !n.some((t) => t.key === e))
|
|
21
|
+
],
|
|
22
|
+
hidden: [...n.filter((e) => !e.visible).map((e) => e.key), ...a]
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function m(n, r, o) {
|
|
26
|
+
const i = n.findIndex((t) => t.key === r), c = i + o;
|
|
27
|
+
if (i < 0 || c < 0 || c >= n.length) return n;
|
|
28
|
+
const a = [...n], [e] = a.splice(i, 1);
|
|
29
|
+
return a.splice(c, 0, e), a;
|
|
30
|
+
}
|
|
31
|
+
function h(n, r, o) {
|
|
32
|
+
const i = n.findIndex((t) => t.key === r), c = n.findIndex((t) => t.key === o);
|
|
33
|
+
if (i < 0 || c < 0 || i === c) return n;
|
|
34
|
+
const a = [...n], [e] = a.splice(i, 1);
|
|
35
|
+
return a.splice(c, 0, e), a;
|
|
36
|
+
}
|
|
37
|
+
function p(n, r, o) {
|
|
38
|
+
return n.map((i) => i.key === r ? { ...i, visible: o } : i);
|
|
39
|
+
}
|
|
40
|
+
function w(n) {
|
|
41
|
+
return n < 768 ? "phone" : n < 1280 ? "medium" : n < 1800 ? "wide" : "xwide";
|
|
42
|
+
}
|
|
43
|
+
function x(n, r) {
|
|
44
|
+
const o = n.filter((t) => t.area === "main"), i = n.filter((t) => t.area === "bottom"), c = n.filter((t) => t.area === "lead"), a = n.filter((t) => t.area === "rail"), e = n.filter((t) => t.area === "lead" || t.area === "rail");
|
|
45
|
+
return r === "xwide" ? { columns: "three", lead: c, main: o, under: i, rail: a } : r === "wide" ? { columns: "two", lead: [], main: o, under: i, rail: e } : { columns: "one", lead: c, main: o, under: i, rail: a };
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
x as arrangeBoard,
|
|
49
|
+
w as boardSizeFor,
|
|
50
|
+
s as effectiveLayout,
|
|
51
|
+
d as layoutToSave,
|
|
52
|
+
m as movePanel,
|
|
53
|
+
h as movePanelTo,
|
|
54
|
+
u as resolvePanels,
|
|
55
|
+
p as setPanelVisible
|
|
56
|
+
};
|