@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.
Files changed (51) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +75 -7
  4. package/dist/shared/components/BaseMap.js +149 -103
  5. package/dist/shared/components/CollectionBrowserView.js +1390 -1358
  6. package/dist/shared/components/DataTable.js +356 -334
  7. package/dist/shared/components/ProfileView.js +16 -21
  8. package/dist/shared/components/command-center/CommandCenterView.js +331 -352
  9. package/dist/shared/components/command-center/Customize.js +353 -0
  10. package/dist/shared/components/command-center/Header.js +296 -0
  11. package/dist/shared/components/command-center/KioskLinks.js +198 -0
  12. package/dist/shared/components/command-center/PeekPanel.js +146 -0
  13. package/dist/shared/components/command-center/announce.js +13 -0
  14. package/dist/shared/components/command-center/api.js +26 -0
  15. package/dist/shared/components/command-center/board-prefs.js +99 -0
  16. package/dist/shared/components/command-center/freshness.js +29 -0
  17. package/dist/shared/components/command-center/layout.js +56 -0
  18. package/dist/shared/components/command-center/panels/AttentionPanel.js +135 -0
  19. package/dist/shared/components/command-center/panels/Banner.js +75 -0
  20. package/dist/shared/components/command-center/panels/BoardSettings.js +223 -0
  21. package/dist/shared/components/command-center/panels/FeedPanel.js +149 -0
  22. package/dist/shared/components/command-center/panels/FlowPanel.js +159 -0
  23. package/dist/shared/components/command-center/panels/ForecastPanel.js +247 -0
  24. package/dist/shared/components/command-center/panels/MapLegend.js +266 -0
  25. package/dist/shared/components/command-center/panels/MapPanel.js +224 -0
  26. package/dist/shared/components/command-center/panels/PartnersPanel.js +52 -0
  27. package/dist/shared/components/command-center/panels/PeoplePanel.js +264 -0
  28. package/dist/shared/components/command-center/panels/RegionPicker.js +91 -0
  29. package/dist/shared/components/command-center/panels/SystemPanel.js +173 -0
  30. package/dist/shared/components/command-center/panels/ThroughputPanel.js +310 -0
  31. package/dist/shared/components/command-center/panels/TimeBar.js +231 -0
  32. package/dist/shared/components/command-center/panels/TrafficPanel.js +15 -0
  33. package/dist/shared/components/command-center/panels/WorkloadPanel.js +85 -0
  34. package/dist/shared/components/command-center/panels/attention-actions.js +267 -0
  35. package/dist/shared/components/command-center/panels/map-shared.js +95 -0
  36. package/dist/shared/components/command-center/panels/registry.js +96 -0
  37. package/dist/shared/components/command-center/shell-hooks.js +118 -0
  38. package/dist/shared/components/command-center/shortcuts.js +37 -0
  39. package/dist/shared/components/command-center/state.js +12 -0
  40. package/dist/shared/components/command-center/theme.js +84 -0
  41. package/dist/shared/components/command-center/time.js +52 -0
  42. package/dist/shared/components/command-center/url-state.js +54 -0
  43. package/dist/shared/components/command-center/work-links.js +32 -0
  44. package/dist/shared/components/imports/ImportConsole.js +48 -47
  45. package/dist/shared/components/monitoring/TrafficMiniMap.js +111 -70
  46. package/dist/shared/components/notifications/TestMyRules.js +39 -38
  47. package/dist/shared/components/profile/TeamsConnect.js +2 -2
  48. package/dist/shared/components/queue/QueueQuickFilters.js +81 -63
  49. package/dist/shared/components/queue/QueueWorklist.js +598 -586
  50. package/dist/shared/lib/quick-filter-cascade.js +29 -0
  51. package/package.json +1 -1
@@ -1,361 +1,340 @@
1
- import { jsxs as l, jsx as a } from "react/jsx-runtime";
2
- import { useQueryClient as R, useQuery as $ } from "@tanstack/react-query";
3
- import { useState as h, useEffect as T, useMemo as M } from "react";
4
- import { useNivaroClient as F, useNavigation as I } from "../../context.js";
5
- import { get as k } from "../../lib/commands.js";
6
- import { titleCase as B } from "../../lib/utils.js";
7
- import { BaseMap as H } from "../BaseMap.js";
8
- import { TrafficMiniMap as K } from "../monitoring/TrafficMiniMap.js";
9
- const p = "rounded-lg border border-white/10 bg-[#101828]", f = "flex items-center justify-between border-b border-white/10 px-3 py-2", u = "text-[11px] font-semibold uppercase tracking-[0.08em] text-slate-400";
10
- function Q(x) {
11
- const r = Math.max(0, Math.floor((Date.now() - new Date(x).getTime()) / 1e3));
12
- return r < 60 ? `${r}s` : r < 3600 ? `${Math.floor(r / 60)}m` : `${Math.floor(r / 3600)}h`;
1
+ import { jsx as t, jsxs as u } from "react/jsx-runtime";
2
+ import { useQueryClient as ge } from "@tanstack/react-query";
3
+ import { MapPinned as ve } from "lucide-react";
4
+ import { useState as i, useRef as K, useEffect as B, useMemo as Q, useCallback as J, useContext as xe } from "react";
5
+ import { createPortal as ye } from "react-dom";
6
+ import { useNavigation as we } from "../../context.js";
7
+ import { attentionCount as ke, attentionAnnouncement as be } from "./announce.js";
8
+ import { useCcQuery as Z } from "./api.js";
9
+ import { useCcPrefs as Ce, useKioskInfo as Ne, DEFAULT_PREFS as Ee } from "./board-prefs.js";
10
+ import { CustomizeSheet as _e } from "./Customize.js";
11
+ import { countFailures as Ae } from "./freshness.js";
12
+ import { Header as Pe } from "./Header.js";
13
+ import { effectiveLayout as Te, resolvePanels as Fe, arrangeBoard as Me, boardSizeFor as Oe } from "./layout.js";
14
+ import { PeekPanel as Se } from "./PeekPanel.js";
15
+ import { BoardBanner as De } from "./panels/Banner.js";
16
+ import { CC_PANELS as Ue } from "./panels/registry.js";
17
+ import { useFullscreen as Ie, useWindowWidth as Re, usePeekFocus as $e, useRegionCycle as ze } from "./shell-hooks.js";
18
+ import { shortcutFor as Le, regionForIndex as Ke, FOCUS_REGION_EVENT as Be, REGION_PICKER_ATTR as Qe } from "./shortcuts.js";
19
+ import { EMPTY_FILTERS as He, CcContext as X } from "./state.js";
20
+ import { useAppIsDark as je, boardMode as Ve, MUTED as qe, ccVars as ue, BUTTON as ce, FOCUS as de } from "./theme.js";
21
+ import { EMPTY_URL_STATE as Ge, parseBoardUrl as We, windowUrlAdapter as Ye, writeBoardUrl as Ze } from "./url-state.js";
22
+ function Ct({
23
+ /** Fallback map collections when the instance has no Command Center config yet. */
24
+ geoCollections: H = ["locations"],
25
+ recordUrl: A,
26
+ isAdmin: C = !1,
27
+ kiosk: s = null,
28
+ urlAdapter: j
29
+ }) {
30
+ var L, c;
31
+ const { navigate: U } = we(), P = ge(), d = je(), y = s ? null : j ?? Ye, [f] = i(() => y ? We(y.read()) : Ge), [p, I] = i(f.region), [n, N] = i(f.at), [m, R] = i(f.map), [$, V] = i(He), [E, T] = i(f.peek), [h, q] = i(f.tv || !!s), [F, G] = i(null), [ee, g] = i(!1), v = Ie(), M = Ce(!s), x = s ? null : M.data ?? null, w = Ne(s), a = K(!1);
32
+ B(() => {
33
+ const r = w.data;
34
+ !r || a.current || (a.current = !0, r.region && I(r.region), r.map_collection && R(r.map_collection));
35
+ }, [w.data]), B(() => {
36
+ y && y.replace(Ze(y.read(), { region: p, at: n, map: m, peek: E, tv: h }));
37
+ }, [y, p, n, m, E, h]);
38
+ const O = Q(
39
+ () => A ?? ((r, b) => `/collections/${r}/${b}`),
40
+ [A]
41
+ ), z = J(
42
+ (r) => {
43
+ s || U(r);
44
+ },
45
+ [s, U]
46
+ ), k = J(
47
+ () => void P.invalidateQueries({ queryKey: ["command-center"] }),
48
+ [P]
49
+ ), S = Ve({ appDark: d, theme: x == null ? void 0 : x.theme, tv: h, kiosk: !!s }), W = Q(
50
+ () => ({
51
+ isAdmin: C,
52
+ kiosk: s,
53
+ config: null,
54
+ snapshot: null,
55
+ snapshotError: !1,
56
+ updatedAt: null,
57
+ snapshotLoading: !0,
58
+ snapshotFailures: 0,
59
+ refresh: k,
60
+ prefs: x,
61
+ mode: S,
62
+ region: p,
63
+ setRegion: I,
64
+ at: n,
65
+ setAt: N,
66
+ mapCollection: m,
67
+ setMapCollection: R,
68
+ filters: $,
69
+ setFilters: V,
70
+ peek: E,
71
+ // A wallboard opens no record (the server refuses /peek for a link as well).
72
+ setPeek: s ? Xe : T,
73
+ focusMap: (r) => G({ ...r, nonce: Date.now() }),
74
+ mapFocus: F,
75
+ tv: h,
76
+ setTv: (r) => q(s ? !0 : r),
77
+ fullscreen: v.on,
78
+ toggleFullscreen: v.toggle,
79
+ openCustomize: () => g(!0),
80
+ navigate: z,
81
+ recordUrl: O
82
+ }),
83
+ [
84
+ C,
85
+ s,
86
+ k,
87
+ x,
88
+ S,
89
+ p,
90
+ n,
91
+ m,
92
+ $,
93
+ E,
94
+ F,
95
+ h,
96
+ v.on,
97
+ v.toggle,
98
+ z,
99
+ O
100
+ ]
101
+ );
102
+ return s && w.isError ? /* @__PURE__ */ t(et, {}) : /* @__PURE__ */ t(X.Provider, { value: W, children: /* @__PURE__ */ t(
103
+ tt,
104
+ {
105
+ fallbackCollections: H,
106
+ exitFullscreen: v.exit,
107
+ customizeOpen: ee,
108
+ setCustomizeOpen: g,
109
+ kioskLabel: ((L = w.data) == null ? void 0 : L.label) ?? null,
110
+ kioskRegionPinned: !!((c = w.data) != null && c.region)
111
+ }
112
+ ) });
113
+ }
114
+ const Je = /* @__PURE__ */ new Set(["feed", "workload"]), Xe = () => {
115
+ };
116
+ function et() {
117
+ return /* @__PURE__ */ u(
118
+ "main",
119
+ {
120
+ className: "flex min-h-screen flex-col items-center justify-center gap-2 bg-[var(--cc-bg)] p-6 text-center",
121
+ style: ue("dark"),
122
+ children: [
123
+ /* @__PURE__ */ t("h1", { className: "text-[18px] font-semibold text-[var(--cc-strong)]", children: "This wallboard link no longer works" }),
124
+ /* @__PURE__ */ t("p", { className: `max-w-md text-[14px] ${qe}`, children: "It may have expired or been turned off. Ask an administrator for a new link." })
125
+ ]
126
+ }
127
+ );
13
128
  }
14
- function Z({
15
- /** Geo collections offered in the map layer picker; first is the default. */
16
- geoCollections: x = ["locations"],
17
- recordUrl: r
129
+ const me = 1.25;
130
+ function tt({
131
+ fallbackCollections: H,
132
+ exitFullscreen: A,
133
+ customizeOpen: C,
134
+ setCustomizeOpen: s,
135
+ kioskLabel: j,
136
+ kioskRegionPinned: U
18
137
  }) {
19
- const g = F(), { navigate: b } = I(), q = R(), [o, L] = h(x[0] ?? "locations"), [N, j] = h(!0), [d, C] = h(!0), [D, E] = h(() => /* @__PURE__ */ new Date()), [P, A] = h(null);
20
- T(() => {
21
- const e = setInterval(() => E(/* @__PURE__ */ new Date()), 1e3);
22
- return () => clearInterval(e);
23
- }, []);
24
- const { data: t } = $({
25
- queryKey: ["command-center", "snapshot"],
26
- queryFn: () => g.request(k("/command-center/snapshot")).then((e) => e.data).catch(() => null),
27
- refetchInterval: 2e4
28
- }), { data: c } = $({
29
- queryKey: ["command-center", "geo", o],
30
- queryFn: () => g.request(
31
- k("/command-center/geo", { collection: o })
32
- ).then((e) => ({ pins: e.data ?? [], truncated: !!e.truncated })).catch(() => ({ pins: [], truncated: !1 })),
33
- refetchInterval: 6e4,
34
- enabled: d
35
- }), { data: y = [] } = $({
36
- queryKey: ["command-center", "people-geo"],
37
- queryFn: () => g.request(k("/command-center/people-geo")).then((e) => e.data).catch(() => []),
38
- staleTime: 10 * 6e4
39
- }), S = M(
40
- () => (d ? (c == null ? void 0 : c.pins) ?? [] : []).map((e) => ({
41
- id: e.id,
42
- lat: e.lat,
43
- lng: e.lng,
44
- label: `${e.label}${e.state ? ` — ${e.state}` : ""}${e.sla === "breached" ? " · SLA BREACHED" : e.sla === "warning" ? " · SLA warning" : ""}`,
45
- color: e.sla === "breached" ? "#ef4444" : e.sla === "warning" ? "#f59e0b" : e.state_color ?? "#00a5cc",
46
- pulse: e.sla === "breached"
47
- })),
48
- [c, d]
49
- ), v = M(() => {
50
- if (!N) return [];
51
- const e = ((t == null ? void 0 : t.people.offices) ?? []).map((n, _) => ({
52
- id: `office-${_}`,
53
- lat: n.lat,
54
- lng: n.lng,
55
- count: n.count,
56
- label: `${n.label}${n.names.length ? ` — ${n.names.slice(0, 5).join(", ")}${n.names.length > 5 ? ` +${n.names.length - 5}` : ""}` : ""}`,
57
- color: "#34d399"
58
- })), i = new Map(((t == null ? void 0 : t.people.by_region) ?? []).map((n) => [n.region_id, n.count])), s = y.filter((n) => (i.get(n.id) ?? 0) > 0).map((n) => ({
59
- id: String(n.id),
60
- lat: n.lat,
61
- lng: n.lng,
62
- count: i.get(n.id) ?? 0,
63
- label: n.label,
64
- color: "#34d399"
65
- }));
66
- return [...e, ...s];
67
- }, [y, t, N]), m = t == null ? void 0 : t.throughput, w = m ? m.transitions_today - m.transitions_yesterday_same_time : 0;
68
- return /* @__PURE__ */ l("div", { className: "flex h-full min-h-0 flex-1 flex-col gap-3 bg-[#0b1220] p-4 text-slate-200", children: [
69
- /* @__PURE__ */ l("div", { className: "flex shrink-0 flex-wrap items-center gap-x-6 gap-y-2", children: [
70
- /* @__PURE__ */ a("h1", { className: "text-[16px] font-semibold tracking-[-0.01em] text-white", children: "Command Center" }),
71
- /* @__PURE__ */ a("span", { className: "font-mono text-[13px] tabular-nums text-slate-400", children: D.toLocaleTimeString() }),
72
- /* @__PURE__ */ l("span", { className: "flex items-center gap-1.5 text-[12.5px] text-slate-300", children: [
73
- /* @__PURE__ */ a("span", { className: "h-2 w-2 rounded-full bg-emerald-400" }),
74
- (t == null ? void 0 : t.people.online_count) ?? "–",
75
- " online",
76
- t && t.people.idle_count > 0 && /* @__PURE__ */ l("span", { className: "text-slate-500", children: [
77
- "· ",
78
- t.people.idle_count,
79
- " idle"
80
- ] })
81
- ] }),
82
- m && /* @__PURE__ */ l("span", { className: "text-[12.5px] text-slate-300", children: [
83
- /* @__PURE__ */ a("b", { className: "tabular-nums", children: m.transitions_today }),
84
- " transitions today",
85
- " ",
86
- /* @__PURE__ */ l("span", { className: w >= 0 ? "text-emerald-400" : "text-amber-400", children: [
87
- "(",
88
- w >= 0 ? "+" : "",
89
- w,
90
- " vs yesterday)"
91
- ] })
92
- ] }),
93
- t && t.risk.open_issues > 0 && /* @__PURE__ */ l(
94
- "button",
95
- {
96
- type: "button",
97
- onClick: () => b("/issues"),
98
- className: "rounded-full bg-red-500/15 px-2.5 py-0.5 text-[12px] font-medium text-red-400 hover:bg-red-500/25",
99
- children: [
100
- t.risk.open_issues,
101
- " open issues"
102
- ]
103
- }
104
- ),
105
- /* @__PURE__ */ a(
106
- "button",
107
- {
108
- type: "button",
109
- onClick: () => void q.invalidateQueries({ queryKey: ["command-center"] }),
110
- className: "ml-auto rounded-md border border-white/15 px-2.5 py-1 text-[11.5px] text-slate-300 hover:bg-white/5",
111
- children: "Refresh"
138
+ var oe, re, ae, se;
139
+ const P = xe(X);
140
+ if (!P) throw new Error("Command Center board outside its provider");
141
+ const d = Z("/snapshot", void 0, {
142
+ refetchInterval: 2e4,
143
+ retry: 1
144
+ }), f = Z("/config", void 0, {
145
+ staleTime: 5 * 6e4,
146
+ lenses: !1,
147
+ retry: !1
148
+ }).data ?? {
149
+ geo_collections: H.map((o) => ({ key: o, label: "" })),
150
+ regions: [],
151
+ region_label: null,
152
+ stuck_days: 7
153
+ }, p = K({ dataAt: 0, errors: 0 });
154
+ d.dataUpdatedAt !== p.current.dataAt && (p.current = { dataAt: d.dataUpdatedAt, errors: d.errorUpdateCount });
155
+ const I = Ae(d.errorUpdateCount, p.current.errors), n = {
156
+ ...P,
157
+ config: f,
158
+ snapshot: d.data ?? null,
159
+ snapshotError: d.isError,
160
+ updatedAt: d.dataUpdatedAt || null,
161
+ snapshotLoading: d.isPending,
162
+ snapshotFailures: I
163
+ }, { tv: N, kiosk: m, peek: R, fullscreen: $, region: V, setRegion: E } = n, [T, h] = i(!1), [q, F] = i(!1), G = Re(), g = Oe(G / (N ? me : 1)), v = J(
164
+ (o) => {
165
+ var e;
166
+ return !(n.kiosk && Je.has(o.key)) && (!o.adminOnly || n.isAdmin || !!((e = n.snapshot) != null && e.health));
167
+ },
168
+ [n.isAdmin, n.kiosk, (oe = n.snapshot) == null ? void 0 : oe.health]
169
+ ), M = Q(() => Ue.filter(v), [v]), x = Te((re = n.prefs) == null ? void 0 : re.layout, (ae = n.prefs) == null ? void 0 : ae.role_default), w = Q(() => {
170
+ const o = new Map(M.map((e) => [e.key, e]));
171
+ return Fe(
172
+ M.map((e) => e.key),
173
+ x
174
+ ).filter((e) => e.visible).map((e) => o.get(e.key)).filter((e) => !!e);
175
+ }, [M, x]), a = Me(w, g);
176
+ $e(!!R), ze({
177
+ // A wallboard stays on the board its link opens on (the server pins it too).
178
+ enabled: N && !m && !U,
179
+ regionIds: f.regions.map((o) => o.id),
180
+ current: V,
181
+ setRegion: E,
182
+ intervalMs: (((se = n.prefs) == null ? void 0 : se.tv_cycle_seconds) ?? Ee.tv_cycle_seconds ?? 30) * 1e3
183
+ });
184
+ const O = K({ state: n, helpOpen: T, customizeOpen: C });
185
+ O.current = { state: n, helpOpen: T, customizeOpen: C }, B(() => {
186
+ const o = (e) => {
187
+ var le, ie;
188
+ const Y = Le(e);
189
+ if (!Y) return;
190
+ const { state: l, helpOpen: pe, customizeOpen: he } = O.current;
191
+ if (he || pe) return;
192
+ const D = e.target;
193
+ if (!((le = D == null ? void 0 : D.closest) != null && le.call(D, '[role="dialog"]:not([data-cc-peek]), [role="menu"], [role="listbox"]')))
194
+ switch (Y.kind) {
195
+ case "escape":
196
+ l.peek ? (e.preventDefault(), l.setPeek(null)) : l.fullscreen ? A() : l.tv && !l.kiosk && l.setTv(!1);
197
+ return;
198
+ case "fullscreen":
199
+ e.preventDefault(), l.toggleFullscreen();
200
+ return;
201
+ case "tv":
202
+ e.preventDefault(), l.setTv(!l.tv);
203
+ return;
204
+ case "refresh":
205
+ e.preventDefault(), l.refresh();
206
+ return;
207
+ case "focus-region": {
208
+ if (l.kiosk) return;
209
+ e.preventDefault(), window.dispatchEvent(new CustomEvent(Be));
210
+ const _ = document.querySelector(`[${Qe}]`);
211
+ _ && !_.contains(document.activeElement) && _.focus();
212
+ return;
213
+ }
214
+ case "region": {
215
+ if (l.kiosk) return;
216
+ const _ = Ke(((ie = l.config) == null ? void 0 : ie.regions) ?? [], Y.index);
217
+ if (_ === void 0) return;
218
+ e.preventDefault(), l.setRegion(_);
219
+ return;
220
+ }
221
+ case "help":
222
+ e.preventDefault(), h(!0);
223
+ return;
112
224
  }
113
- )
225
+ };
226
+ return window.addEventListener("keydown", o), () => window.removeEventListener("keydown", o);
227
+ }, [A]);
228
+ const z = Z("/attention", void 0, { enabled: !1 }), k = ke(z.data), S = K(null), [W, L] = i("");
229
+ B(() => {
230
+ if (k === null) return;
231
+ const o = be(S.current, k);
232
+ S.current = k, o && L(o);
233
+ }, [k]);
234
+ const c = (o) => o.map((e) => /* @__PURE__ */ t("div", { className: "min-w-0", "data-cc-slot": e.key, children: /* @__PURE__ */ t(e.component, {}) }, e.key)), r = (o) => a.main.map(
235
+ (e) => g === "phone" && !q ? /* @__PURE__ */ u(
236
+ "button",
237
+ {
238
+ type: "button",
239
+ "aria-expanded": !1,
240
+ onClick: () => F(!0),
241
+ className: `${ce} flex w-full items-center justify-center gap-2 py-2.5 text-[12.5px] ${de}`,
242
+ children: [
243
+ /* @__PURE__ */ t(ve, { className: "h-4 w-4", "aria-hidden": !0 }),
244
+ "Show map"
245
+ ]
246
+ },
247
+ e.key
248
+ ) : /* @__PURE__ */ u(
249
+ "div",
250
+ {
251
+ "data-cc-slot": e.key,
252
+ className: o ? "flex min-h-[420px] min-w-0 flex-1 flex-col [&>*]:flex-1" : "min-w-0",
253
+ children: [
254
+ /* @__PURE__ */ t(e.component, {}),
255
+ g === "phone" && /* @__PURE__ */ t(
256
+ "button",
257
+ {
258
+ type: "button",
259
+ "aria-expanded": !0,
260
+ onClick: () => F(!1),
261
+ className: `${ce} mt-2 w-full ${de}`,
262
+ children: "Hide map"
263
+ }
264
+ )
265
+ ]
266
+ },
267
+ e.key
268
+ )
269
+ );
270
+ let b;
271
+ a.columns === "three" ? b = /* @__PURE__ */ u("div", { className: "grid min-h-0 flex-1 grid-cols-[340px_minmax(0,1fr)_360px] gap-3", children: [
272
+ /* @__PURE__ */ t(
273
+ "section",
274
+ {
275
+ "aria-label": "Needs someone now",
276
+ className: "flex min-h-0 flex-col gap-3 overflow-y-auto",
277
+ children: c(a.lead)
278
+ }
279
+ ),
280
+ /* @__PURE__ */ u("div", { className: "flex min-h-0 min-w-0 flex-col gap-3", children: [
281
+ r(!0),
282
+ c(a.under)
114
283
  ] }),
115
- /* @__PURE__ */ l("div", { className: "grid min-h-0 flex-1 gap-3 xl:grid-cols-[1fr_340px]", children: [
116
- /* @__PURE__ */ l("div", { className: `${p} flex min-h-[420px] flex-col overflow-hidden`, children: [
117
- /* @__PURE__ */ l("div", { className: f, children: [
118
- /* @__PURE__ */ a("span", { className: u, children: "Live map" }),
119
- /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
120
- x.map((e) => {
121
- const i = d && o === e;
122
- return /* @__PURE__ */ a(
123
- "button",
124
- {
125
- type: "button",
126
- onClick: () => {
127
- o === e ? C((s) => !s) : (L(e), C(!0));
128
- },
129
- className: `rounded px-2 py-0.5 text-[11px] ${i ? "bg-nvr-cyan font-medium text-[#172940]" : "text-slate-400 hover:bg-white/5"}`,
130
- title: i ? "Hide this layer" : "Show this layer",
131
- children: B(e.replace(/_/g, " "))
132
- },
133
- e
134
- );
135
- }),
136
- /* @__PURE__ */ a(
137
- "button",
138
- {
139
- type: "button",
140
- onClick: () => j((e) => !e),
141
- className: `rounded px-2 py-0.5 text-[11px] ${N ? "bg-emerald-400/20 font-medium text-emerald-300" : "text-slate-400 hover:bg-white/5"}`,
142
- title: "Online users by region (from scope placements)",
143
- children: "People"
144
- }
145
- )
146
- ] })
147
- ] }),
148
- /* @__PURE__ */ a("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ a(
149
- H,
150
- {
151
- pins: S,
152
- bubbles: v,
153
- focus: P,
154
- onPinClick: (e) => b(
155
- r ? r(o, e) : `/collections/${o}/${e}`
156
- ),
157
- statusLine: `${d ? `${S.length} ${o.replace(/_/g, " ")}${c != null && c.truncated ? " (first 500)" : ""}` : `${o.replace(/_/g, " ")} hidden`}${v.length > 0 ? ` · ${v.length} groups with people on` : ""} · © OpenStreetMap`,
158
- minHeight: 380
159
- }
160
- ) })
161
- ] }),
162
- /* @__PURE__ */ l("div", { className: "flex min-h-0 flex-col gap-3 overflow-y-auto", children: [
163
- /* @__PURE__ */ l("div", { className: p, children: [
164
- /* @__PURE__ */ a("div", { className: f, children: /* @__PURE__ */ a("span", { className: u, children: "Pipeline flow" }) }),
165
- /* @__PURE__ */ l("div", { className: "space-y-3 p-3", children: [
166
- ((t == null ? void 0 : t.flow) ?? []).map((e) => {
167
- const i = e.states.reduce((s, n) => s + n.count, 0);
168
- return /* @__PURE__ */ l("div", { children: [
169
- /* @__PURE__ */ l("div", { className: "mb-1 flex items-baseline justify-between", children: [
170
- /* @__PURE__ */ a("span", { className: "text-[12px] font-medium text-slate-200", children: e.template_name }),
171
- /* @__PURE__ */ l("span", { className: "text-[11px] tabular-nums text-slate-500", children: [
172
- i,
173
- " open"
174
- ] })
175
- ] }),
176
- /* @__PURE__ */ a("div", { className: "flex h-2.5 overflow-hidden rounded-full bg-white/5", children: e.states.map((s) => /* @__PURE__ */ a(
177
- "button",
178
- {
179
- type: "button",
180
- onClick: () => b(`/collections/${e.collection}`),
181
- className: "h-full transition-opacity hover:opacity-75",
182
- style: {
183
- width: `${Math.max(2, s.count / Math.max(1, i) * 100)}%`,
184
- background: s.color ?? "#00a5cc"
185
- },
186
- "data-tip": `${s.label}: ${s.count}`
187
- },
188
- s.key
189
- )) }),
190
- /* @__PURE__ */ a("div", { className: "mt-1 flex flex-wrap gap-x-3 gap-y-0.5", children: e.states.map((s) => /* @__PURE__ */ l(
191
- "span",
192
- {
193
- className: "flex items-center gap-1 text-[10.5px] text-slate-400",
194
- children: [
195
- /* @__PURE__ */ a(
196
- "span",
197
- {
198
- className: "h-1.5 w-1.5 rounded-full",
199
- style: { background: s.color ?? "#00a5cc" }
200
- }
201
- ),
202
- s.label,
203
- " ",
204
- /* @__PURE__ */ a("b", { className: "tabular-nums text-slate-300", children: s.count })
205
- ]
206
- },
207
- s.key
208
- )) })
209
- ] }, e.collection);
210
- }),
211
- ((t == null ? void 0 : t.flow) ?? []).length === 0 && /* @__PURE__ */ a("p", { className: "text-[12px] text-slate-500", children: "No workflow-bound collections visible to you." })
212
- ] })
213
- ] }),
214
- /* @__PURE__ */ l("div", { className: p, children: [
215
- /* @__PURE__ */ l("div", { className: f, children: [
216
- /* @__PURE__ */ a("span", { className: u, children: "People on now" }),
217
- /* @__PURE__ */ a("span", { className: "text-[11px] tabular-nums text-slate-500", children: (t == null ? void 0 : t.people.online_count) ?? 0 })
218
- ] }),
219
- /* @__PURE__ */ l("div", { className: "space-y-2.5 p-3", children: [
220
- ((t == null ? void 0 : t.people.regions) ?? []).map((e) => {
221
- const i = e.region_id != null ? y.find((n) => n.id === e.region_id) : null, s = e.lat != null && e.lng != null ? { lat: e.lat, lng: e.lng, zoom: 12 } : i ? { lat: i.lat, lng: i.lng, zoom: 8 } : null;
222
- return /* @__PURE__ */ l("div", { children: [
223
- /* @__PURE__ */ l(
224
- "button",
225
- {
226
- type: "button",
227
- disabled: !s,
228
- onClick: () => s && A({ ...s, nonce: Date.now() }),
229
- className: `flex w-full items-center gap-1.5 text-left ${s ? "group cursor-pointer" : "cursor-default"}`,
230
- title: s ? "Show this group on the map" : "No map placement for this group",
231
- children: [
232
- /* @__PURE__ */ a("span", { className: "flex h-3.5 w-3.5 items-center justify-center rounded-full border-2 border-dashed border-emerald-400/80 bg-emerald-400/25" }),
233
- /* @__PURE__ */ a("span", { className: "text-[11.5px] font-semibold uppercase tracking-wide text-emerald-300 group-hover:underline", children: e.label }),
234
- /* @__PURE__ */ a("span", { className: "text-[11px] tabular-nums text-slate-500", children: e.count }),
235
- s && /* @__PURE__ */ a("span", { className: "ml-auto text-[10.5px] text-slate-500 opacity-0 transition-opacity group-hover:opacity-100", children: "show on map →" })
236
- ]
237
- }
238
- ),
239
- /* @__PURE__ */ a("div", { className: "mt-1 flex flex-wrap gap-1.5 pl-5", children: e.names.map((n, _) => /* @__PURE__ */ a(
240
- "span",
241
- {
242
- className: "rounded-full bg-white/5 px-2 py-0.5 text-[11.5px] text-slate-300",
243
- children: n
244
- },
245
- _
246
- )) })
247
- ] }, `${e.region_id ?? "x"}:${e.label}`);
248
- }),
249
- ((t == null ? void 0 : t.people.regions) ?? []).length === 0 && /* @__PURE__ */ a("p", { className: "text-[12px] text-slate-500", children: "Nobody online right now." })
250
- ] })
251
- ] }),
252
- (t == null ? void 0 : t.health) && /* @__PURE__ */ a(K, { tone: "dark" }),
253
- (t == null ? void 0 : t.health) && /* @__PURE__ */ l("div", { className: p, children: [
254
- /* @__PURE__ */ l("div", { className: f, children: [
255
- /* @__PURE__ */ a("span", { className: u, children: "System" }),
256
- /* @__PURE__ */ l("span", { className: "text-[11px] text-slate-500", children: [
257
- t.health.instances,
258
- " instance(s)"
259
- ] })
260
- ] }),
261
- /* @__PURE__ */ l("div", { className: "grid grid-cols-2 gap-x-4 gap-y-1.5 p-3 text-[12px]", children: [
262
- /* @__PURE__ */ l("span", { className: "flex items-center gap-1.5", children: [
263
- /* @__PURE__ */ a(
264
- "span",
265
- {
266
- className: `h-2 w-2 rounded-full ${t.health.db_ok ? "bg-emerald-400" : "bg-red-500"}`
267
- }
268
- ),
269
- "Database"
270
- ] }),
271
- /* @__PURE__ */ l("span", { className: "flex items-center gap-1.5", children: [
272
- /* @__PURE__ */ a(
273
- "span",
274
- {
275
- className: `h-2 w-2 rounded-full ${t.health.redis_ok ? "bg-emerald-400" : "bg-red-500"}`
276
- }
277
- ),
278
- "Redis"
279
- ] }),
280
- /* @__PURE__ */ l("span", { children: [
281
- "Errors 1h:",
282
- " ",
283
- /* @__PURE__ */ a(
284
- "b",
285
- {
286
- className: `tabular-nums ${t.health.errors_1h > 20 ? "text-red-400" : "text-slate-200"}`,
287
- children: t.health.errors_1h
288
- }
289
- ),
290
- /* @__PURE__ */ l("span", { className: "text-slate-500", children: [
291
- " ",
292
- "/ ",
293
- t.health.requests_1h.toLocaleString(),
294
- " req"
295
- ] })
296
- ] }),
297
- /* @__PURE__ */ l("span", { children: [
298
- "Jobs: ",
299
- /* @__PURE__ */ a("b", { className: "tabular-nums", children: t.health.jobs_running }),
300
- " running",
301
- t.health.jobs_failed_1h > 0 && /* @__PURE__ */ l("b", { className: "tabular-nums text-amber-400", children: [
302
- " ",
303
- "· ",
304
- t.health.jobs_failed_1h,
305
- " failed"
306
- ] })
307
- ] }),
308
- /* @__PURE__ */ l("span", { children: [
309
- "RSS: ",
310
- /* @__PURE__ */ l("b", { className: "tabular-nums", children: [
311
- t.health.runtime.rss_mb,
312
- " MB"
313
- ] })
314
- ] }),
315
- /* @__PURE__ */ l("span", { children: [
316
- "Loop lag:",
317
- " ",
318
- /* @__PURE__ */ l(
319
- "b",
320
- {
321
- className: `tabular-nums ${t.health.runtime.event_loop_lag_ms.max_1m > 300 ? "text-red-400" : ""}`,
322
- children: [
323
- t.health.runtime.event_loop_lag_ms.max_1m,
324
- " ms"
325
- ]
326
- }
327
- )
328
- ] })
329
- ] })
330
- ] })
331
- ] })
284
+ /* @__PURE__ */ t(
285
+ "aside",
286
+ {
287
+ "aria-label": "More on the board",
288
+ className: "flex min-h-0 flex-col gap-3 overflow-y-auto",
289
+ children: c(a.rail)
290
+ }
291
+ )
292
+ ] }) : a.columns === "two" ? b = /* @__PURE__ */ u("div", { className: "grid min-h-0 flex-1 grid-cols-[minmax(0,1fr)_380px] gap-3", children: [
293
+ /* @__PURE__ */ u("div", { className: "flex min-h-0 min-w-0 flex-col gap-3", children: [
294
+ r(!0),
295
+ c(a.under)
332
296
  ] }),
333
- /* @__PURE__ */ a("div", { className: `${p} shrink-0`, children: /* @__PURE__ */ l("div", { className: "flex items-center gap-3 overflow-x-auto px-3 py-2", children: [
334
- /* @__PURE__ */ a("span", { className: `${u} shrink-0`, children: "Live" }),
335
- ((t == null ? void 0 : t.activity) ?? []).map((e) => /* @__PURE__ */ l(
336
- "button",
337
- {
338
- type: "button",
339
- onClick: () => e.collection && e.item ? b(
340
- r ? r(e.collection, e.item) : `/collections/${e.collection}/${e.item}`
341
- ) : void 0,
342
- className: "flex shrink-0 items-center gap-1.5 rounded-full bg-white/5 px-2.5 py-1 text-[11.5px] text-slate-300 hover:bg-white/10",
343
- children: [
344
- /* @__PURE__ */ a("span", { className: "tabular-nums text-slate-500", children: Q(e.timestamp) }),
345
- /* @__PURE__ */ a("span", { className: "font-medium text-slate-200", children: e.user_name || "System" }),
346
- /* @__PURE__ */ a("span", { className: "text-slate-400", children: e.action.replace(/-/g, " ") }),
347
- e.collection && /* @__PURE__ */ l("span", { className: "text-slate-400", children: [
348
- e.collection.replace(/_/g, " "),
349
- e.item ? ` #${e.item}` : ""
350
- ] })
351
- ]
352
- },
353
- e.id
354
- )),
355
- ((t == null ? void 0 : t.activity) ?? []).length === 0 && /* @__PURE__ */ a("span", { className: "text-[12px] text-slate-500", children: "Quiet — no recent activity you can see." })
356
- ] }) })
297
+ /* @__PURE__ */ t(
298
+ "aside",
299
+ {
300
+ "aria-label": "More on the board",
301
+ className: "flex min-h-0 flex-col gap-3 overflow-y-auto",
302
+ children: c(a.rail)
303
+ }
304
+ )
305
+ ] }) : b = /* @__PURE__ */ u("div", { className: "flex flex-col gap-3", children: [
306
+ a.lead.length > 0 && /* @__PURE__ */ t("section", { "aria-label": "Needs someone now", className: "flex flex-col gap-3", children: c(a.lead) }),
307
+ r(!1),
308
+ /* @__PURE__ */ t(
309
+ "aside",
310
+ {
311
+ "aria-label": "More on the board",
312
+ className: `grid gap-3 ${g === "medium" ? "grid-cols-2" : "grid-cols-1"}`,
313
+ children: c(a.rail)
314
+ }
315
+ ),
316
+ c(a.under)
357
317
  ] });
318
+ const fe = a.columns !== "one", te = $ && !m, ne = /* @__PURE__ */ t(X.Provider, { value: n, children: /* @__PURE__ */ u(
319
+ "div",
320
+ {
321
+ className: `relative flex min-w-0 flex-col gap-3 bg-[var(--cc-bg)] p-3 text-[var(--cc-text)] sm:p-4 ${fe ? "h-full min-h-0 flex-1" : "min-h-full flex-1"} ${te ? "fixed inset-0 z-[45] overflow-auto" : ""} ${m ? "min-h-screen" : ""}`,
322
+ style: { ...ue(n.mode), ...N ? { zoom: me } : {} },
323
+ "data-cc-mode": n.mode,
324
+ "data-cc-tv": N ? "1" : void 0,
325
+ "data-cc-size": g,
326
+ children: [
327
+ /* @__PURE__ */ t(Pe, { helpOpen: T, onHelpOpenChange: h, kioskLabel: j }),
328
+ /* @__PURE__ */ t(De, {}),
329
+ m ? /* @__PURE__ */ t("main", { className: "flex min-h-0 flex-1 flex-col", children: b }) : /* @__PURE__ */ t("section", { "aria-label": "Command Center board", className: "flex min-h-0 flex-1 flex-col", children: b }),
330
+ /* @__PURE__ */ t(Se, {}),
331
+ /* @__PURE__ */ t("div", { className: "sr-only", "aria-live": "polite", "aria-atomic": "true", children: W }),
332
+ !m && /* @__PURE__ */ t(_e, { open: C, onOpenChange: s })
333
+ ]
334
+ }
335
+ ) });
336
+ return te && typeof document < "u" ? ye(ne, document.body) : ne;
358
337
  }
359
338
  export {
360
- Z as CommandCenterView
339
+ Ct as CommandCenterView
361
340
  };