@nivaro/react 0.3.46 → 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 +248 -16
- package/dist/index.js +679 -659
- 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/PeekPanel.js +33 -32
- package/dist/shared/components/command-center/panels/BoardSettings.js +41 -40
- package/dist/shared/components/command-center/panels/PeoplePanel.js +32 -31
- 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/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,24 +1,25 @@
|
|
|
1
1
|
import { jsxs as l, jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { ExternalLink as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { toast as
|
|
2
|
+
import { useQueryClient as g, useMutation as y } from "@tanstack/react-query";
|
|
3
|
+
import { ExternalLink as k } from "lucide-react";
|
|
4
|
+
import { useState as C, useEffect as w } from "react";
|
|
5
|
+
import { toast as $ } from "sonner";
|
|
6
6
|
import { useNivaroClient as P } from "../../context.js";
|
|
7
7
|
import { post as T } from "../../lib/commands.js";
|
|
8
|
+
import { toastError as E } from "../../lib/error-toast.js";
|
|
8
9
|
import { cn as p } from "../../lib/utils.js";
|
|
9
10
|
import { useCcQuery as S } from "./api.js";
|
|
10
|
-
import { CcSidePanel as
|
|
11
|
-
import { useCc as
|
|
12
|
-
import { MUTED as u, FOCUS as
|
|
13
|
-
function
|
|
14
|
-
var
|
|
15
|
-
const e =
|
|
11
|
+
import { CcSidePanel as U, slaWords as A } from "./panels/map-shared.js";
|
|
12
|
+
import { useCc as M } from "./state.js";
|
|
13
|
+
import { MUTED as u, FOCUS as b, BUTTON as v, FAINT as d } from "./theme.js";
|
|
14
|
+
function H() {
|
|
15
|
+
var i;
|
|
16
|
+
const e = M(), s = e.peek, m = () => e.setPeek(null), r = S(
|
|
16
17
|
"/peek",
|
|
17
18
|
s ? { collection: s.collection, id: s.id } : {},
|
|
18
19
|
{ enabled: !!s, lenses: !1, retry: !1, staleTime: 15e3 }
|
|
19
|
-
), a =
|
|
20
|
+
), a = r.data, o = r.isError && ((i = r.error) == null ? void 0 : i.status) === 404;
|
|
20
21
|
return /* @__PURE__ */ l(
|
|
21
|
-
|
|
22
|
+
U,
|
|
22
23
|
{
|
|
23
24
|
peek: !0,
|
|
24
25
|
open: !!s,
|
|
@@ -33,23 +34,23 @@ function z() {
|
|
|
33
34
|
onClick: () => {
|
|
34
35
|
e.navigate(e.recordUrl(a.collection, a.id)), m();
|
|
35
36
|
},
|
|
36
|
-
className: p(
|
|
37
|
+
className: p(v, b, "inline-flex items-center gap-1.5"),
|
|
37
38
|
children: [
|
|
38
|
-
/* @__PURE__ */ n(
|
|
39
|
+
/* @__PURE__ */ n(k, { className: "h-3.5 w-3.5", "aria-hidden": "true" }),
|
|
39
40
|
" Open full record"
|
|
40
41
|
]
|
|
41
42
|
}
|
|
42
43
|
),
|
|
43
44
|
children: [
|
|
44
|
-
|
|
45
|
+
r.isLoading && /* @__PURE__ */ n(q, {}),
|
|
45
46
|
o && /* @__PURE__ */ n("p", { className: `text-[12px] ${u}`, children: "This record is not there any more, or you do not have access to it." }),
|
|
46
|
-
|
|
47
|
-
a && /* @__PURE__ */ n(
|
|
47
|
+
r.isError && !o && /* @__PURE__ */ n("p", { className: "text-[12px] text-[var(--cc-bad-text)]", children: "Could not load this record." }),
|
|
48
|
+
a && /* @__PURE__ */ n(F, { rec: a, canAct: !e.kiosk })
|
|
48
49
|
]
|
|
49
50
|
}
|
|
50
51
|
);
|
|
51
52
|
}
|
|
52
|
-
function
|
|
53
|
+
function q() {
|
|
53
54
|
return /* @__PURE__ */ n("div", { className: "space-y-2", "aria-hidden": "true", children: [70, 45, 90, 60].map((e) => /* @__PURE__ */ n(
|
|
54
55
|
"div",
|
|
55
56
|
{
|
|
@@ -59,14 +60,14 @@ function M() {
|
|
|
59
60
|
e
|
|
60
61
|
)) });
|
|
61
62
|
}
|
|
62
|
-
function
|
|
63
|
-
const m = P(),
|
|
64
|
-
|
|
63
|
+
function F({ rec: e, canAct: s }) {
|
|
64
|
+
const m = P(), r = g(), [a, o] = C(null);
|
|
65
|
+
w(() => {
|
|
65
66
|
if (!a) return;
|
|
66
67
|
const t = setTimeout(() => o(null), 6e3);
|
|
67
68
|
return () => clearTimeout(t);
|
|
68
69
|
}, [a]);
|
|
69
|
-
const
|
|
70
|
+
const i = y({
|
|
70
71
|
mutationFn: (t) => m.request(
|
|
71
72
|
T(
|
|
72
73
|
`/pipelines/instance/${encodeURIComponent(e.collection)}/${encodeURIComponent(e.id)}/transition`,
|
|
@@ -75,13 +76,13 @@ function q({ rec: e, canAct: s }) {
|
|
|
75
76
|
),
|
|
76
77
|
onSuccess: (t, c) => {
|
|
77
78
|
var f;
|
|
78
|
-
const
|
|
79
|
-
|
|
79
|
+
const x = ((f = e.transitions.find((N) => N.key === c)) == null ? void 0 : f.label) ?? "Moved";
|
|
80
|
+
$.success(`${x} — done`), o(null), r.invalidateQueries({ queryKey: ["command-center"] });
|
|
80
81
|
},
|
|
81
82
|
onError: (t) => {
|
|
82
|
-
o(null),
|
|
83
|
+
o(null), E(t, "That move did not go through");
|
|
83
84
|
}
|
|
84
|
-
}), h =
|
|
85
|
+
}), h = A(e.sla);
|
|
85
86
|
return /* @__PURE__ */ l("div", { className: "space-y-4 text-[12px]", children: [
|
|
86
87
|
/* @__PURE__ */ l("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
87
88
|
e.state && /* @__PURE__ */ l("span", { className: "inline-flex items-center gap-1.5 rounded-full bg-[var(--cc-chip)] px-2 py-0.5", children: [
|
|
@@ -124,23 +125,23 @@ function q({ rec: e, canAct: s }) {
|
|
|
124
125
|
"button",
|
|
125
126
|
{
|
|
126
127
|
type: "button",
|
|
127
|
-
disabled:
|
|
128
|
-
onClick: () => c ?
|
|
128
|
+
disabled: i.isPending,
|
|
129
|
+
onClick: () => c ? i.mutate(t.key) : o(t.key),
|
|
129
130
|
"aria-label": c ? `Confirm: ${t.label}` : t.label,
|
|
130
131
|
className: p(
|
|
131
|
-
x,
|
|
132
132
|
v,
|
|
133
|
+
b,
|
|
133
134
|
c && "border-nvr-cyan bg-nvr-cyan text-white hover:bg-nvr-cyan"
|
|
134
135
|
),
|
|
135
|
-
children:
|
|
136
|
+
children: i.isPending && c ? "Moving…" : c ? `Confirm ${t.label}` : t.label
|
|
136
137
|
},
|
|
137
138
|
t.key
|
|
138
139
|
);
|
|
139
140
|
}) }),
|
|
140
|
-
a && !
|
|
141
|
+
a && !i.isPending && /* @__PURE__ */ n("p", { className: `mt-1.5 ${d}`, role: "status", children: "Click again to confirm. Some moves ask for more on the full record." })
|
|
141
142
|
] })
|
|
142
143
|
] });
|
|
143
144
|
}
|
|
144
145
|
export {
|
|
145
|
-
|
|
146
|
+
H as PeekPanel
|
|
146
147
|
};
|
|
@@ -1,30 +1,31 @@
|
|
|
1
1
|
import { jsxs as o, jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { useState as C, useEffect as
|
|
4
|
-
import { toast as
|
|
5
|
-
import { useNivaroClient as
|
|
2
|
+
import { useQueryClient as M, useMutation as P } from "@tanstack/react-query";
|
|
3
|
+
import { useState as C, useEffect as B } from "react";
|
|
4
|
+
import { toast as w } from "sonner";
|
|
5
|
+
import { useNivaroClient as D } from "../../../context.js";
|
|
6
6
|
import { put as I } from "../../../lib/commands.js";
|
|
7
|
+
import { toastError as U } from "../../../lib/error-toast.js";
|
|
7
8
|
import { cn as a } from "../../../lib/utils.js";
|
|
8
|
-
import { useCcQuery as
|
|
9
|
-
import { MUTED as
|
|
10
|
-
import { CcSidePanel as
|
|
11
|
-
const
|
|
12
|
-
function
|
|
13
|
-
const u =
|
|
9
|
+
import { useCcQuery as _ } from "../api.js";
|
|
10
|
+
import { MUTED as S, FAINT as i, FOCUS as l, BUTTON as q } from "../theme.js";
|
|
11
|
+
import { CcSidePanel as A } from "./map-shared.js";
|
|
12
|
+
const G = (d, u) => JSON.stringify(d) === JSON.stringify(u);
|
|
13
|
+
function Y({ onClose: d }) {
|
|
14
|
+
const u = D(), O = M(), p = _("/config/candidates", void 0, {
|
|
14
15
|
lenses: !1,
|
|
15
16
|
staleTime: 0
|
|
16
|
-
}), c = p.data, [h, f] = C(null), [t, m] = C(null), [g,
|
|
17
|
-
|
|
18
|
-
c && (f((e) => e ?? c.config.geo_collections),
|
|
17
|
+
}), c = p.data, [h, f] = C(null), [t, m] = C(null), [g, $] = C("");
|
|
18
|
+
B(() => {
|
|
19
|
+
c && (f((e) => e ?? c.config.geo_collections), $((e) => e || String(c.config.stuck_days)), m((e) => {
|
|
19
20
|
if (e) return e;
|
|
20
21
|
const s = c.config.region;
|
|
21
22
|
if (s === !1) return { mode: "none" };
|
|
22
23
|
if (!s) return { mode: "auto" };
|
|
23
|
-
const
|
|
24
|
-
return
|
|
24
|
+
const r = c.regions.findIndex((k) => G(k.source, s));
|
|
25
|
+
return r >= 0 ? { mode: "source", index: r } : { mode: "auto" };
|
|
25
26
|
}));
|
|
26
27
|
}, [c]);
|
|
27
|
-
const b =
|
|
28
|
+
const b = P({
|
|
28
29
|
mutationFn: () => {
|
|
29
30
|
var s;
|
|
30
31
|
const e = Math.round(Number(g));
|
|
@@ -37,21 +38,21 @@ function V({ onClose: d }) {
|
|
|
37
38
|
);
|
|
38
39
|
},
|
|
39
40
|
onSuccess: () => {
|
|
40
|
-
|
|
41
|
+
w.success("Board settings saved"), O.invalidateQueries({ queryKey: ["command-center"] }), d();
|
|
41
42
|
},
|
|
42
43
|
onError: (e) => {
|
|
43
44
|
const s = e;
|
|
44
|
-
s.code === "MIGRATION_PENDING" || s.status === 409 ?
|
|
45
|
+
s.code === "MIGRATION_PENDING" || s.status === 409 ? w.error("These settings can be saved once this instance finishes its update.") : U(e, "Could not save the board settings", { action: "Save board settings" });
|
|
45
46
|
}
|
|
46
|
-
}), N = c == null ? void 0 : c.regions.find((e) => e.suggested), T = (h ?? []).length === 0,
|
|
47
|
-
const
|
|
48
|
-
return
|
|
49
|
-
}),
|
|
47
|
+
}), N = c == null ? void 0 : c.regions.find((e) => e.suggested), T = (h ?? []).length === 0, E = (e) => f((s) => {
|
|
48
|
+
const r = s ?? [];
|
|
49
|
+
return r.includes(e) ? r.filter((k) => k !== e) : [...r, e];
|
|
50
|
+
}), F = (e) => f((s) => [e, ...(s ?? []).filter((r) => r !== e)]), x = Number(g), y = Number.isFinite(x) && x >= 1 && x <= 365, v = (e) => a(
|
|
50
51
|
"flex w-full cursor-pointer items-start gap-2 rounded-md border px-2.5 py-2 text-left",
|
|
51
52
|
e ? "border-nvr-cyan bg-nvr-cyan/10" : "border-[var(--cc-border)] hover:bg-[var(--cc-chip)]"
|
|
52
53
|
);
|
|
53
54
|
return /* @__PURE__ */ o(
|
|
54
|
-
|
|
55
|
+
A,
|
|
55
56
|
{
|
|
56
57
|
open: !0,
|
|
57
58
|
label: "Board settings",
|
|
@@ -60,7 +61,7 @@ function V({ onClose: d }) {
|
|
|
60
61
|
onClose: d,
|
|
61
62
|
width: 460,
|
|
62
63
|
footer: /* @__PURE__ */ o("div", { className: "flex items-center justify-end gap-2", children: [
|
|
63
|
-
/* @__PURE__ */ n("button", { type: "button", onClick: d, className: a(
|
|
64
|
+
/* @__PURE__ */ n("button", { type: "button", onClick: d, className: a(q, l), children: "Cancel" }),
|
|
64
65
|
/* @__PURE__ */ n(
|
|
65
66
|
"button",
|
|
66
67
|
{
|
|
@@ -76,13 +77,13 @@ function V({ onClose: d }) {
|
|
|
76
77
|
)
|
|
77
78
|
] }),
|
|
78
79
|
children: [
|
|
79
|
-
p.isLoading && /* @__PURE__ */ n("p", { className: `text-[12px] ${
|
|
80
|
+
p.isLoading && /* @__PURE__ */ n("p", { className: `text-[12px] ${S}`, children: "Looking at the data model…" }),
|
|
80
81
|
p.isError && /* @__PURE__ */ n("p", { className: "text-[12px] text-[var(--cc-bad-text)]", children: "Could not load the choices." }),
|
|
81
82
|
c && /* @__PURE__ */ o("div", { className: "space-y-5 text-[12px]", children: [
|
|
82
83
|
/* @__PURE__ */ o("section", { "aria-labelledby": "cc-set-map", children: [
|
|
83
84
|
/* @__PURE__ */ n("h3", { id: "cc-set-map", className: "mb-1 font-semibold text-[var(--cc-strong)]", children: "Map collections" }),
|
|
84
|
-
/* @__PURE__ */ n("p", { className: `mb-2 ${
|
|
85
|
-
c.geo.length === 0 && /* @__PURE__ */ n("p", { className:
|
|
85
|
+
/* @__PURE__ */ n("p", { className: `mb-2 ${i}`, children: "Collections with a latitude and longitude field. Pick the ones to offer on the map; the first is shown by default. Pick none to offer every one found." }),
|
|
86
|
+
c.geo.length === 0 && /* @__PURE__ */ n("p", { className: S, children: "No collection has latitude and longitude fields yet." }),
|
|
86
87
|
/* @__PURE__ */ n("ul", { className: "space-y-1", children: c.geo.map((e) => {
|
|
87
88
|
const s = (h ?? []).indexOf(e.key);
|
|
88
89
|
return /* @__PURE__ */ o("li", { className: "flex items-center gap-2", children: [
|
|
@@ -92,21 +93,21 @@ function V({ onClose: d }) {
|
|
|
92
93
|
{
|
|
93
94
|
type: "checkbox",
|
|
94
95
|
checked: s >= 0,
|
|
95
|
-
onChange: () =>
|
|
96
|
+
onChange: () => E(e.key),
|
|
96
97
|
className: a("h-3.5 w-3.5 accent-[#00a5cc]", l)
|
|
97
98
|
}
|
|
98
99
|
),
|
|
99
100
|
/* @__PURE__ */ n("span", { children: e.label })
|
|
100
101
|
] }),
|
|
101
|
-
s === 0 && /* @__PURE__ */ n("span", { className: `text-[11px] ${
|
|
102
|
+
s === 0 && /* @__PURE__ */ n("span", { className: `text-[11px] ${i}`, children: "Default" }),
|
|
102
103
|
s > 0 && /* @__PURE__ */ n(
|
|
103
104
|
"button",
|
|
104
105
|
{
|
|
105
106
|
type: "button",
|
|
106
|
-
onClick: () =>
|
|
107
|
+
onClick: () => F(e.key),
|
|
107
108
|
className: a(
|
|
108
109
|
"text-[11px] underline-offset-2 hover:underline",
|
|
109
|
-
|
|
110
|
+
S,
|
|
110
111
|
l
|
|
111
112
|
),
|
|
112
113
|
children: "Make default"
|
|
@@ -114,7 +115,7 @@ function V({ onClose: d }) {
|
|
|
114
115
|
)
|
|
115
116
|
] }, e.key);
|
|
116
117
|
}) }),
|
|
117
|
-
T && c.geo.length > 0 && /* @__PURE__ */ o("p", { className: `mt-1.5 text-[11px] ${
|
|
118
|
+
T && c.geo.length > 0 && /* @__PURE__ */ o("p", { className: `mt-1.5 text-[11px] ${i}`, children: [
|
|
118
119
|
"Offering all ",
|
|
119
120
|
c.geo.length,
|
|
120
121
|
" found."
|
|
@@ -122,7 +123,7 @@ function V({ onClose: d }) {
|
|
|
122
123
|
] }),
|
|
123
124
|
/* @__PURE__ */ o("section", { "aria-labelledby": "cc-set-region", children: [
|
|
124
125
|
/* @__PURE__ */ n("h3", { id: "cc-set-region", className: "mb-1 font-semibold text-[var(--cc-strong)]", children: "Regions" }),
|
|
125
|
-
/* @__PURE__ */ n("p", { className: `mb-2 ${
|
|
126
|
+
/* @__PURE__ */ n("p", { className: `mb-2 ${i}`, children: "Regions group the map and the people on it, and let the board focus on one place." }),
|
|
126
127
|
/* @__PURE__ */ o("div", { className: "space-y-1.5", role: "radiogroup", "aria-labelledby": "cc-set-region", children: [
|
|
127
128
|
/* @__PURE__ */ o("label", { className: v((t == null ? void 0 : t.mode) === "auto"), children: [
|
|
128
129
|
/* @__PURE__ */ n(
|
|
@@ -137,7 +138,7 @@ function V({ onClose: d }) {
|
|
|
137
138
|
),
|
|
138
139
|
/* @__PURE__ */ o("span", { children: [
|
|
139
140
|
/* @__PURE__ */ n("span", { className: "font-medium text-[var(--cc-strong)]", children: "Work it out for me" }),
|
|
140
|
-
/* @__PURE__ */ n("span", { className: `block ${
|
|
141
|
+
/* @__PURE__ */ n("span", { className: `block ${i}`, children: N ? `Uses ${N.label}: ${N.description}` : "Nothing in the data model looks like a region yet." })
|
|
141
142
|
] })
|
|
142
143
|
] }),
|
|
143
144
|
c.regions.map((e, s) => /* @__PURE__ */ o(
|
|
@@ -158,9 +159,9 @@ function V({ onClose: d }) {
|
|
|
158
159
|
/* @__PURE__ */ o("span", { children: [
|
|
159
160
|
/* @__PURE__ */ o("span", { className: "font-medium text-[var(--cc-strong)]", children: [
|
|
160
161
|
e.label,
|
|
161
|
-
e.suggested && /* @__PURE__ */ n("span", { className: `ml-1.5 font-normal ${
|
|
162
|
+
e.suggested && /* @__PURE__ */ n("span", { className: `ml-1.5 font-normal ${i}`, children: "(suggested)" })
|
|
162
163
|
] }),
|
|
163
|
-
/* @__PURE__ */ n("span", { className: `block ${
|
|
164
|
+
/* @__PURE__ */ n("span", { className: `block ${i}`, children: e.description })
|
|
164
165
|
] })
|
|
165
166
|
]
|
|
166
167
|
},
|
|
@@ -179,7 +180,7 @@ function V({ onClose: d }) {
|
|
|
179
180
|
),
|
|
180
181
|
/* @__PURE__ */ o("span", { children: [
|
|
181
182
|
/* @__PURE__ */ n("span", { className: "font-medium text-[var(--cc-strong)]", children: "No regions" }),
|
|
182
|
-
/* @__PURE__ */ n("span", { className: `block ${
|
|
183
|
+
/* @__PURE__ */ n("span", { className: `block ${i}`, children: "Show records and people without grouping them." })
|
|
183
184
|
] })
|
|
184
185
|
] })
|
|
185
186
|
] })
|
|
@@ -194,7 +195,7 @@ function V({ onClose: d }) {
|
|
|
194
195
|
min: 1,
|
|
195
196
|
max: 365,
|
|
196
197
|
value: g,
|
|
197
|
-
onChange: (e) =>
|
|
198
|
+
onChange: (e) => $(e.target.value),
|
|
198
199
|
"aria-describedby": "cc-set-stuck-help",
|
|
199
200
|
className: a(
|
|
200
201
|
"w-20 rounded-md border border-[var(--cc-border)] bg-[var(--cc-panel)] px-2 py-1 text-[12px] text-[var(--cc-text)]",
|
|
@@ -208,7 +209,7 @@ function V({ onClose: d }) {
|
|
|
208
209
|
"p",
|
|
209
210
|
{
|
|
210
211
|
id: "cc-set-stuck-help",
|
|
211
|
-
className: `mt-1 ${y ?
|
|
212
|
+
className: `mt-1 ${y ? i : "text-[var(--cc-bad-text)]"}`,
|
|
212
213
|
children: y ? "A record waiting this long in one step counts as stuck." : "Use a number from 1 to 365."
|
|
213
214
|
}
|
|
214
215
|
)
|
|
@@ -219,5 +220,5 @@ function V({ onClose: d }) {
|
|
|
219
220
|
);
|
|
220
221
|
}
|
|
221
222
|
export {
|
|
222
|
-
|
|
223
|
+
Y as BoardSettings
|
|
223
224
|
};
|
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
import { jsxs as l, jsx as n, Fragment as
|
|
2
|
-
import { useMutation as
|
|
3
|
-
import { ChevronRight as
|
|
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
4
|
import { useState as v } from "react";
|
|
5
|
-
import { toast as
|
|
5
|
+
import { toast as P } from "sonner";
|
|
6
6
|
import { useNivaroClient as A } from "../../../context.js";
|
|
7
7
|
import { post as T } from "../../../lib/commands.js";
|
|
8
|
+
import { toastError as E } from "../../../lib/error-toast.js";
|
|
8
9
|
import { cn as i } from "../../../lib/utils.js";
|
|
9
10
|
import { UserChip as F } from "../../item-edit/UserChip.js";
|
|
10
11
|
import { useCc as N } from "../state.js";
|
|
11
|
-
import { PANEL as
|
|
12
|
-
const
|
|
13
|
-
function
|
|
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() {
|
|
14
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) => {
|
|
15
16
|
const p = new Set(c);
|
|
16
17
|
return p.has(a) ? p.delete(a) : p.add(a), p;
|
|
17
18
|
}), h = e.region && (t == null ? void 0 : t.people.region_applies) === !1;
|
|
18
|
-
return /* @__PURE__ */ l("section", { className:
|
|
19
|
-
/* @__PURE__ */ l("div", { className:
|
|
20
|
-
/* @__PURE__ */ n("h2", { id: "cc-people-title", className:
|
|
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" }),
|
|
21
22
|
/* @__PURE__ */ l("span", { className: `text-[11px] tabular-nums ${f}`, children: [
|
|
22
23
|
(t == null ? void 0 : t.people.online_count) ?? 0,
|
|
23
24
|
" online",
|
|
@@ -28,21 +29,21 @@ function X() {
|
|
|
28
29
|
h && /* @__PURE__ */ n("p", { className: `px-1 pb-1 text-[11px] ${f}`, children: "People are not placed in regions here — showing everyone." }),
|
|
29
30
|
o.map((a) => {
|
|
30
31
|
const c = u(a);
|
|
31
|
-
return /* @__PURE__ */ n(
|
|
32
|
+
return /* @__PURE__ */ n(j, { group: a, expanded: s.has(c), onToggle: () => d(c) }, c);
|
|
32
33
|
}),
|
|
33
34
|
t && o.length === 0 && /* @__PURE__ */ n("p", { className: `px-1 text-[12px] ${f}`, children: "Nobody online right now." }),
|
|
34
35
|
!t && /* @__PURE__ */ n("p", { className: `px-1 text-[12px] ${f}`, children: "Loading…" })
|
|
35
36
|
] })
|
|
36
37
|
] });
|
|
37
38
|
}
|
|
38
|
-
function
|
|
39
|
+
function j({
|
|
39
40
|
group: e,
|
|
40
41
|
expanded: t,
|
|
41
42
|
onToggle: o
|
|
42
43
|
}) {
|
|
43
44
|
var x, g;
|
|
44
|
-
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,
|
|
45
|
-
user_id: `${
|
|
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: `${_}`,
|
|
46
47
|
name: r,
|
|
47
48
|
idle: !1,
|
|
48
49
|
page_label: null,
|
|
@@ -63,7 +64,7 @@ function U({
|
|
|
63
64
|
),
|
|
64
65
|
children: [
|
|
65
66
|
/* @__PURE__ */ n(
|
|
66
|
-
|
|
67
|
+
C,
|
|
67
68
|
{
|
|
68
69
|
className: i(
|
|
69
70
|
"h-3.5 w-3.5 shrink-0 text-[var(--cc-faint)] motion-safe:transition-transform",
|
|
@@ -95,7 +96,7 @@ function U({
|
|
|
95
96
|
"rounded p-1 text-[var(--cc-faint)] hover:bg-[var(--cc-chip)] hover:text-[var(--cc-text)]",
|
|
96
97
|
m
|
|
97
98
|
),
|
|
98
|
-
children: /* @__PURE__ */ n(
|
|
99
|
+
children: /* @__PURE__ */ n(k, { className: "h-3.5 w-3.5" })
|
|
99
100
|
}
|
|
100
101
|
),
|
|
101
102
|
c && /* @__PURE__ */ n(
|
|
@@ -109,21 +110,21 @@ function U({
|
|
|
109
110
|
"rounded p-1 text-[var(--cc-faint)] hover:bg-[var(--cc-chip)] hover:text-[var(--cc-text)]",
|
|
110
111
|
m
|
|
111
112
|
),
|
|
112
|
-
children: /* @__PURE__ */ n(
|
|
113
|
+
children: /* @__PURE__ */ n(S, { className: "h-3.5 w-3.5" })
|
|
113
114
|
}
|
|
114
115
|
)
|
|
115
116
|
] }),
|
|
116
117
|
b && c && /* @__PURE__ */ n(
|
|
117
|
-
|
|
118
|
+
q,
|
|
118
119
|
{
|
|
119
120
|
label: e.label,
|
|
120
|
-
ids: (e.people ?? []).map((r) => r.user_id).slice(0,
|
|
121
|
+
ids: (e.people ?? []).map((r) => r.user_id).slice(0, U),
|
|
121
122
|
total: e.count,
|
|
122
123
|
onDone: () => u(!1)
|
|
123
124
|
}
|
|
124
125
|
),
|
|
125
126
|
t && /* @__PURE__ */ l("ul", { id: p, className: "mb-1 ml-5 mt-0.5 space-y-0.5", children: [
|
|
126
|
-
a.map((r) => /* @__PURE__ */ n(
|
|
127
|
+
a.map((r) => /* @__PURE__ */ n(R, { p: r, real: !!e.people }, r.user_id)),
|
|
127
128
|
e.count > a.length && /* @__PURE__ */ l("li", { className: `px-1 text-[11px] ${f}`, children: [
|
|
128
129
|
"and ",
|
|
129
130
|
e.count - a.length,
|
|
@@ -132,7 +133,7 @@ function U({
|
|
|
132
133
|
] })
|
|
133
134
|
] });
|
|
134
135
|
}
|
|
135
|
-
function
|
|
136
|
+
function R({ p: e, real: t }) {
|
|
136
137
|
const o = N(), s = /* @__PURE__ */ n(
|
|
137
138
|
"button",
|
|
138
139
|
{
|
|
@@ -171,11 +172,11 @@ function j({ p: e, real: t }) {
|
|
|
171
172
|
"ml-auto rounded p-0.5 text-[var(--cc-faint)] hover:bg-[var(--cc-chip)] hover:text-[var(--cc-text)]",
|
|
172
173
|
m
|
|
173
174
|
),
|
|
174
|
-
children: /* @__PURE__ */ n(
|
|
175
|
+
children: /* @__PURE__ */ n(M, { className: "h-3 w-3" })
|
|
175
176
|
}
|
|
176
177
|
)
|
|
177
178
|
] }),
|
|
178
|
-
(e.record || e.page_label) && /* @__PURE__ */ n("p", { className: `truncate text-[11px] ${
|
|
179
|
+
(e.record || e.page_label) && /* @__PURE__ */ n("p", { className: `truncate text-[11px] ${z}`, children: e.record ? /* @__PURE__ */ l(
|
|
179
180
|
"button",
|
|
180
181
|
{
|
|
181
182
|
type: "button",
|
|
@@ -187,30 +188,30 @@ function j({ p: e, real: t }) {
|
|
|
187
188
|
e.record.label
|
|
188
189
|
]
|
|
189
190
|
}
|
|
190
|
-
) : /* @__PURE__ */ l(
|
|
191
|
+
) : /* @__PURE__ */ l(w, { children: [
|
|
191
192
|
"On ",
|
|
192
193
|
e.page_label
|
|
193
194
|
] }) })
|
|
194
195
|
] })
|
|
195
196
|
] });
|
|
196
197
|
}
|
|
197
|
-
function
|
|
198
|
+
function q({
|
|
198
199
|
label: e,
|
|
199
200
|
ids: t,
|
|
200
201
|
total: o,
|
|
201
202
|
onDone: s
|
|
202
203
|
}) {
|
|
203
|
-
const b = A(), [u, d] = v(""), [h, a] = v(!1), c =
|
|
204
|
+
const b = A(), [u, d] = v(""), [h, a] = v(!1), c = y({
|
|
204
205
|
mutationFn: () => b.request(
|
|
205
206
|
T("/command-center/people/message", { user_ids: t, message: u.trim() })
|
|
206
207
|
),
|
|
207
208
|
onSuccess: (x) => {
|
|
208
209
|
var r;
|
|
209
210
|
const g = ((r = x.data) == null ? void 0 : r.sent) ?? t.length;
|
|
210
|
-
|
|
211
|
+
P.success(`Sent to ${g} ${g === 1 ? "person" : "people"}`), s();
|
|
211
212
|
},
|
|
212
213
|
onError: (x) => {
|
|
213
|
-
a(!1),
|
|
214
|
+
a(!1), E(x, "Message not sent");
|
|
214
215
|
}
|
|
215
216
|
}), p = `cc-msg-${e.replace(/[^A-Za-z0-9_-]/g, "_")}`;
|
|
216
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: [
|
|
@@ -241,7 +242,7 @@ function R({
|
|
|
241
242
|
}
|
|
242
243
|
),
|
|
243
244
|
/* @__PURE__ */ l("div", { className: "flex items-center justify-end gap-1.5", children: [
|
|
244
|
-
/* @__PURE__ */ n("button", { type: "button", onClick: s, className: i(
|
|
245
|
+
/* @__PURE__ */ n("button", { type: "button", onClick: s, className: i($, m), children: "Cancel" }),
|
|
245
246
|
/* @__PURE__ */ n(
|
|
246
247
|
"button",
|
|
247
248
|
{
|
|
@@ -249,7 +250,7 @@ function R({
|
|
|
249
250
|
disabled: !u.trim() || c.isPending,
|
|
250
251
|
onClick: () => h ? c.mutate() : a(!0),
|
|
251
252
|
className: i(
|
|
252
|
-
|
|
253
|
+
$,
|
|
253
254
|
m,
|
|
254
255
|
h && "border-nvr-cyan bg-nvr-cyan text-white hover:bg-nvr-cyan"
|
|
255
256
|
),
|
|
@@ -260,5 +261,5 @@ function R({
|
|
|
260
261
|
] });
|
|
261
262
|
}
|
|
262
263
|
export {
|
|
263
|
-
|
|
264
|
+
ee as PeoplePanel
|
|
264
265
|
};
|