@nivaro/react 0.3.45 → 0.3.47
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 +290 -23
- package/dist/index.js +679 -659
- package/dist/shared/components/BaseMap.js +149 -103
- package/dist/shared/components/CollectionBrowserView.js +813 -826
- package/dist/shared/components/ErrorNotice.js +169 -0
- package/dist/shared/components/ErrorSurface.js +23 -17
- package/dist/shared/components/ListLoadError.js +8 -29
- package/dist/shared/components/LoadErrorNote.js +38 -21
- package/dist/shared/components/QueryErrorState.js +8 -11
- package/dist/shared/components/ReportView.js +1320 -1291
- package/dist/shared/components/chat/ChannelArchive.js +60 -60
- package/dist/shared/components/chat/ChannelExtras.js +74 -74
- package/dist/shared/components/chat/ChatPanel.js +368 -367
- package/dist/shared/components/command-center/CommandCenterView.js +313 -69
- package/dist/shared/components/command-center/Customize.js +353 -0
- package/dist/shared/components/command-center/Header.js +279 -53
- package/dist/shared/components/command-center/KioskLinks.js +198 -0
- package/dist/shared/components/command-center/PeekPanel.js +144 -3
- package/dist/shared/components/command-center/announce.js +13 -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 +132 -3
- package/dist/shared/components/command-center/panels/Banner.js +75 -0
- package/dist/shared/components/command-center/panels/BoardSettings.js +224 -0
- package/dist/shared/components/command-center/panels/FeedPanel.js +145 -29
- package/dist/shared/components/command-center/panels/FlowPanel.js +154 -56
- package/dist/shared/components/command-center/panels/ForecastPanel.js +244 -3
- package/dist/shared/components/command-center/panels/MapLegend.js +266 -0
- package/dist/shared/components/command-center/panels/MapPanel.js +216 -66
- package/dist/shared/components/command-center/panels/PartnersPanel.js +49 -3
- package/dist/shared/components/command-center/panels/PeoplePanel.js +258 -40
- package/dist/shared/components/command-center/panels/RegionPicker.js +88 -3
- package/dist/shared/components/command-center/panels/SystemPanel.js +158 -38
- package/dist/shared/components/command-center/panels/ThroughputPanel.js +307 -3
- package/dist/shared/components/command-center/panels/TimeBar.js +227 -6
- package/dist/shared/components/command-center/panels/TrafficPanel.js +12 -8
- package/dist/shared/components/command-center/panels/WorkloadPanel.js +82 -3
- 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 +87 -19
- 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/theme.js +39 -21
- 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/help-videos/editor/ClipsPanel.js +49 -48
- package/dist/shared/components/help-videos/editor/PublishButton.js +37 -36
- package/dist/shared/components/help-videos/editor/StatsTab.js +45 -44
- package/dist/shared/components/help-videos/editor/VersionsTab.js +29 -28
- package/dist/shared/components/help-videos/library/AuthorRolesButton.js +19 -18
- package/dist/shared/components/help-videos/library/HelpVideoLibrary.js +132 -129
- package/dist/shared/components/help-videos/library/LearningPathsPanel.js +42 -41
- package/dist/shared/components/help-videos/settings/HouseStyleButton.js +21 -20
- package/dist/shared/components/help-videos/settings/RenderSettingsButton.js +22 -21
- package/dist/shared/components/import/DocumentAutofillButton.js +24 -20
- package/dist/shared/components/import/ImportFromFileButton.js +61 -60
- package/dist/shared/components/imports/ImportStalenessControl.js +20 -21
- package/dist/shared/components/imports/NewImportDialog.js +29 -28
- package/dist/shared/components/imports/RunDetailSheet.js +63 -63
- package/dist/shared/components/item-edit/FieldRow.js +329 -329
- package/dist/shared/components/item-edit/InlineTableField.js +898 -898
- package/dist/shared/components/item-edit/PersonalDefaultControl.js +57 -56
- package/dist/shared/components/item-edit/PlanGrid.js +220 -221
- package/dist/shared/components/item-edit/RecordGrantTools.js +49 -48
- package/dist/shared/components/item-edit/placement-behaviour.js +68 -67
- package/dist/shared/components/layout-editor/inspector/ColumnFit.js +24 -23
- package/dist/shared/components/layout-editor/inspector/PickerPreview.js +17 -16
- package/dist/shared/components/layout-editor/matrix/FieldStateMatrix.js +41 -41
- package/dist/shared/components/layout-editor/outputs/output-api.js +33 -31
- package/dist/shared/components/layout-editor/overview/overview-api.js +84 -83
- package/dist/shared/components/layout-editor/useLayoutDraft.js +47 -42
- package/dist/shared/components/monitoring/InactiveUserLinksView.js +10 -9
- package/dist/shared/components/monitoring/TrafficMiniMap.js +111 -70
- package/dist/shared/components/panels/SlaClock.js +35 -36
- package/dist/shared/components/pipeline/PipelineEditorView.js +311 -312
- package/dist/shared/components/pipeline/TeamSuggestions.js +31 -30
- package/dist/shared/components/profile/AgentsPanel.js +73 -72
- package/dist/shared/components/profile/MailSuppressedPill.js +22 -21
- package/dist/shared/components/support/SupportRequestDialog.js +85 -81
- package/dist/shared/components/support/SupportView.js +94 -87
- package/dist/shared/lib/autofill-poll.js +21 -18
- package/dist/shared/lib/error-actions.js +85 -0
- package/dist/shared/lib/error-message.js +223 -82
- package/dist/shared/lib/error-toast.js +71 -13
- package/dist/shared/lib/safe-error.js +136 -38
- package/package.json +1 -1
|
@@ -1,74 +1,224 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
1
|
+
import { jsx as o, jsxs as p } from "react/jsx-runtime";
|
|
2
|
+
import { Settings2 as V, MapPinned as X, KeyRound as Z } from "lucide-react";
|
|
3
|
+
import { useState as N, useMemo as g } from "react";
|
|
4
|
+
import { titleCase as j, cn as h } from "../../../lib/utils.js";
|
|
5
|
+
import { BaseMap as ee } from "../../BaseMap.js";
|
|
6
|
+
import { useCcQuery as y } from "../api.js";
|
|
7
|
+
import { useCc as te } from "../state.js";
|
|
8
|
+
import { FOCUS as b, PANEL as E, PANEL_HEAD as R, TITLE as I, MUTED as ae, BUTTON as ne, FAINT as oe } from "../theme.js";
|
|
9
|
+
import { BoardSettings as F } from "./BoardSettings.js";
|
|
10
|
+
import { MapFilters as le, MapLegend as se } from "./MapLegend.js";
|
|
11
|
+
import { slaWords as ie, pinColor as W, MAP_COLORS as m, slaRank as D } from "./map-shared.js";
|
|
12
|
+
const re = [
|
|
13
|
+
{ kind: "sla_heat", label: "SLA heat" },
|
|
14
|
+
{ kind: "activity", label: "Recent changes" },
|
|
15
|
+
{ kind: "out_today", label: "Out today" }
|
|
16
|
+
];
|
|
17
|
+
function ce(l, c) {
|
|
18
|
+
const i = {};
|
|
19
|
+
return l && (i.collection = l), c.states.length && (i.states = c.states.join(",")), c.sla.length && (i.sla = c.sla.join(",")), c.owner && (i.owner = c.owner), i;
|
|
20
|
+
}
|
|
21
|
+
function we() {
|
|
22
|
+
var B, T;
|
|
23
|
+
const l = te(), { snapshot: c, config: i, mapCollection: K } = l, u = (i == null ? void 0 : i.geo_collections) ?? [], r = K ?? ((B = u[0]) == null ? void 0 : B.key) ?? null, _ = !l.kiosk && (l.isAdmin || !!(i != null && i.can_configure)), [v, Q] = N([]), [x, U] = N(!1), [$, k] = N(!1), n = y("/geo", ce(r, l.filters), {
|
|
24
|
+
enabled: !!r,
|
|
25
|
+
refetchInterval: 6e4
|
|
26
|
+
}).data, w = (e) => [
|
|
27
|
+
{ kind: e, ...e !== "out_today" && r ? { collection: r } : {} },
|
|
28
|
+
{
|
|
29
|
+
enabled: v.includes(e) && (e === "out_today" || !!r),
|
|
30
|
+
refetchInterval: 6e4
|
|
31
|
+
}
|
|
32
|
+
], C = y("/layers", ...w("sla_heat")), L = y("/layers", ...w("activity")), M = y("/layers", ...w("out_today")), z = g(() => new Map(((n == null ? void 0 : n.pins) ?? []).map((e) => [e.id, e])), [n]), A = g(
|
|
33
|
+
() => ((n == null ? void 0 : n.pins) ?? []).map((e) => {
|
|
34
|
+
const t = [e.state, ie(e.sla), e.owner ? `owner ${e.owner}` : null].filter(
|
|
35
|
+
Boolean
|
|
36
|
+
);
|
|
37
|
+
return {
|
|
38
|
+
id: e.id,
|
|
39
|
+
lat: e.lat,
|
|
40
|
+
lng: e.lng,
|
|
41
|
+
label: `${e.label}${t.length ? ` — ${t.join(" · ")}` : ""}`,
|
|
42
|
+
color: W(e),
|
|
43
|
+
pulse: e.sla === "breached"
|
|
44
|
+
};
|
|
45
|
+
}),
|
|
46
|
+
[n]
|
|
47
|
+
), H = (e) => {
|
|
48
|
+
let t;
|
|
49
|
+
for (const a of e) {
|
|
50
|
+
const d = z.get(a.id);
|
|
51
|
+
d && (!t || D(d.sla) > D(t.sla)) && (t = d);
|
|
52
|
+
}
|
|
53
|
+
return t ? W(t) : e[0].color ?? m.ok;
|
|
54
|
+
}, O = g(() => {
|
|
55
|
+
const e = /* @__PURE__ */ new Map();
|
|
56
|
+
for (const t of (n == null ? void 0 : n.pins) ?? [])
|
|
57
|
+
t.state_key && !e.has(t.state_key) && e.set(t.state_key, {
|
|
58
|
+
key: t.state_key,
|
|
59
|
+
label: t.state ?? t.state_key,
|
|
60
|
+
color: t.state_color
|
|
61
|
+
});
|
|
62
|
+
return [...e.values()];
|
|
63
|
+
}, [n]), f = g(() => {
|
|
64
|
+
const e = [];
|
|
65
|
+
for (const [t, a] of ((c == null ? void 0 : c.people.regions) ?? []).entries())
|
|
66
|
+
a.lat == null || a.lng == null || a.count === 0 || e.push({
|
|
67
|
+
id: a.region_id != null ? `region:${a.region_id}` : `office:${t}`,
|
|
68
|
+
lat: a.lat,
|
|
69
|
+
lng: a.lng,
|
|
70
|
+
count: a.count,
|
|
71
|
+
label: `${a.label}${a.names.length ? ` — ${a.names.slice(0, 5).join(", ")}${a.names.length > 5 ? ` and ${a.names.length - 5} more` : ""}` : ""}`,
|
|
72
|
+
color: m.people
|
|
73
|
+
});
|
|
74
|
+
return e;
|
|
75
|
+
}, [c]), G = g(() => {
|
|
76
|
+
var t, a, d;
|
|
77
|
+
const e = [];
|
|
78
|
+
for (const s of ((t = C.data) == null ? void 0 : t.points) ?? [])
|
|
79
|
+
e.push({
|
|
80
|
+
id: `sla_heat:${s.id}`,
|
|
81
|
+
lat: s.lat,
|
|
82
|
+
lng: s.lng,
|
|
83
|
+
label: s.label,
|
|
84
|
+
weight: s.weight,
|
|
85
|
+
color: (s.weight ?? 0) >= 1 ? m.breached : m.warning
|
|
86
|
+
});
|
|
87
|
+
for (const s of ((a = L.data) == null ? void 0 : a.points) ?? [])
|
|
88
|
+
e.push({
|
|
89
|
+
id: `activity:${s.id}`,
|
|
90
|
+
lat: s.lat,
|
|
91
|
+
lng: s.lng,
|
|
92
|
+
label: s.label,
|
|
93
|
+
weight: s.weight,
|
|
94
|
+
color: m.activity
|
|
95
|
+
});
|
|
96
|
+
for (const s of ((d = M.data) == null ? void 0 : d.points) ?? [])
|
|
97
|
+
e.push({
|
|
98
|
+
id: `out_today:${s.id}`,
|
|
99
|
+
lat: s.lat,
|
|
100
|
+
lng: s.lng,
|
|
101
|
+
label: s.label,
|
|
102
|
+
weight: 0.5,
|
|
103
|
+
color: m.out
|
|
104
|
+
});
|
|
105
|
+
return e;
|
|
106
|
+
}, [C.data, L.data, M.data]), S = !!i, Y = S && u.length === 0, q = l.region && n && !n.region_applies ? " · region focus does not apply here" : "", J = ((T = u.find((e) => e.key === r)) == null ? void 0 : T.label) || j((r ?? "").replace(/_/g, " ")), P = _ && /* @__PURE__ */ o(
|
|
107
|
+
"button",
|
|
108
|
+
{
|
|
109
|
+
type: "button",
|
|
110
|
+
onClick: () => k(!0),
|
|
111
|
+
"aria-label": "Board settings",
|
|
112
|
+
"data-tip": "Board settings — map collections, regions, stuck days",
|
|
113
|
+
className: h("rounded-md p-1 text-[var(--cc-muted)] hover:bg-[var(--cc-chip)]", b),
|
|
114
|
+
children: /* @__PURE__ */ o(V, { className: "h-4 w-4" })
|
|
115
|
+
}
|
|
116
|
+
);
|
|
117
|
+
return Y ? /* @__PURE__ */ p("div", { className: `${E} flex flex-col overflow-hidden`, "data-cc-panel": "map", children: [
|
|
118
|
+
/* @__PURE__ */ p("div", { className: R, children: [
|
|
119
|
+
/* @__PURE__ */ o("h2", { className: I, children: "Live map" }),
|
|
120
|
+
P
|
|
121
|
+
] }),
|
|
122
|
+
/* @__PURE__ */ p("div", { className: "flex flex-1 flex-col items-center justify-center gap-2 px-6 py-10 text-center", children: [
|
|
123
|
+
/* @__PURE__ */ o(X, { className: "h-7 w-7 text-[var(--cc-faint)]", "aria-hidden": "true" }),
|
|
124
|
+
/* @__PURE__ */ o("p", { className: "text-[13px] font-semibold text-[var(--cc-strong)]", children: "Nothing to put on the map yet" }),
|
|
125
|
+
/* @__PURE__ */ o("p", { className: `max-w-[440px] text-[12px] leading-relaxed ${ae}`, children: "The map shows records from any collection that has a latitude and a longitude field — sites, offices, stores. Add those two number fields to a collection and fill them in, and its records appear here with their step and SLA. The rest of the board works without a map." }),
|
|
126
|
+
_ ? /* @__PURE__ */ o(
|
|
48
127
|
"button",
|
|
49
128
|
{
|
|
50
129
|
type: "button",
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
130
|
+
onClick: () => l.navigate("/collections"),
|
|
131
|
+
className: h(ne, b, "mt-1"),
|
|
132
|
+
children: "Open the data model"
|
|
133
|
+
}
|
|
134
|
+
) : /* @__PURE__ */ o("p", { className: `text-[11.5px] ${oe}`, children: "An administrator can add them." })
|
|
135
|
+
] }),
|
|
136
|
+
$ && /* @__PURE__ */ o(F, { onClose: () => k(!1) })
|
|
137
|
+
] }) : /* @__PURE__ */ p("div", { className: `${E} flex min-h-[420px] flex-col overflow-hidden`, "data-cc-panel": "map", children: [
|
|
138
|
+
/* @__PURE__ */ p("div", { className: h(R, "flex-wrap"), children: [
|
|
139
|
+
/* @__PURE__ */ o("h2", { className: I, children: "Live map" }),
|
|
140
|
+
/* @__PURE__ */ p("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
141
|
+
u.length > 1 && u.map((e) => /* @__PURE__ */ o(
|
|
142
|
+
"button",
|
|
143
|
+
{
|
|
144
|
+
type: "button",
|
|
145
|
+
"aria-pressed": r === e.key,
|
|
146
|
+
onClick: () => l.setMapCollection(e.key),
|
|
147
|
+
className: h(
|
|
148
|
+
"rounded px-2 py-0.5 text-[11px]",
|
|
149
|
+
b,
|
|
150
|
+
r === e.key ? "bg-nvr-cyan font-medium text-[#172940]" : "text-[var(--cc-muted)] hover:bg-[var(--cc-chip)]"
|
|
151
|
+
),
|
|
152
|
+
children: e.label || j(e.key.replace(/_/g, " "))
|
|
153
|
+
},
|
|
154
|
+
e.key
|
|
155
|
+
)),
|
|
156
|
+
/* @__PURE__ */ o("span", { className: "mx-1 h-4 w-px bg-[var(--cc-border)]", "aria-hidden": "true" }),
|
|
157
|
+
re.filter((e) => !(l.kiosk && e.kind === "out_today")).map((e) => {
|
|
158
|
+
const t = v.includes(e.kind);
|
|
159
|
+
return /* @__PURE__ */ o(
|
|
160
|
+
"button",
|
|
161
|
+
{
|
|
162
|
+
type: "button",
|
|
163
|
+
"aria-pressed": t,
|
|
164
|
+
onClick: () => Q((a) => t ? a.filter((d) => d !== e.kind) : [...a, e.kind]),
|
|
165
|
+
className: h(
|
|
166
|
+
"rounded-full border px-2 py-0.5 text-[11px]",
|
|
167
|
+
b,
|
|
168
|
+
t ? "border-nvr-cyan bg-nvr-cyan/15 font-medium text-[var(--cc-strong)]" : "border-[var(--cc-border)] text-[var(--cc-muted)] hover:bg-[var(--cc-chip)]"
|
|
169
|
+
),
|
|
170
|
+
children: e.label
|
|
171
|
+
},
|
|
172
|
+
e.kind
|
|
173
|
+
);
|
|
174
|
+
}),
|
|
175
|
+
/* @__PURE__ */ o(
|
|
176
|
+
"button",
|
|
177
|
+
{
|
|
178
|
+
type: "button",
|
|
179
|
+
"aria-pressed": x,
|
|
180
|
+
"aria-label": "Map key",
|
|
181
|
+
"data-tip": "What the colours mean",
|
|
182
|
+
onClick: () => U((e) => !e),
|
|
183
|
+
className: h(
|
|
184
|
+
"rounded-md p-1 text-[var(--cc-muted)] hover:bg-[var(--cc-chip)]",
|
|
185
|
+
b,
|
|
186
|
+
x && "bg-[var(--cc-chip)]"
|
|
187
|
+
),
|
|
188
|
+
children: /* @__PURE__ */ o(Z, { className: "h-4 w-4" })
|
|
189
|
+
}
|
|
190
|
+
),
|
|
191
|
+
P
|
|
192
|
+
] })
|
|
193
|
+
] }),
|
|
194
|
+
/* @__PURE__ */ o(le, { states: O, pins: (n == null ? void 0 : n.pins) ?? [] }),
|
|
195
|
+
/* @__PURE__ */ p("div", { className: "relative min-h-0 flex-1", children: [
|
|
196
|
+
/* @__PURE__ */ o(
|
|
197
|
+
ee,
|
|
198
|
+
{
|
|
199
|
+
pins: A,
|
|
200
|
+
bubbles: f,
|
|
201
|
+
dots: G,
|
|
202
|
+
focus: l.mapFocus,
|
|
203
|
+
clusterColor: H,
|
|
204
|
+
onPinClick: (e) => r && l.setPeek({ collection: r, id: e }),
|
|
205
|
+
onDotClick: (e) => {
|
|
206
|
+
const [t, a] = [e.slice(0, e.indexOf(":")), e.slice(e.indexOf(":") + 1)];
|
|
207
|
+
t !== "out_today" && r && l.setPeek({ collection: r, id: a });
|
|
208
|
+
},
|
|
209
|
+
onBubbleClick: (e) => {
|
|
210
|
+
const t = f.find((a) => a.id === e);
|
|
211
|
+
e.startsWith("region:") && !l.kiosk && l.setRegion(e.slice(7)), t && l.focusMap({ lat: t.lat, lng: t.lng, zoom: e.startsWith("region:") ? 8 : 12 });
|
|
212
|
+
},
|
|
213
|
+
statusLine: `${S ? `${A.length} ${J.toLowerCase()}${n != null && n.truncated ? " (the first ones only)" : ""}` : "Loading…"}${f.length > 0 ? ` · ${f.length} groups with people on` : ""}${q}${n != null && n.live_only ? " · live (the map does not rewind)" : ""} · © OpenStreetMap`,
|
|
214
|
+
minHeight: 380
|
|
215
|
+
}
|
|
216
|
+
),
|
|
217
|
+
x && /* @__PURE__ */ o("div", { className: "absolute bottom-8 right-3 z-[4]", children: /* @__PURE__ */ o(se, { states: O, layers: v, showPeople: f.length > 0 }) })
|
|
58
218
|
] }),
|
|
59
|
-
/* @__PURE__ */ o(
|
|
60
|
-
k,
|
|
61
|
-
{
|
|
62
|
-
pins: p,
|
|
63
|
-
bubbles: r,
|
|
64
|
-
focus: s.mapFocus,
|
|
65
|
-
onPinClick: (e) => l && s.setPeek({ collection: l, id: e }),
|
|
66
|
-
statusLine: `${i ? `${p.length} ${(l ?? "").replace(/_/g, " ")}${a != null && a.truncated ? " (first 500)" : ""}` : "No map collection"}${r.length > 0 ? ` · ${r.length} groups with people on` : ""} · © OpenStreetMap`,
|
|
67
|
-
minHeight: 380
|
|
68
|
-
}
|
|
69
|
-
) })
|
|
219
|
+
$ && /* @__PURE__ */ o(F, { onClose: () => k(!1) })
|
|
70
220
|
] });
|
|
71
221
|
}
|
|
72
222
|
export {
|
|
73
|
-
|
|
223
|
+
we as MapPanel
|
|
74
224
|
};
|
|
@@ -1,6 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { jsxs as n, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useCcQuery as i } from "../api.js";
|
|
3
|
+
import { useCc as h } from "../state.js";
|
|
4
|
+
import { PANEL as p, PANEL_HEAD as m, TITLE as x, FAINT as u, FOCUS as g } from "../theme.js";
|
|
5
|
+
import { LiveOnlyBadge as b } from "./TimeBar.js";
|
|
6
|
+
const f = {
|
|
7
|
+
ok: { glyph: "●", cls: "text-[var(--cc-good-text)]", word: "healthy" },
|
|
8
|
+
degraded: { glyph: "▲", cls: "text-[var(--cc-warn-text)]", word: "degraded" },
|
|
9
|
+
down: { glyph: "■", cls: "text-[var(--cc-bad-text)]", word: "failing" },
|
|
10
|
+
unknown: { glyph: "○", cls: "text-[var(--cc-faint)]", word: "no calls today" }
|
|
11
|
+
};
|
|
12
|
+
function $() {
|
|
13
|
+
var o;
|
|
14
|
+
const r = h(), s = r.isAdmin || !!((o = r.snapshot) != null && o.health), { data: l } = i("/partners", void 0, {
|
|
15
|
+
enabled: s,
|
|
16
|
+
refetchInterval: 6e4,
|
|
17
|
+
staleTime: 3e4
|
|
18
|
+
});
|
|
19
|
+
if (!s || !l || l.length === 0) return null;
|
|
20
|
+
const c = l.filter((e) => e.status === "down" || e.status === "degraded").length, d = (e) => r.navigate(e ?? "/integration-health?tab=partners");
|
|
21
|
+
return /* @__PURE__ */ n("section", { className: p, "data-cc-panel": "partners", "aria-label": "Partners", children: [
|
|
22
|
+
/* @__PURE__ */ n("div", { className: m, children: [
|
|
23
|
+
/* @__PURE__ */ t("h2", { className: x, children: "Partners" }),
|
|
24
|
+
/* @__PURE__ */ n("span", { className: "flex items-center gap-2", children: [
|
|
25
|
+
r.at != null && /* @__PURE__ */ t(b, {}),
|
|
26
|
+
/* @__PURE__ */ t("span", { className: `text-[11.5px] ${u}`, children: c === 0 ? "All healthy" : `${c} not healthy` })
|
|
27
|
+
] })
|
|
28
|
+
] }),
|
|
29
|
+
/* @__PURE__ */ t("ul", { className: "flex flex-wrap gap-1.5 p-2.5", children: l.map((e) => {
|
|
30
|
+
const a = f[e.status];
|
|
31
|
+
return /* @__PURE__ */ t("li", { children: /* @__PURE__ */ n(
|
|
32
|
+
"button",
|
|
33
|
+
{
|
|
34
|
+
type: "button",
|
|
35
|
+
onClick: () => d(e.href),
|
|
36
|
+
className: `flex items-center gap-1.5 rounded-full bg-[var(--cc-chip)] px-2 py-0.5 text-[11.5px] text-[var(--cc-text)] hover:bg-[var(--cc-chip-hover)] ${g}`,
|
|
37
|
+
"aria-label": `${e.label}: ${a.word}${e.open_problems ? `, ${e.open_problems} open problems` : ""}`,
|
|
38
|
+
"data-tip": e.last_ok_at ? `${a.word} · last worked ${new Date(e.last_ok_at).toLocaleString([], { month: "short", day: "numeric", hour: "numeric", minute: "2-digit" })}` : a.word,
|
|
39
|
+
children: [
|
|
40
|
+
/* @__PURE__ */ t("span", { "aria-hidden": !0, className: `text-[10px] ${a.cls}`, children: a.glyph }),
|
|
41
|
+
/* @__PURE__ */ t("span", { className: "max-w-[140px] truncate", children: e.label }),
|
|
42
|
+
e.open_problems > 0 && /* @__PURE__ */ t("span", { className: "rounded-full bg-red-500/15 px-1.5 text-[10.5px] font-semibold tabular-nums text-[var(--cc-bad-text)]", children: e.open_problems })
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
) }, e.key);
|
|
46
|
+
}) })
|
|
47
|
+
] });
|
|
3
48
|
}
|
|
4
49
|
export {
|
|
5
|
-
|
|
50
|
+
f as PARTNER_STATUS,
|
|
51
|
+
$ as PartnersPanel
|
|
6
52
|
};
|
|
@@ -1,47 +1,265 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { jsxs as l, jsx as n, Fragment as w } from "react/jsx-runtime";
|
|
2
|
+
import { useMutation as y } from "@tanstack/react-query";
|
|
3
|
+
import { ChevronRight as C, LocateFixed as k, MessageSquare as S, Footprints as M } from "lucide-react";
|
|
4
|
+
import { useState as v } from "react";
|
|
5
|
+
import { toast as P } from "sonner";
|
|
6
|
+
import { useNivaroClient as A } from "../../../context.js";
|
|
7
|
+
import { post as T } from "../../../lib/commands.js";
|
|
8
|
+
import { toastError as E } from "../../../lib/error-toast.js";
|
|
9
|
+
import { cn as i } from "../../../lib/utils.js";
|
|
10
|
+
import { UserChip as F } from "../../item-edit/UserChip.js";
|
|
11
|
+
import { useCc as N } from "../state.js";
|
|
12
|
+
import { PANEL as O, PANEL_HEAD as I, TITLE as L, FAINT as f, FOCUS as m, BUTTON as $, MUTED as z } from "../theme.js";
|
|
13
|
+
const U = 50;
|
|
14
|
+
function ee() {
|
|
15
|
+
const e = N(), t = e.snapshot, o = (t == null ? void 0 : t.people.regions) ?? [], [s, b] = v(/* @__PURE__ */ new Set()), u = (a) => `${a.region_id ?? "x"}:${a.label}`, d = (a) => b((c) => {
|
|
16
|
+
const p = new Set(c);
|
|
17
|
+
return p.has(a) ? p.delete(a) : p.add(a), p;
|
|
18
|
+
}), h = e.region && (t == null ? void 0 : t.people.region_applies) === !1;
|
|
19
|
+
return /* @__PURE__ */ l("section", { className: O, "data-cc-panel": "people", "aria-labelledby": "cc-people-title", children: [
|
|
20
|
+
/* @__PURE__ */ l("div", { className: I, children: [
|
|
21
|
+
/* @__PURE__ */ n("h2", { id: "cc-people-title", className: L, children: "People on now" }),
|
|
22
|
+
/* @__PURE__ */ l("span", { className: `text-[11px] tabular-nums ${f}`, children: [
|
|
23
|
+
(t == null ? void 0 : t.people.online_count) ?? 0,
|
|
24
|
+
" online",
|
|
25
|
+
t && t.people.idle_count > 0 ? ` · ${t.people.idle_count} idle` : ""
|
|
26
|
+
] })
|
|
11
27
|
] }),
|
|
12
|
-
/* @__PURE__ */
|
|
13
|
-
p
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"button",
|
|
18
|
-
{
|
|
19
|
-
type: "button",
|
|
20
|
-
disabled: !t,
|
|
21
|
-
onClick: () => t && r.focusMap(t),
|
|
22
|
-
className: `flex w-full items-center gap-1.5 text-left ${t ? "group cursor-pointer" : "cursor-default"}`,
|
|
23
|
-
"data-tip": t ? "Show this group on the map" : "No map placement for this group",
|
|
24
|
-
children: [
|
|
25
|
-
/* @__PURE__ */ l("span", { className: "h-2.5 w-2.5 rounded-full bg-[var(--cc-people)]" }),
|
|
26
|
-
/* @__PURE__ */ l("span", { className: "text-[12px] font-semibold text-[var(--cc-people-text)] group-hover:underline", children: e.label }),
|
|
27
|
-
/* @__PURE__ */ l("span", { className: `text-[11px] tabular-nums ${c}`, children: e.count })
|
|
28
|
-
]
|
|
29
|
-
}
|
|
30
|
-
),
|
|
31
|
-
/* @__PURE__ */ l("div", { className: "mt-1 flex flex-wrap gap-1.5 pl-4", children: e.names.map((a) => /* @__PURE__ */ l(
|
|
32
|
-
"span",
|
|
33
|
-
{
|
|
34
|
-
className: "rounded-full bg-[var(--cc-chip)] px-2 py-0.5 text-[11.5px] text-[var(--cc-text)]",
|
|
35
|
-
children: a
|
|
36
|
-
},
|
|
37
|
-
a
|
|
38
|
-
)) })
|
|
39
|
-
] }, `${e.region_id ?? "x"}:${e.label}`);
|
|
28
|
+
/* @__PURE__ */ l("div", { className: "space-y-1 p-2", children: [
|
|
29
|
+
h && /* @__PURE__ */ n("p", { className: `px-1 pb-1 text-[11px] ${f}`, children: "People are not placed in regions here — showing everyone." }),
|
|
30
|
+
o.map((a) => {
|
|
31
|
+
const c = u(a);
|
|
32
|
+
return /* @__PURE__ */ n(j, { group: a, expanded: s.has(c), onToggle: () => d(c) }, c);
|
|
40
33
|
}),
|
|
41
|
-
|
|
34
|
+
t && o.length === 0 && /* @__PURE__ */ n("p", { className: `px-1 text-[12px] ${f}`, children: "Nobody online right now." }),
|
|
35
|
+
!t && /* @__PURE__ */ n("p", { className: `px-1 text-[12px] ${f}`, children: "Loading…" })
|
|
36
|
+
] })
|
|
37
|
+
] });
|
|
38
|
+
}
|
|
39
|
+
function j({
|
|
40
|
+
group: e,
|
|
41
|
+
expanded: t,
|
|
42
|
+
onToggle: o
|
|
43
|
+
}) {
|
|
44
|
+
var x, g;
|
|
45
|
+
const s = N(), [b, u] = v(!1), d = e.region_id != null ? (x = s.config) == null ? void 0 : x.regions.find((r) => String(r.id) === String(e.region_id)) : null, h = e.lat != null && e.lng != null ? { lat: e.lat, lng: e.lng, zoom: e.region_id != null ? 8 : 12 } : (d == null ? void 0 : d.lat) != null && d.lng != null ? { lat: d.lat, lng: d.lng, zoom: 8 } : null, a = e.people ?? e.names.map((r, _) => ({
|
|
46
|
+
user_id: `${_}`,
|
|
47
|
+
name: r,
|
|
48
|
+
idle: !1,
|
|
49
|
+
page_label: null,
|
|
50
|
+
record: null
|
|
51
|
+
})), c = s.isAdmin && !s.kiosk && !!((g = e.people) != null && g.length), p = `cc-people-${(e.region_id ?? e.label).toString().replace(/[^A-Za-z0-9_-]/g, "_")}`;
|
|
52
|
+
return /* @__PURE__ */ l("div", { className: "rounded-md", children: [
|
|
53
|
+
/* @__PURE__ */ l("div", { className: "flex items-center gap-1", children: [
|
|
54
|
+
/* @__PURE__ */ l(
|
|
55
|
+
"button",
|
|
56
|
+
{
|
|
57
|
+
type: "button",
|
|
58
|
+
"aria-expanded": t,
|
|
59
|
+
"aria-controls": p,
|
|
60
|
+
onClick: o,
|
|
61
|
+
className: i(
|
|
62
|
+
"flex min-w-0 flex-1 items-center gap-1.5 rounded-md px-1 py-1 text-left hover:bg-[var(--cc-chip)]",
|
|
63
|
+
m
|
|
64
|
+
),
|
|
65
|
+
children: [
|
|
66
|
+
/* @__PURE__ */ n(
|
|
67
|
+
C,
|
|
68
|
+
{
|
|
69
|
+
className: i(
|
|
70
|
+
"h-3.5 w-3.5 shrink-0 text-[var(--cc-faint)] motion-safe:transition-transform",
|
|
71
|
+
t && "rotate-90"
|
|
72
|
+
),
|
|
73
|
+
"aria-hidden": "true"
|
|
74
|
+
}
|
|
75
|
+
),
|
|
76
|
+
/* @__PURE__ */ n(
|
|
77
|
+
"span",
|
|
78
|
+
{
|
|
79
|
+
className: "h-2.5 w-2.5 shrink-0 rounded-full bg-[var(--cc-people)]",
|
|
80
|
+
"aria-hidden": "true"
|
|
81
|
+
}
|
|
82
|
+
),
|
|
83
|
+
/* @__PURE__ */ n("span", { className: "truncate text-[12px] font-semibold text-[var(--cc-people-text)]", children: e.label }),
|
|
84
|
+
/* @__PURE__ */ n("span", { className: `text-[11px] tabular-nums ${f}`, children: e.count })
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
),
|
|
88
|
+
h && /* @__PURE__ */ n(
|
|
89
|
+
"button",
|
|
90
|
+
{
|
|
91
|
+
type: "button",
|
|
92
|
+
onClick: () => s.focusMap(h),
|
|
93
|
+
"aria-label": `Show ${e.label} on the map`,
|
|
94
|
+
"data-tip": "Show on the map",
|
|
95
|
+
className: i(
|
|
96
|
+
"rounded p-1 text-[var(--cc-faint)] hover:bg-[var(--cc-chip)] hover:text-[var(--cc-text)]",
|
|
97
|
+
m
|
|
98
|
+
),
|
|
99
|
+
children: /* @__PURE__ */ n(k, { className: "h-3.5 w-3.5" })
|
|
100
|
+
}
|
|
101
|
+
),
|
|
102
|
+
c && /* @__PURE__ */ n(
|
|
103
|
+
"button",
|
|
104
|
+
{
|
|
105
|
+
type: "button",
|
|
106
|
+
onClick: () => u((r) => !r),
|
|
107
|
+
"aria-label": `Message the people in ${e.label}`,
|
|
108
|
+
"data-tip": "Message these people",
|
|
109
|
+
className: i(
|
|
110
|
+
"rounded p-1 text-[var(--cc-faint)] hover:bg-[var(--cc-chip)] hover:text-[var(--cc-text)]",
|
|
111
|
+
m
|
|
112
|
+
),
|
|
113
|
+
children: /* @__PURE__ */ n(S, { className: "h-3.5 w-3.5" })
|
|
114
|
+
}
|
|
115
|
+
)
|
|
116
|
+
] }),
|
|
117
|
+
b && c && /* @__PURE__ */ n(
|
|
118
|
+
q,
|
|
119
|
+
{
|
|
120
|
+
label: e.label,
|
|
121
|
+
ids: (e.people ?? []).map((r) => r.user_id).slice(0, U),
|
|
122
|
+
total: e.count,
|
|
123
|
+
onDone: () => u(!1)
|
|
124
|
+
}
|
|
125
|
+
),
|
|
126
|
+
t && /* @__PURE__ */ l("ul", { id: p, className: "mb-1 ml-5 mt-0.5 space-y-0.5", children: [
|
|
127
|
+
a.map((r) => /* @__PURE__ */ n(R, { p: r, real: !!e.people }, r.user_id)),
|
|
128
|
+
e.count > a.length && /* @__PURE__ */ l("li", { className: `px-1 text-[11px] ${f}`, children: [
|
|
129
|
+
"and ",
|
|
130
|
+
e.count - a.length,
|
|
131
|
+
" more"
|
|
132
|
+
] })
|
|
133
|
+
] })
|
|
134
|
+
] });
|
|
135
|
+
}
|
|
136
|
+
function R({ p: e, real: t }) {
|
|
137
|
+
const o = N(), s = /* @__PURE__ */ n(
|
|
138
|
+
"button",
|
|
139
|
+
{
|
|
140
|
+
type: "button",
|
|
141
|
+
className: i(
|
|
142
|
+
"truncate rounded text-left text-[12px] font-medium text-[var(--cc-text)] hover:underline",
|
|
143
|
+
m
|
|
144
|
+
),
|
|
145
|
+
"aria-label": `${e.name} — open their card`,
|
|
146
|
+
children: e.name
|
|
147
|
+
}
|
|
148
|
+
);
|
|
149
|
+
return /* @__PURE__ */ l("li", { className: "flex items-start gap-1.5 rounded px-1 py-0.5", children: [
|
|
150
|
+
/* @__PURE__ */ n(
|
|
151
|
+
"span",
|
|
152
|
+
{
|
|
153
|
+
className: i(
|
|
154
|
+
"mt-[5px] h-2 w-2 shrink-0 rounded-full",
|
|
155
|
+
e.idle ? "bg-[var(--cc-faint)]" : "bg-[var(--cc-people)]"
|
|
156
|
+
),
|
|
157
|
+
"aria-hidden": "true"
|
|
158
|
+
}
|
|
159
|
+
),
|
|
160
|
+
/* @__PURE__ */ l("div", { className: "min-w-0 flex-1", children: [
|
|
161
|
+
/* @__PURE__ */ l("div", { className: "flex items-center gap-1.5", children: [
|
|
162
|
+
t && !o.kiosk ? /* @__PURE__ */ n(F, { userId: e.user_id, children: s }) : /* @__PURE__ */ n("span", { className: "truncate text-[12px] font-medium", children: e.name }),
|
|
163
|
+
/* @__PURE__ */ n("span", { className: `text-[10.5px] ${f}`, children: e.idle ? "idle" : "active" }),
|
|
164
|
+
t && o.isAdmin && !o.kiosk && /* @__PURE__ */ n(
|
|
165
|
+
"button",
|
|
166
|
+
{
|
|
167
|
+
type: "button",
|
|
168
|
+
onClick: () => o.navigate(`/traffic-map?follow=${encodeURIComponent(e.user_id)}`),
|
|
169
|
+
"aria-label": `Follow ${e.name} in the Traffic Map`,
|
|
170
|
+
"data-tip": "Follow in Traffic Map",
|
|
171
|
+
className: i(
|
|
172
|
+
"ml-auto rounded p-0.5 text-[var(--cc-faint)] hover:bg-[var(--cc-chip)] hover:text-[var(--cc-text)]",
|
|
173
|
+
m
|
|
174
|
+
),
|
|
175
|
+
children: /* @__PURE__ */ n(M, { className: "h-3 w-3" })
|
|
176
|
+
}
|
|
177
|
+
)
|
|
178
|
+
] }),
|
|
179
|
+
(e.record || e.page_label) && /* @__PURE__ */ n("p", { className: `truncate text-[11px] ${z}`, children: e.record ? /* @__PURE__ */ l(
|
|
180
|
+
"button",
|
|
181
|
+
{
|
|
182
|
+
type: "button",
|
|
183
|
+
onClick: () => e.record && o.setPeek({ collection: e.record.collection, id: e.record.id }),
|
|
184
|
+
className: i("truncate rounded text-left hover:underline", m),
|
|
185
|
+
"aria-label": `On ${e.record.label} — preview it`,
|
|
186
|
+
children: [
|
|
187
|
+
"On ",
|
|
188
|
+
e.record.label
|
|
189
|
+
]
|
|
190
|
+
}
|
|
191
|
+
) : /* @__PURE__ */ l(w, { children: [
|
|
192
|
+
"On ",
|
|
193
|
+
e.page_label
|
|
194
|
+
] }) })
|
|
195
|
+
] })
|
|
196
|
+
] });
|
|
197
|
+
}
|
|
198
|
+
function q({
|
|
199
|
+
label: e,
|
|
200
|
+
ids: t,
|
|
201
|
+
total: o,
|
|
202
|
+
onDone: s
|
|
203
|
+
}) {
|
|
204
|
+
const b = A(), [u, d] = v(""), [h, a] = v(!1), c = y({
|
|
205
|
+
mutationFn: () => b.request(
|
|
206
|
+
T("/command-center/people/message", { user_ids: t, message: u.trim() })
|
|
207
|
+
),
|
|
208
|
+
onSuccess: (x) => {
|
|
209
|
+
var r;
|
|
210
|
+
const g = ((r = x.data) == null ? void 0 : r.sent) ?? t.length;
|
|
211
|
+
P.success(`Sent to ${g} ${g === 1 ? "person" : "people"}`), s();
|
|
212
|
+
},
|
|
213
|
+
onError: (x) => {
|
|
214
|
+
a(!1), E(x, "Message not sent");
|
|
215
|
+
}
|
|
216
|
+
}), p = `cc-msg-${e.replace(/[^A-Za-z0-9_-]/g, "_")}`;
|
|
217
|
+
return /* @__PURE__ */ l("div", { className: "mb-1.5 ml-5 mt-1 space-y-1.5 rounded-md border border-[var(--cc-border)] p-2", children: [
|
|
218
|
+
/* @__PURE__ */ l("label", { htmlFor: p, className: `block text-[11px] ${f}`, children: [
|
|
219
|
+
"One in-app message to each of ",
|
|
220
|
+
t.length,
|
|
221
|
+
" ",
|
|
222
|
+
t.length === 1 ? "person" : "people",
|
|
223
|
+
" in",
|
|
224
|
+
" ",
|
|
225
|
+
e,
|
|
226
|
+
o > t.length ? ` (the first ${t.length} of ${o})` : ""
|
|
227
|
+
] }),
|
|
228
|
+
/* @__PURE__ */ n(
|
|
229
|
+
"textarea",
|
|
230
|
+
{
|
|
231
|
+
id: p,
|
|
232
|
+
value: u,
|
|
233
|
+
maxLength: 1e3,
|
|
234
|
+
rows: 3,
|
|
235
|
+
onChange: (x) => {
|
|
236
|
+
d(x.target.value), a(!1);
|
|
237
|
+
},
|
|
238
|
+
className: i(
|
|
239
|
+
"w-full resize-y rounded-md border border-[var(--cc-border)] bg-[var(--cc-panel)] px-2 py-1 text-[12px] text-[var(--cc-text)]",
|
|
240
|
+
m
|
|
241
|
+
)
|
|
242
|
+
}
|
|
243
|
+
),
|
|
244
|
+
/* @__PURE__ */ l("div", { className: "flex items-center justify-end gap-1.5", children: [
|
|
245
|
+
/* @__PURE__ */ n("button", { type: "button", onClick: s, className: i($, m), children: "Cancel" }),
|
|
246
|
+
/* @__PURE__ */ n(
|
|
247
|
+
"button",
|
|
248
|
+
{
|
|
249
|
+
type: "button",
|
|
250
|
+
disabled: !u.trim() || c.isPending,
|
|
251
|
+
onClick: () => h ? c.mutate() : a(!0),
|
|
252
|
+
className: i(
|
|
253
|
+
$,
|
|
254
|
+
m,
|
|
255
|
+
h && "border-nvr-cyan bg-nvr-cyan text-white hover:bg-nvr-cyan"
|
|
256
|
+
),
|
|
257
|
+
children: c.isPending ? "Sending…" : h ? `Confirm — send to ${t.length}` : "Send"
|
|
258
|
+
}
|
|
259
|
+
)
|
|
42
260
|
] })
|
|
43
261
|
] });
|
|
44
262
|
}
|
|
45
263
|
export {
|
|
46
|
-
|
|
264
|
+
ee as PeoplePanel
|
|
47
265
|
};
|