@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,353 @@
|
|
|
1
|
+
import { jsx as e, jsxs as d, Fragment as E } from "react/jsx-runtime";
|
|
2
|
+
import { useSensors as R, useSensor as _, PointerSensor as I, KeyboardSensor as V, DndContext as j, closestCenter as M } from "@dnd-kit/core";
|
|
3
|
+
import { sortableKeyboardCoordinates as O, SortableContext as U, verticalListSortingStrategy as K, useSortable as q } from "@dnd-kit/sortable";
|
|
4
|
+
import { CSS as B } from "@dnd-kit/utilities";
|
|
5
|
+
import { useQuery as z } from "@tanstack/react-query";
|
|
6
|
+
import { Trash2 as G, GripVertical as H, ArrowUp as Q, ArrowDown as W } from "lucide-react";
|
|
7
|
+
import { useMemo as f, useState as w, useId as J, useEffect as X } from "react";
|
|
8
|
+
import { useNivaroClient as Y } from "../../context.js";
|
|
9
|
+
import { get as Z } from "../../lib/commands.js";
|
|
10
|
+
import { SimpleSelect as D } from "../ui/SimpleSelect.js";
|
|
11
|
+
import { Sheet as ee, SheetContent as te, SheetHeader as ae, SheetTitle as re, SheetDescription as oe } from "../ui/sheet.js";
|
|
12
|
+
import { Switch as ne } from "../ui/switch.js";
|
|
13
|
+
import { useSaveCcPrefs as S, DEFAULT_PREFS as ce, useCcRoleDefaults as le, useSaveRoleDefault as ie } from "./board-prefs.js";
|
|
14
|
+
import { KioskLinks as se } from "./KioskLinks.js";
|
|
15
|
+
import { effectiveLayout as de, resolvePanels as L, setPanelVisible as me, movePanel as ue, layoutToSave as P, movePanelTo as he } from "./layout.js";
|
|
16
|
+
import { CC_PANELS as T } from "./panels/registry.js";
|
|
17
|
+
import { useCc as k } from "./state.js";
|
|
18
|
+
import { MUTED as x, BUTTON as g, FOCUS as v, ccVars as pe, FAINT as $ } from "./theme.js";
|
|
19
|
+
const y = "space-y-2 border-t border-[var(--cc-border)] pt-4 first:border-t-0 first:pt-0", N = "text-[13px] font-semibold text-[var(--cc-strong)]", be = "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)]";
|
|
20
|
+
function A(t) {
|
|
21
|
+
return f(() => T.filter((n) => !n.adminOnly || t), [t]);
|
|
22
|
+
}
|
|
23
|
+
function ve({
|
|
24
|
+
panel: t,
|
|
25
|
+
index: n,
|
|
26
|
+
count: c,
|
|
27
|
+
onMove: i,
|
|
28
|
+
onVisible: b
|
|
29
|
+
}) {
|
|
30
|
+
const { attributes: a, listeners: s, setNodeRef: l, transform: o, transition: u, isDragging: r } = q({
|
|
31
|
+
id: t.key
|
|
32
|
+
});
|
|
33
|
+
return /* @__PURE__ */ d(
|
|
34
|
+
"li",
|
|
35
|
+
{
|
|
36
|
+
ref: l,
|
|
37
|
+
style: { transform: B.Transform.toString(o), transition: u },
|
|
38
|
+
className: `flex items-center gap-2 px-2 py-2 ${r ? "relative z-10 bg-[var(--cc-raised)] shadow-sm" : ""}`,
|
|
39
|
+
children: [
|
|
40
|
+
/* @__PURE__ */ e(
|
|
41
|
+
"button",
|
|
42
|
+
{
|
|
43
|
+
type: "button",
|
|
44
|
+
...a,
|
|
45
|
+
...s,
|
|
46
|
+
"aria-label": `Drag ${t.label} to reorder`,
|
|
47
|
+
"data-tip": "Drag to reorder",
|
|
48
|
+
className: `cursor-grab rounded p-1 text-[var(--cc-faint)] hover:bg-[var(--cc-chip)] active:cursor-grabbing ${v}`,
|
|
49
|
+
children: /* @__PURE__ */ e(H, { className: "h-3.5 w-3.5", "aria-hidden": !0 })
|
|
50
|
+
}
|
|
51
|
+
),
|
|
52
|
+
/* @__PURE__ */ d("div", { className: "min-w-0 flex-1", children: [
|
|
53
|
+
/* @__PURE__ */ e(
|
|
54
|
+
"p",
|
|
55
|
+
{
|
|
56
|
+
className: `truncate text-[12.5px] font-medium ${t.visible ? "text-[var(--cc-text)]" : "text-[var(--cc-faint)]"}`,
|
|
57
|
+
children: t.label
|
|
58
|
+
}
|
|
59
|
+
),
|
|
60
|
+
t.hint && /* @__PURE__ */ e("p", { className: `truncate text-[11.5px] ${$}`, children: t.hint })
|
|
61
|
+
] }),
|
|
62
|
+
/* @__PURE__ */ e(
|
|
63
|
+
"button",
|
|
64
|
+
{
|
|
65
|
+
type: "button",
|
|
66
|
+
disabled: n === 0,
|
|
67
|
+
onClick: () => i(-1),
|
|
68
|
+
"aria-label": `Move ${t.label} up`,
|
|
69
|
+
className: `rounded p-1 text-[var(--cc-muted)] hover:bg-[var(--cc-chip)] disabled:opacity-30 ${v}`,
|
|
70
|
+
children: /* @__PURE__ */ e(Q, { className: "h-3.5 w-3.5", "aria-hidden": !0 })
|
|
71
|
+
}
|
|
72
|
+
),
|
|
73
|
+
/* @__PURE__ */ e(
|
|
74
|
+
"button",
|
|
75
|
+
{
|
|
76
|
+
type: "button",
|
|
77
|
+
disabled: n === c - 1,
|
|
78
|
+
onClick: () => i(1),
|
|
79
|
+
"aria-label": `Move ${t.label} down`,
|
|
80
|
+
className: `rounded p-1 text-[var(--cc-muted)] hover:bg-[var(--cc-chip)] disabled:opacity-30 ${v}`,
|
|
81
|
+
children: /* @__PURE__ */ e(W, { className: "h-3.5 w-3.5", "aria-hidden": !0 })
|
|
82
|
+
}
|
|
83
|
+
),
|
|
84
|
+
/* @__PURE__ */ e(
|
|
85
|
+
ne,
|
|
86
|
+
{
|
|
87
|
+
checked: t.visible,
|
|
88
|
+
onCheckedChange: b,
|
|
89
|
+
"aria-label": `Show ${t.label}`,
|
|
90
|
+
className: "data-[state=checked]:bg-nvr-cyan data-[state=unchecked]:bg-[var(--cc-chip-hover)]"
|
|
91
|
+
}
|
|
92
|
+
)
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
function F({
|
|
98
|
+
panels: t,
|
|
99
|
+
onChange: n
|
|
100
|
+
}) {
|
|
101
|
+
const c = R(
|
|
102
|
+
_(I, { activationConstraint: { distance: 4 } }),
|
|
103
|
+
_(V, { coordinateGetter: O })
|
|
104
|
+
), i = f(() => new Map(T.map((a) => [a.key, a])), []);
|
|
105
|
+
return /* @__PURE__ */ e(j, { sensors: c, collisionDetection: M, onDragEnd: (a) => {
|
|
106
|
+
a.over && a.active.id !== a.over.id && n(he(t, String(a.active.id), String(a.over.id)));
|
|
107
|
+
}, children: /* @__PURE__ */ e(U, { items: t.map((a) => a.key), strategy: K, children: /* @__PURE__ */ e("ol", { className: "divide-y divide-[var(--cc-border)] rounded-md border border-[var(--cc-border)]", children: t.map((a, s) => {
|
|
108
|
+
var l, o;
|
|
109
|
+
return /* @__PURE__ */ e(
|
|
110
|
+
ve,
|
|
111
|
+
{
|
|
112
|
+
panel: { ...a, label: ((l = i.get(a.key)) == null ? void 0 : l.label) ?? a.key, hint: (o = i.get(a.key)) == null ? void 0 : o.hint },
|
|
113
|
+
index: s,
|
|
114
|
+
count: t.length,
|
|
115
|
+
onMove: (u) => n(ue(t, a.key, u)),
|
|
116
|
+
onVisible: (u) => n(me(t, a.key, u))
|
|
117
|
+
},
|
|
118
|
+
a.key
|
|
119
|
+
);
|
|
120
|
+
}) }) }) });
|
|
121
|
+
}
|
|
122
|
+
function fe() {
|
|
123
|
+
var u;
|
|
124
|
+
const t = k(), n = S(), c = ((u = t.prefs) == null ? void 0 : u.saved_views) ?? [], [i, b] = w(""), a = J(), s = (r) => {
|
|
125
|
+
var m, p;
|
|
126
|
+
return r ? ((p = (m = t.config) == null ? void 0 : m.regions.find((h) => h.id === r)) == null ? void 0 : p.label) ?? "A region" : "Everywhere";
|
|
127
|
+
}, l = (r) => {
|
|
128
|
+
var m, p;
|
|
129
|
+
return r ? ((p = (m = t.config) == null ? void 0 : m.geo_collections.find((h) => h.key === r)) == null ? void 0 : p.label) || r.replace(/_/g, " ") : null;
|
|
130
|
+
}, o = () => {
|
|
131
|
+
const r = i.trim();
|
|
132
|
+
if (!r) return;
|
|
133
|
+
const m = {
|
|
134
|
+
id: `v${Date.now().toString(36)}`,
|
|
135
|
+
name: r.slice(0, 60),
|
|
136
|
+
region: t.region,
|
|
137
|
+
map_collection: t.mapCollection,
|
|
138
|
+
filters: t.filters
|
|
139
|
+
};
|
|
140
|
+
n.mutate({ saved_views: [...c.filter((p) => p.name !== m.name), m].slice(-20) }), b("");
|
|
141
|
+
};
|
|
142
|
+
return /* @__PURE__ */ d("section", { className: y, "aria-labelledby": `${a}-h`, children: [
|
|
143
|
+
/* @__PURE__ */ e("h3", { id: `${a}-h`, className: N, children: "Saved views" }),
|
|
144
|
+
/* @__PURE__ */ e("p", { className: `text-[12px] ${x}`, children: "A view keeps the region, the map and its filters, so you can come back to them in one click." }),
|
|
145
|
+
c.length > 0 && /* @__PURE__ */ e("ul", { className: "divide-y divide-[var(--cc-border)] rounded-md border border-[var(--cc-border)]", children: c.map((r) => /* @__PURE__ */ d("li", { className: "flex items-center gap-2 px-2.5 py-2", children: [
|
|
146
|
+
/* @__PURE__ */ d("div", { className: "min-w-0 flex-1", children: [
|
|
147
|
+
/* @__PURE__ */ e("p", { className: "truncate text-[12.5px] font-medium text-[var(--cc-text)]", children: r.name }),
|
|
148
|
+
/* @__PURE__ */ e("p", { className: `truncate text-[11.5px] ${$}`, children: [s(r.region), l(r.map_collection)].filter(Boolean).join(" · ") })
|
|
149
|
+
] }),
|
|
150
|
+
/* @__PURE__ */ e(
|
|
151
|
+
"button",
|
|
152
|
+
{
|
|
153
|
+
type: "button",
|
|
154
|
+
className: `${g} ${v}`,
|
|
155
|
+
onClick: () => xe(t, r),
|
|
156
|
+
children: "Open"
|
|
157
|
+
}
|
|
158
|
+
),
|
|
159
|
+
/* @__PURE__ */ e(
|
|
160
|
+
"button",
|
|
161
|
+
{
|
|
162
|
+
type: "button",
|
|
163
|
+
"aria-label": `Delete the view ${r.name}`,
|
|
164
|
+
"data-tip": "Delete",
|
|
165
|
+
className: `rounded p-1.5 text-[var(--cc-muted)] hover:bg-[var(--cc-chip)] hover:text-[var(--cc-bad-text)] ${v}`,
|
|
166
|
+
onClick: () => n.mutate({ saved_views: c.filter((m) => m.id !== r.id) }),
|
|
167
|
+
children: /* @__PURE__ */ e(G, { className: "h-3.5 w-3.5", "aria-hidden": !0 })
|
|
168
|
+
}
|
|
169
|
+
)
|
|
170
|
+
] }, r.id)) }),
|
|
171
|
+
/* @__PURE__ */ d(
|
|
172
|
+
"form",
|
|
173
|
+
{
|
|
174
|
+
className: "flex items-center gap-2",
|
|
175
|
+
onSubmit: (r) => {
|
|
176
|
+
r.preventDefault(), o();
|
|
177
|
+
},
|
|
178
|
+
children: [
|
|
179
|
+
/* @__PURE__ */ e("label", { htmlFor: a, className: "sr-only", children: "Name for the current view" }),
|
|
180
|
+
/* @__PURE__ */ e(
|
|
181
|
+
"input",
|
|
182
|
+
{
|
|
183
|
+
id: a,
|
|
184
|
+
value: i,
|
|
185
|
+
onChange: (r) => b(r.target.value),
|
|
186
|
+
placeholder: `Name this view (${s(t.region)})`,
|
|
187
|
+
maxLength: 60,
|
|
188
|
+
className: `${be} ${v}`
|
|
189
|
+
}
|
|
190
|
+
),
|
|
191
|
+
/* @__PURE__ */ e("button", { type: "submit", disabled: !i.trim(), className: `${g} shrink-0 ${v}`, children: "Save view" })
|
|
192
|
+
]
|
|
193
|
+
}
|
|
194
|
+
)
|
|
195
|
+
] });
|
|
196
|
+
}
|
|
197
|
+
function xe(t, n) {
|
|
198
|
+
t.setRegion(n.region), n.map_collection && t.setMapCollection(n.map_collection), t.setFilters(n.filters);
|
|
199
|
+
}
|
|
200
|
+
function ge() {
|
|
201
|
+
var a, s, l;
|
|
202
|
+
const t = k(), n = S(), c = ((a = t.prefs) == null ? void 0 : a.theme) ?? "app", i = String(((s = t.prefs) == null ? void 0 : s.tv_cycle_seconds) ?? ce.tv_cycle_seconds);
|
|
203
|
+
return /* @__PURE__ */ d("section", { className: y, "aria-labelledby": "cc-appearance-h", children: [
|
|
204
|
+
/* @__PURE__ */ e("h3", { id: "cc-appearance-h", className: N, children: "Appearance" }),
|
|
205
|
+
/* @__PURE__ */ e("div", { role: "radiogroup", "aria-labelledby": "cc-appearance-h", className: "grid grid-cols-2 gap-2", children: [
|
|
206
|
+
{ value: "app", label: "Follow the app", hint: "Light or dark, like the rest of Nivaro" },
|
|
207
|
+
{ value: "dark", label: "Always dark", hint: "For wall screens and dim rooms" }
|
|
208
|
+
].map((o) => (
|
|
209
|
+
// biome-ignore lint/a11y/useSemanticElements: a two-card radio group, not a form input
|
|
210
|
+
/* @__PURE__ */ d(
|
|
211
|
+
"button",
|
|
212
|
+
{
|
|
213
|
+
type: "button",
|
|
214
|
+
role: "radio",
|
|
215
|
+
"aria-checked": c === o.value,
|
|
216
|
+
onClick: () => n.mutate({ theme: o.value }),
|
|
217
|
+
className: `rounded-md border px-2.5 py-2 text-left ${v} ${c === o.value ? "border-nvr-cyan bg-[var(--cc-chip)]" : "border-[var(--cc-border)] hover:bg-[var(--cc-chip)]"}`,
|
|
218
|
+
children: [
|
|
219
|
+
/* @__PURE__ */ e("span", { className: "block text-[12.5px] font-medium text-[var(--cc-text)]", children: o.label }),
|
|
220
|
+
/* @__PURE__ */ e("span", { className: `block text-[11.5px] ${$}`, children: o.hint })
|
|
221
|
+
]
|
|
222
|
+
},
|
|
223
|
+
o.value
|
|
224
|
+
)
|
|
225
|
+
)) }),
|
|
226
|
+
(((l = t.config) == null ? void 0 : l.regions.length) ?? 0) > 1 && /* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-3 pt-1", children: [
|
|
227
|
+
/* @__PURE__ */ e("span", { className: "text-[12.5px] text-[var(--cc-text)]", children: "In TV mode, move to the next region every" }),
|
|
228
|
+
/* @__PURE__ */ e(
|
|
229
|
+
D,
|
|
230
|
+
{
|
|
231
|
+
ariaLabel: "Seconds between regions in TV mode",
|
|
232
|
+
value: i,
|
|
233
|
+
onChange: (o) => n.mutate({ tv_cycle_seconds: Number(o) }),
|
|
234
|
+
className: "h-8 w-[120px] text-[12.5px]",
|
|
235
|
+
options: [15, 30, 60, 120, 300].map((o) => ({
|
|
236
|
+
value: String(o),
|
|
237
|
+
label: o < 60 ? `${o} seconds` : `${o / 60} minute${o > 60 ? "s" : ""}`
|
|
238
|
+
}))
|
|
239
|
+
}
|
|
240
|
+
)
|
|
241
|
+
] })
|
|
242
|
+
] });
|
|
243
|
+
}
|
|
244
|
+
function ye() {
|
|
245
|
+
var p;
|
|
246
|
+
const t = Y(), c = A(!0), i = f(() => c.map((h) => h.key), [c]), b = z({
|
|
247
|
+
queryKey: ["command-center", "roles-list"],
|
|
248
|
+
queryFn: () => t.request(Z("/roles")).then((h) => h.data),
|
|
249
|
+
staleTime: 6e4
|
|
250
|
+
}), a = le(!0), s = ie(), [l, o] = w(""), u = l ? ((p = a.data) == null ? void 0 : p[l.toLowerCase()]) ?? null : null, [r, m] = w(null);
|
|
251
|
+
return X(() => {
|
|
252
|
+
m(l ? L(i, u) : null);
|
|
253
|
+
}, [l, u, i]), /* @__PURE__ */ d("section", { className: y, "aria-labelledby": "cc-roles-h", children: [
|
|
254
|
+
/* @__PURE__ */ e("h3", { id: "cc-roles-h", className: N, children: "Starting layout for a role" }),
|
|
255
|
+
/* @__PURE__ */ e("p", { className: `text-[12px] ${x}`, children: "What a role’s people see until they customise their own board." }),
|
|
256
|
+
/* @__PURE__ */ e(
|
|
257
|
+
D,
|
|
258
|
+
{
|
|
259
|
+
ariaLabel: "Role",
|
|
260
|
+
value: l,
|
|
261
|
+
onChange: o,
|
|
262
|
+
className: "h-8 text-[12.5px]",
|
|
263
|
+
options: [
|
|
264
|
+
{ value: "", label: b.isLoading ? "Loading roles…" : "Choose a role" },
|
|
265
|
+
...(b.data ?? []).map((h) => {
|
|
266
|
+
var C;
|
|
267
|
+
return {
|
|
268
|
+
value: String(h.id),
|
|
269
|
+
label: `${h.name}${(C = a.data) != null && C[String(h.id).toLowerCase()] ? " (set)" : ""}`
|
|
270
|
+
};
|
|
271
|
+
})
|
|
272
|
+
]
|
|
273
|
+
}
|
|
274
|
+
),
|
|
275
|
+
r && /* @__PURE__ */ d(E, { children: [
|
|
276
|
+
/* @__PURE__ */ e(F, { panels: r, onChange: m }),
|
|
277
|
+
/* @__PURE__ */ d("div", { className: "flex flex-wrap justify-end gap-2", children: [
|
|
278
|
+
/* @__PURE__ */ e(
|
|
279
|
+
"button",
|
|
280
|
+
{
|
|
281
|
+
type: "button",
|
|
282
|
+
className: `${g} ${v}`,
|
|
283
|
+
disabled: !u || s.isPending,
|
|
284
|
+
onClick: () => s.mutate({ role_id: l, layout: null }),
|
|
285
|
+
children: "Back to the built-in layout"
|
|
286
|
+
}
|
|
287
|
+
),
|
|
288
|
+
/* @__PURE__ */ e(
|
|
289
|
+
"button",
|
|
290
|
+
{
|
|
291
|
+
type: "button",
|
|
292
|
+
className: `rounded-md bg-nvr-cyan px-2.5 py-1 text-[11.5px] font-medium text-white disabled:opacity-50 ${v}`,
|
|
293
|
+
disabled: s.isPending,
|
|
294
|
+
onClick: () => s.mutate({ role_id: l, layout: P(r, u, i) }),
|
|
295
|
+
children: "Save for this role"
|
|
296
|
+
}
|
|
297
|
+
)
|
|
298
|
+
] }),
|
|
299
|
+
s.isError && /* @__PURE__ */ e("p", { role: "alert", className: "text-[12px] text-[var(--cc-bad-text)]", children: "Couldn’t save the role’s layout. Try again." })
|
|
300
|
+
] })
|
|
301
|
+
] });
|
|
302
|
+
}
|
|
303
|
+
function Me({
|
|
304
|
+
open: t,
|
|
305
|
+
onOpenChange: n
|
|
306
|
+
}) {
|
|
307
|
+
var r, m, p;
|
|
308
|
+
const c = k(), i = S(), b = A(c.isAdmin), a = f(() => b.map((h) => h.key), [b]), s = ((r = c.prefs) == null ? void 0 : r.layout) ?? null, l = de(s, (m = c.prefs) == null ? void 0 : m.role_default), o = f(() => L(a, l), [a, l]), u = (h) => i.mutate({ layout: P(h, s ?? l, a) });
|
|
309
|
+
return /* @__PURE__ */ e(ee, { open: t, onOpenChange: n, children: /* @__PURE__ */ d(
|
|
310
|
+
te,
|
|
311
|
+
{
|
|
312
|
+
side: "right",
|
|
313
|
+
style: pe(c.mode),
|
|
314
|
+
className: "flex w-full flex-col gap-0 border-[var(--cc-border)] bg-[var(--cc-panel)] p-0 text-[var(--cc-text)] sm:max-w-md",
|
|
315
|
+
children: [
|
|
316
|
+
/* @__PURE__ */ d(ae, { className: "border-b border-[var(--cc-border)] px-4 py-3 text-left", children: [
|
|
317
|
+
/* @__PURE__ */ e(re, { className: "text-[15px] text-[var(--cc-strong)]", children: "Customise the board" }),
|
|
318
|
+
/* @__PURE__ */ e(oe, { className: `text-[12px] ${x}`, children: "Changes save as you make them and only change your own board." })
|
|
319
|
+
] }),
|
|
320
|
+
/* @__PURE__ */ d("div", { className: "flex-1 space-y-4 overflow-y-auto px-4 py-4", children: [
|
|
321
|
+
/* @__PURE__ */ d("section", { className: y, "aria-labelledby": "cc-panels-h", children: [
|
|
322
|
+
/* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-2", children: [
|
|
323
|
+
/* @__PURE__ */ e("h3", { id: "cc-panels-h", className: N, children: "Panels" }),
|
|
324
|
+
/* @__PURE__ */ e(
|
|
325
|
+
"button",
|
|
326
|
+
{
|
|
327
|
+
type: "button",
|
|
328
|
+
className: `${g} ${v}`,
|
|
329
|
+
disabled: !s || i.isPending,
|
|
330
|
+
onClick: () => i.mutate({ layout: null }),
|
|
331
|
+
children: (p = c.prefs) != null && p.role_default ? "Reset to my role’s layout" : "Reset"
|
|
332
|
+
}
|
|
333
|
+
)
|
|
334
|
+
] }),
|
|
335
|
+
/* @__PURE__ */ e("p", { className: `text-[12px] ${x}`, children: "Drag or use the arrows to change the order; switch a panel off to hide it." }),
|
|
336
|
+
/* @__PURE__ */ e(F, { panels: o, onChange: u })
|
|
337
|
+
] }),
|
|
338
|
+
/* @__PURE__ */ e(fe, {}),
|
|
339
|
+
/* @__PURE__ */ e(ge, {}),
|
|
340
|
+
c.isAdmin && /* @__PURE__ */ e(ye, {}),
|
|
341
|
+
c.isAdmin && /* @__PURE__ */ e(se, {}),
|
|
342
|
+
i.isError && /* @__PURE__ */ e("p", { role: "alert", className: "text-[12px] text-[var(--cc-bad-text)]", children: "Couldn’t save that change. Check your connection and try again." })
|
|
343
|
+
] })
|
|
344
|
+
]
|
|
345
|
+
}
|
|
346
|
+
) });
|
|
347
|
+
}
|
|
348
|
+
export {
|
|
349
|
+
Me as CustomizeSheet,
|
|
350
|
+
F as PanelOrderEditor,
|
|
351
|
+
xe as applySavedView,
|
|
352
|
+
A as usePanelsFor
|
|
353
|
+
};
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import { jsxs as r, jsx as e, Fragment as x } from "react/jsx-runtime";
|
|
2
|
+
import { Tv as g, Minimize2 as w, Maximize2 as N, SlidersHorizontal as y, RefreshCw as C, AlertOctagon as k, Clock as T, Bookmark as _, Check as S, Link2 as $, Keyboard as L } from "lucide-react";
|
|
3
|
+
import { useState as F } from "react";
|
|
4
|
+
import { DropdownMenu as M, DropdownMenuTrigger as V, DropdownMenuContent as A, DropdownMenuItem as b } from "../ui/dropdown-menu.js";
|
|
5
|
+
import { Popover as B, PopoverTrigger as O, PopoverContent as R } from "../ui/popover.js";
|
|
6
|
+
import { applySavedView as z } from "./Customize.js";
|
|
7
|
+
import { freshness as D } from "./freshness.js";
|
|
8
|
+
import { RegionPicker as K } from "./panels/RegionPicker.js";
|
|
9
|
+
import { SystemPill as P } from "./panels/SystemPanel.js";
|
|
10
|
+
import { TimeBar as I, BriefButton as U } from "./panels/TimeBar.js";
|
|
11
|
+
import { useNow as H } from "./shell-hooks.js";
|
|
12
|
+
import { SHORTCUTS as j } from "./shortcuts.js";
|
|
13
|
+
import { useCc as m } from "./state.js";
|
|
14
|
+
import { FAINT as h, SKELETON as p, FOCUS as u, ICON_BUTTON as o, ccVars as v } from "./theme.js";
|
|
15
|
+
import { currentViewUrl as E } from "./url-state.js";
|
|
16
|
+
function me({
|
|
17
|
+
helpOpen: t,
|
|
18
|
+
onHelpOpenChange: s,
|
|
19
|
+
kioskLabel: n
|
|
20
|
+
}) {
|
|
21
|
+
const a = m(), i = a.snapshot, l = i == null ? void 0 : i.throughput, c = l ? l.transitions_today - l.transitions_yesterday_same_time : 0, d = !!a.kiosk;
|
|
22
|
+
return /* @__PURE__ */ r("header", { className: "flex shrink-0 flex-wrap items-center gap-x-4 gap-y-2", children: [
|
|
23
|
+
/* @__PURE__ */ r("h1", { className: "text-[16px] font-semibold tracking-[-0.01em] text-[var(--cc-strong)]", children: [
|
|
24
|
+
"Command Center",
|
|
25
|
+
n && /* @__PURE__ */ e("span", { className: "ml-2 text-[13px] font-normal text-[var(--cc-muted)]", children: n })
|
|
26
|
+
] }),
|
|
27
|
+
/* @__PURE__ */ e(K, {}),
|
|
28
|
+
/* @__PURE__ */ r("div", { className: "flex flex-wrap items-center gap-x-4 gap-y-1 text-[12.5px] text-[var(--cc-text)]", children: [
|
|
29
|
+
i ? /* @__PURE__ */ r("span", { className: "flex items-center gap-1.5", children: [
|
|
30
|
+
/* @__PURE__ */ e("span", { className: "h-2 w-2 rounded-full bg-[var(--cc-people)]", "aria-hidden": !0 }),
|
|
31
|
+
/* @__PURE__ */ e("b", { className: "font-semibold tabular-nums", children: i.people.online_count }),
|
|
32
|
+
" online",
|
|
33
|
+
i.people.idle_count > 0 && /* @__PURE__ */ r("span", { className: h, children: [
|
|
34
|
+
"· ",
|
|
35
|
+
i.people.idle_count,
|
|
36
|
+
" idle"
|
|
37
|
+
] })
|
|
38
|
+
] }) : a.snapshotLoading ? /* @__PURE__ */ e("span", { className: `${p} h-4 w-20`, "aria-hidden": !0 }) : null,
|
|
39
|
+
l ? /* @__PURE__ */ r("span", { children: [
|
|
40
|
+
/* @__PURE__ */ e("b", { className: "font-semibold tabular-nums", children: l.transitions_today }),
|
|
41
|
+
" moves today",
|
|
42
|
+
" ",
|
|
43
|
+
/* @__PURE__ */ e(
|
|
44
|
+
"span",
|
|
45
|
+
{
|
|
46
|
+
className: c === 0 ? "text-[var(--cc-muted)]" : c > 0 ? "text-[var(--cc-good-text)]" : "text-[var(--cc-warn-text)]",
|
|
47
|
+
children: c === 0 ? "(same as yesterday by now)" : `(${c > 0 ? "+" : "−"}${Math.abs(c)} vs yesterday by now)`
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
] }) : a.snapshotLoading ? /* @__PURE__ */ e("span", { className: `${p} h-4 w-40`, "aria-hidden": !0 }) : null,
|
|
51
|
+
i && /* @__PURE__ */ e(q, { risk: i.risk }),
|
|
52
|
+
i && (i.risk.open_issues ?? 0) > 0 && /* @__PURE__ */ r(
|
|
53
|
+
"button",
|
|
54
|
+
{
|
|
55
|
+
type: "button",
|
|
56
|
+
disabled: d,
|
|
57
|
+
onClick: () => a.navigate("/issues"),
|
|
58
|
+
className: `rounded-full bg-[var(--cc-bad-bg)] px-2.5 py-0.5 text-[12px] font-medium text-[var(--cc-bad-text)] enabled:hover:brightness-95 disabled:cursor-default ${u}`,
|
|
59
|
+
children: [
|
|
60
|
+
i.risk.open_issues,
|
|
61
|
+
" open ",
|
|
62
|
+
i.risk.open_issues === 1 ? "issue" : "issues"
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
),
|
|
66
|
+
/* @__PURE__ */ e(P, {})
|
|
67
|
+
] }),
|
|
68
|
+
/* @__PURE__ */ r("div", { className: "ml-auto flex flex-wrap items-center gap-x-3 gap-y-2", children: [
|
|
69
|
+
/* @__PURE__ */ e(I, {}),
|
|
70
|
+
/* @__PURE__ */ e(U, {}),
|
|
71
|
+
/* @__PURE__ */ e(G, {}),
|
|
72
|
+
/* @__PURE__ */ r("div", { className: "flex items-center gap-0.5", role: "toolbar", "aria-label": "Board controls", children: [
|
|
73
|
+
!d && /* @__PURE__ */ e(Q, {}),
|
|
74
|
+
!d && /* @__PURE__ */ e(J, {}),
|
|
75
|
+
/* @__PURE__ */ e(
|
|
76
|
+
"button",
|
|
77
|
+
{
|
|
78
|
+
type: "button",
|
|
79
|
+
className: o,
|
|
80
|
+
"aria-pressed": a.tv,
|
|
81
|
+
"aria-label": a.tv ? "Leave TV mode" : "TV mode",
|
|
82
|
+
"data-tip": a.tv ? "Leave TV mode (T)" : "TV mode — larger type, cycles regions (T)",
|
|
83
|
+
onClick: () => a.setTv(!a.tv),
|
|
84
|
+
children: /* @__PURE__ */ e(g, { className: "h-4 w-4", "aria-hidden": !0 })
|
|
85
|
+
}
|
|
86
|
+
),
|
|
87
|
+
/* @__PURE__ */ e(
|
|
88
|
+
"button",
|
|
89
|
+
{
|
|
90
|
+
type: "button",
|
|
91
|
+
className: o,
|
|
92
|
+
"aria-pressed": a.fullscreen,
|
|
93
|
+
"aria-label": a.fullscreen ? "Leave full screen" : "Full screen",
|
|
94
|
+
"data-tip": a.fullscreen ? "Leave full screen (F)" : "Full screen (F)",
|
|
95
|
+
onClick: a.toggleFullscreen,
|
|
96
|
+
children: a.fullscreen ? /* @__PURE__ */ e(w, { className: "h-4 w-4", "aria-hidden": !0 }) : /* @__PURE__ */ e(N, { className: "h-4 w-4", "aria-hidden": !0 })
|
|
97
|
+
}
|
|
98
|
+
),
|
|
99
|
+
!d && /* @__PURE__ */ e(
|
|
100
|
+
"button",
|
|
101
|
+
{
|
|
102
|
+
type: "button",
|
|
103
|
+
className: o,
|
|
104
|
+
"aria-label": "Customise the board",
|
|
105
|
+
"data-tip": "Customise",
|
|
106
|
+
onClick: a.openCustomize,
|
|
107
|
+
children: /* @__PURE__ */ e(y, { className: "h-4 w-4", "aria-hidden": !0 })
|
|
108
|
+
}
|
|
109
|
+
),
|
|
110
|
+
/* @__PURE__ */ e(W, { open: t, onOpenChange: s }),
|
|
111
|
+
/* @__PURE__ */ e(
|
|
112
|
+
"button",
|
|
113
|
+
{
|
|
114
|
+
type: "button",
|
|
115
|
+
className: o,
|
|
116
|
+
"aria-label": "Refresh now",
|
|
117
|
+
"data-tip": "Refresh now (R)",
|
|
118
|
+
onClick: a.refresh,
|
|
119
|
+
children: /* @__PURE__ */ e(C, { className: "h-4 w-4", "aria-hidden": !0 })
|
|
120
|
+
}
|
|
121
|
+
)
|
|
122
|
+
] })
|
|
123
|
+
] })
|
|
124
|
+
] });
|
|
125
|
+
}
|
|
126
|
+
function f() {
|
|
127
|
+
var n;
|
|
128
|
+
const t = document.querySelector(
|
|
129
|
+
"[data-cc-panel='attention'], [data-cc-slot='attention']"
|
|
130
|
+
);
|
|
131
|
+
if (!t) return;
|
|
132
|
+
const s = (n = window.matchMedia) == null ? void 0 : n.call(window, "(prefers-reduced-motion: reduce)").matches;
|
|
133
|
+
t.scrollIntoView({ block: "start", behavior: s ? "auto" : "smooth" }), t.hasAttribute("tabindex") || t.setAttribute("tabindex", "-1"), t.focus({ preventScroll: !0 });
|
|
134
|
+
}
|
|
135
|
+
function q({ risk: t }) {
|
|
136
|
+
const s = "inline-flex items-center gap-1 rounded-full px-2.5 py-0.5 text-[12px] font-medium enabled:hover:brightness-95";
|
|
137
|
+
return /* @__PURE__ */ r(x, { children: [
|
|
138
|
+
t.sla_breached !== void 0 && t.sla_breached > 0 && /* @__PURE__ */ r(
|
|
139
|
+
"button",
|
|
140
|
+
{
|
|
141
|
+
type: "button",
|
|
142
|
+
onClick: f,
|
|
143
|
+
className: `${s} bg-[var(--cc-bad-bg)] text-[var(--cc-bad-text)] ${u}`,
|
|
144
|
+
children: [
|
|
145
|
+
/* @__PURE__ */ e(k, { className: "h-3.5 w-3.5", "aria-hidden": !0 }),
|
|
146
|
+
/* @__PURE__ */ e("span", { className: "tabular-nums", children: t.sla_breached }),
|
|
147
|
+
" past deadline"
|
|
148
|
+
]
|
|
149
|
+
}
|
|
150
|
+
),
|
|
151
|
+
t.sla_warning !== void 0 && t.sla_warning > 0 && /* @__PURE__ */ r(
|
|
152
|
+
"button",
|
|
153
|
+
{
|
|
154
|
+
type: "button",
|
|
155
|
+
onClick: f,
|
|
156
|
+
className: `${s} bg-[var(--cc-warn-bg)] text-[var(--cc-warn-text)] ${u}`,
|
|
157
|
+
children: [
|
|
158
|
+
/* @__PURE__ */ e(T, { className: "h-3.5 w-3.5", "aria-hidden": !0 }),
|
|
159
|
+
/* @__PURE__ */ e("span", { className: "tabular-nums", children: t.sla_warning }),
|
|
160
|
+
" near deadline"
|
|
161
|
+
]
|
|
162
|
+
}
|
|
163
|
+
)
|
|
164
|
+
] });
|
|
165
|
+
}
|
|
166
|
+
function G() {
|
|
167
|
+
const t = m(), s = H(1e3, !!t.updatedAt), n = D({ updatedAt: t.updatedAt, failures: t.snapshotFailures, now: s });
|
|
168
|
+
return n.kind === "loading" ? /* @__PURE__ */ e("span", { className: `${p} h-4 w-24`, "aria-hidden": !0 }) : n.kind === "fresh" ? /* @__PURE__ */ e("span", { className: `text-[12px] tabular-nums ${h}`, children: n.label }) : /* @__PURE__ */ r(
|
|
169
|
+
"span",
|
|
170
|
+
{
|
|
171
|
+
role: "status",
|
|
172
|
+
className: "inline-flex items-center gap-1.5 rounded-full bg-[var(--cc-warn-bg)] px-2.5 py-0.5 text-[12px] text-[var(--cc-warn-text)]",
|
|
173
|
+
children: [
|
|
174
|
+
n.kind === "stale" ? `Couldn’t refresh — showing data from ${n.since}` : "Couldn’t load the board",
|
|
175
|
+
/* @__PURE__ */ e("span", { "aria-hidden": !0, children: "·" }),
|
|
176
|
+
/* @__PURE__ */ e(
|
|
177
|
+
"button",
|
|
178
|
+
{
|
|
179
|
+
type: "button",
|
|
180
|
+
onClick: t.refresh,
|
|
181
|
+
className: `font-medium underline underline-offset-2 hover:no-underline ${u}`,
|
|
182
|
+
children: "Try again"
|
|
183
|
+
}
|
|
184
|
+
)
|
|
185
|
+
]
|
|
186
|
+
}
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
function J() {
|
|
190
|
+
const [t, s] = F(!1);
|
|
191
|
+
return /* @__PURE__ */ r(x, { children: [
|
|
192
|
+
/* @__PURE__ */ e(
|
|
193
|
+
"button",
|
|
194
|
+
{
|
|
195
|
+
type: "button",
|
|
196
|
+
className: o,
|
|
197
|
+
"aria-label": t ? "Link copied" : "Copy a link to this view",
|
|
198
|
+
"data-tip": t ? "Copied" : "Copy a link to this view",
|
|
199
|
+
onClick: () => {
|
|
200
|
+
var a;
|
|
201
|
+
const n = E();
|
|
202
|
+
(a = navigator.clipboard) == null || a.writeText(n).then(
|
|
203
|
+
() => {
|
|
204
|
+
s(!0), setTimeout(() => s(!1), 2e3);
|
|
205
|
+
},
|
|
206
|
+
() => s(!1)
|
|
207
|
+
);
|
|
208
|
+
},
|
|
209
|
+
children: t ? /* @__PURE__ */ e(S, { className: "h-4 w-4", "aria-hidden": !0 }) : /* @__PURE__ */ e($, { className: "h-4 w-4", "aria-hidden": !0 })
|
|
210
|
+
}
|
|
211
|
+
),
|
|
212
|
+
/* @__PURE__ */ e("span", { className: "sr-only", "aria-live": "polite", children: t ? "Link to this view copied" : "" })
|
|
213
|
+
] });
|
|
214
|
+
}
|
|
215
|
+
function Q() {
|
|
216
|
+
var n;
|
|
217
|
+
const t = m(), s = ((n = t.prefs) == null ? void 0 : n.saved_views) ?? [];
|
|
218
|
+
return s.length === 0 ? null : /* @__PURE__ */ r(M, { children: [
|
|
219
|
+
/* @__PURE__ */ e(V, { asChild: !0, children: /* @__PURE__ */ e(
|
|
220
|
+
"button",
|
|
221
|
+
{
|
|
222
|
+
type: "button",
|
|
223
|
+
className: o,
|
|
224
|
+
"aria-label": "Saved views",
|
|
225
|
+
"data-tip": "Saved views",
|
|
226
|
+
children: /* @__PURE__ */ e(_, { className: "h-4 w-4", "aria-hidden": !0 })
|
|
227
|
+
}
|
|
228
|
+
) }),
|
|
229
|
+
/* @__PURE__ */ r(
|
|
230
|
+
A,
|
|
231
|
+
{
|
|
232
|
+
align: "end",
|
|
233
|
+
style: v(t.mode),
|
|
234
|
+
className: "min-w-[200px] border-[var(--cc-border)] bg-[var(--cc-panel)] text-[var(--cc-text)]",
|
|
235
|
+
children: [
|
|
236
|
+
s.map((a) => /* @__PURE__ */ e(
|
|
237
|
+
b,
|
|
238
|
+
{
|
|
239
|
+
className: "text-[12.5px] focus:bg-[var(--cc-chip-hover)] focus:text-[var(--cc-strong)]",
|
|
240
|
+
onSelect: () => z(t, a),
|
|
241
|
+
children: a.name
|
|
242
|
+
},
|
|
243
|
+
a.id
|
|
244
|
+
)),
|
|
245
|
+
/* @__PURE__ */ e(
|
|
246
|
+
b,
|
|
247
|
+
{
|
|
248
|
+
className: "text-[12px] text-[var(--cc-muted)] focus:bg-[var(--cc-chip-hover)]",
|
|
249
|
+
onSelect: t.openCustomize,
|
|
250
|
+
children: "Manage views…"
|
|
251
|
+
}
|
|
252
|
+
)
|
|
253
|
+
]
|
|
254
|
+
}
|
|
255
|
+
)
|
|
256
|
+
] });
|
|
257
|
+
}
|
|
258
|
+
function W({
|
|
259
|
+
open: t,
|
|
260
|
+
onOpenChange: s
|
|
261
|
+
}) {
|
|
262
|
+
const n = m();
|
|
263
|
+
return /* @__PURE__ */ r(B, { open: t, onOpenChange: s, children: [
|
|
264
|
+
/* @__PURE__ */ e(O, { asChild: !0, children: /* @__PURE__ */ e(
|
|
265
|
+
"button",
|
|
266
|
+
{
|
|
267
|
+
type: "button",
|
|
268
|
+
className: o,
|
|
269
|
+
"aria-label": "Keyboard shortcuts",
|
|
270
|
+
"data-tip": "Keyboard shortcuts (?)",
|
|
271
|
+
children: /* @__PURE__ */ e(L, { className: "h-4 w-4", "aria-hidden": !0 })
|
|
272
|
+
}
|
|
273
|
+
) }),
|
|
274
|
+
/* @__PURE__ */ r(
|
|
275
|
+
R,
|
|
276
|
+
{
|
|
277
|
+
align: "end",
|
|
278
|
+
style: v(n.mode),
|
|
279
|
+
className: "w-72 border-[var(--cc-border)] bg-[var(--cc-panel)] p-3 text-[var(--cc-text)]",
|
|
280
|
+
children: [
|
|
281
|
+
/* @__PURE__ */ e("h2", { className: "mb-2 text-[13px] font-semibold text-[var(--cc-strong)]", children: "Keyboard shortcuts" }),
|
|
282
|
+
/* @__PURE__ */ e("dl", { className: "grid grid-cols-[auto_1fr] gap-x-3 gap-y-1.5 text-[12.5px]", children: j.map((a) => /* @__PURE__ */ r("div", { className: "contents", children: [
|
|
283
|
+
/* @__PURE__ */ e("dt", { children: /* @__PURE__ */ e("kbd", { className: "inline-block min-w-[1.75rem] rounded border border-[var(--cc-border)] bg-[var(--cc-raised)] px-1.5 text-center font-mono text-[11.5px] text-[var(--cc-strong)]", children: a.keys }) }),
|
|
284
|
+
/* @__PURE__ */ e("dd", { className: "text-[var(--cc-muted)]", children: a.label })
|
|
285
|
+
] }, a.keys)) }),
|
|
286
|
+
/* @__PURE__ */ e("p", { className: `mt-2 text-[11.5px] ${h}`, children: "Shortcuts pause while you type in a field." })
|
|
287
|
+
]
|
|
288
|
+
}
|
|
289
|
+
)
|
|
290
|
+
] });
|
|
291
|
+
}
|
|
292
|
+
export {
|
|
293
|
+
q as DeadlineChips,
|
|
294
|
+
me as Header,
|
|
295
|
+
f as goToAttention
|
|
296
|
+
};
|