@nivaro/react 0.3.7 → 0.3.8
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 +16 -3
- package/dist/shared/components/ForceReloadBanner.js +31 -26
- package/dist/shared/components/chat/ChatPanel.js +115 -113
- package/dist/shared/components/chat/chat-core.js +55 -48
- package/dist/shared/components/delegation/DelegationConsoleView.js +294 -167
- package/dist/shared/components/notifications/NotificationAnalyticsView.js +143 -124
- package/dist/shared/components/notifications/NotificationSubscriptionsView.js +35 -9
- package/package.json +1 -1
|
@@ -1,92 +1,102 @@
|
|
|
1
|
-
import { jsxs as a, jsx as e, Fragment as
|
|
2
|
-
import { readUser as
|
|
3
|
-
import { useQueryClient as
|
|
4
|
-
import { Users as
|
|
5
|
-
import { useState as
|
|
6
|
-
import { useNivaroClient as
|
|
7
|
-
import { get as
|
|
8
|
-
import { useLiveOps as
|
|
9
|
-
import { cn as
|
|
10
|
-
import { RelationCombobox as
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
const
|
|
1
|
+
import { jsxs as a, jsx as e, Fragment as E } from "react/jsx-runtime";
|
|
2
|
+
import { readUser as P } from "@nivaro/sdk";
|
|
3
|
+
import { useQueryClient as I, useQuery as $, useMutation as K } from "@tanstack/react-query";
|
|
4
|
+
import { Users as T, CalendarClock as j, UserRound as A, AlertTriangle as O, Check as L } from "lucide-react";
|
|
5
|
+
import { useState as _ } from "react";
|
|
6
|
+
import { useNivaroClient as D, useItemEditAuth as Q, useNavigation as U } from "../../context.js";
|
|
7
|
+
import { get as S, post as z } from "../../lib/commands.js";
|
|
8
|
+
import { useLiveOps as F } from "../../lib/live-ops.js";
|
|
9
|
+
import { cn as m } from "../../lib/utils.js";
|
|
10
|
+
import { RelationCombobox as R } from "../item-edit/RelationCombobox.js";
|
|
11
|
+
import { UserChip as y } from "../item-edit/UserChip.js";
|
|
12
|
+
import { DelegationCard as W } from "../profile/DelegationCard.js";
|
|
13
|
+
const N = (n) => n ? new Date(n).toLocaleDateString(void 0, { month: "short", day: "numeric" }) : "—", M = {
|
|
14
14
|
none: "no delegate",
|
|
15
15
|
expired: "delegation expired",
|
|
16
16
|
suspended: "delegate is suspended",
|
|
17
17
|
out: "delegate is out too"
|
|
18
18
|
};
|
|
19
|
-
function
|
|
19
|
+
function v({
|
|
20
|
+
label: n,
|
|
21
|
+
value: s,
|
|
22
|
+
tone: d,
|
|
23
|
+
hint: o
|
|
24
|
+
}) {
|
|
20
25
|
return /* @__PURE__ */ a("div", { className: "rounded-lg border border-slate-200 bg-white px-4 py-3 dark:border-border dark:bg-card", children: [
|
|
21
|
-
/* @__PURE__ */ e("p", { className: "text-[10.5px] font-semibold uppercase tracking-wide text-slate-400", children:
|
|
26
|
+
/* @__PURE__ */ e("p", { className: "text-[10.5px] font-semibold uppercase tracking-wide text-slate-400", children: n }),
|
|
22
27
|
/* @__PURE__ */ e(
|
|
23
28
|
"p",
|
|
24
29
|
{
|
|
25
|
-
className:
|
|
30
|
+
className: m(
|
|
26
31
|
"mt-1 text-[22px] font-semibold tabular-nums",
|
|
27
|
-
|
|
32
|
+
d === "bad" ? "text-red-600 dark:text-red-400" : d === "warn" ? "text-amber-700 dark:text-amber-400" : "text-slate-900 dark:text-foreground"
|
|
28
33
|
),
|
|
29
|
-
children:
|
|
34
|
+
children: s
|
|
30
35
|
}
|
|
31
36
|
),
|
|
32
|
-
|
|
37
|
+
o && /* @__PURE__ */ e("p", { className: "text-[11px] text-slate-400", children: o })
|
|
33
38
|
] });
|
|
34
39
|
}
|
|
35
|
-
function
|
|
40
|
+
function f({
|
|
41
|
+
title: n,
|
|
42
|
+
hint: s,
|
|
43
|
+
children: d,
|
|
44
|
+
tone: o
|
|
45
|
+
}) {
|
|
36
46
|
return /* @__PURE__ */ a(
|
|
37
47
|
"div",
|
|
38
48
|
{
|
|
39
|
-
className:
|
|
49
|
+
className: m(
|
|
40
50
|
"rounded-lg border bg-white dark:bg-card",
|
|
41
|
-
|
|
51
|
+
o === "bad" ? "border-red-300 dark:border-red-500/40" : "border-slate-200 dark:border-border"
|
|
42
52
|
),
|
|
43
53
|
children: [
|
|
44
54
|
/* @__PURE__ */ a("header", { className: "border-b border-slate-100 px-4 py-2.5 dark:border-border/60", children: [
|
|
45
|
-
/* @__PURE__ */ e("h3", { className: "text-[13px] font-semibold text-slate-800 dark:text-slate-100", children:
|
|
46
|
-
|
|
55
|
+
/* @__PURE__ */ e("h3", { className: "text-[13px] font-semibold text-slate-800 dark:text-slate-100", children: n }),
|
|
56
|
+
s && /* @__PURE__ */ e("p", { className: "text-[11px] text-slate-400", children: s })
|
|
47
57
|
] }),
|
|
48
|
-
|
|
58
|
+
d
|
|
49
59
|
]
|
|
50
60
|
}
|
|
51
61
|
);
|
|
52
62
|
}
|
|
53
|
-
function
|
|
54
|
-
return
|
|
55
|
-
/* @__PURE__ */ e(
|
|
56
|
-
|
|
63
|
+
function B({ e: n }) {
|
|
64
|
+
return n.delegate ? /* @__PURE__ */ a("span", { className: "inline-flex flex-wrap items-center gap-1.5", children: [
|
|
65
|
+
/* @__PURE__ */ e(y, { userId: n.delegate.id, size: "compact" }),
|
|
66
|
+
n.delegate_ok ? /* @__PURE__ */ a("span", { className: "inline-flex items-center gap-0.5 text-[10.5px] text-emerald-700 dark:text-emerald-400", children: [
|
|
57
67
|
/* @__PURE__ */ e(L, { className: "h-3 w-3" }),
|
|
58
68
|
" covering",
|
|
59
|
-
|
|
69
|
+
n.delegate_expires_at ? ` until ${N(n.delegate_expires_at)}` : ""
|
|
60
70
|
] }) : /* @__PURE__ */ a("span", { className: "inline-flex items-center gap-0.5 rounded-full bg-amber-500/10 px-1.5 py-px text-[10.5px] font-semibold text-amber-700 dark:text-amber-400", children: [
|
|
61
|
-
/* @__PURE__ */ e(
|
|
71
|
+
/* @__PURE__ */ e(O, { className: "h-3 w-3" }),
|
|
62
72
|
" ",
|
|
63
|
-
|
|
73
|
+
M[n.delegate_problem ?? "none"]
|
|
64
74
|
] })
|
|
65
75
|
] }) : /* @__PURE__ */ a("span", { className: "inline-flex items-center gap-1 rounded-full bg-red-500/10 px-2 py-0.5 text-[10.5px] font-semibold text-red-600 dark:text-red-400", children: [
|
|
66
|
-
/* @__PURE__ */ e(
|
|
76
|
+
/* @__PURE__ */ e(O, { className: "h-3 w-3" }),
|
|
67
77
|
" No delegate"
|
|
68
78
|
] });
|
|
69
79
|
}
|
|
70
|
-
function
|
|
71
|
-
var
|
|
72
|
-
const
|
|
73
|
-
mutationFn: () =>
|
|
74
|
-
|
|
75
|
-
delegate_id:
|
|
76
|
-
delegate_expires_at:
|
|
80
|
+
function G({ entry: n, onDone: s }) {
|
|
81
|
+
var l, k, w, i;
|
|
82
|
+
const d = D(), [o, r] = _(!1), [g, b] = _(((l = n.delegate) == null ? void 0 : l.id) ?? null), [c, p] = _(((k = n.delegate_expires_at) == null ? void 0 : k.slice(0, 10)) ?? ""), h = K({
|
|
83
|
+
mutationFn: () => d.request(
|
|
84
|
+
z(`/delegation/${n.user.id}/delegate`, {
|
|
85
|
+
delegate_id: g,
|
|
86
|
+
delegate_expires_at: c ? (/* @__PURE__ */ new Date(`${c}T23:59:59`)).toISOString() : null
|
|
77
87
|
})
|
|
78
88
|
),
|
|
79
89
|
onSuccess: () => {
|
|
80
|
-
r(!1),
|
|
90
|
+
r(!1), s();
|
|
81
91
|
}
|
|
82
92
|
});
|
|
83
|
-
return
|
|
93
|
+
return o ? /* @__PURE__ */ a("div", { className: "flex flex-wrap items-end gap-2", "data-nvr-assign-delegate": !0, children: [
|
|
84
94
|
/* @__PURE__ */ e("div", { className: "w-[220px]", children: /* @__PURE__ */ e(
|
|
85
|
-
|
|
95
|
+
R,
|
|
86
96
|
{
|
|
87
97
|
collection: "nivaro_users",
|
|
88
|
-
value:
|
|
89
|
-
onChange: (
|
|
98
|
+
value: g,
|
|
99
|
+
onChange: (x) => b(x == null ? null : String(x)),
|
|
90
100
|
placeholder: "Pick a delegate…"
|
|
91
101
|
}
|
|
92
102
|
) }),
|
|
@@ -94,8 +104,8 @@ function B({ entry: l, onDone: d }) {
|
|
|
94
104
|
"input",
|
|
95
105
|
{
|
|
96
106
|
type: "date",
|
|
97
|
-
value:
|
|
98
|
-
onChange: (
|
|
107
|
+
value: c,
|
|
108
|
+
onChange: (x) => p(x.target.value),
|
|
99
109
|
"aria-label": "Delegation expires",
|
|
100
110
|
className: "h-9 rounded-md border border-slate-200 bg-background px-2 text-[12px] dark:border-border"
|
|
101
111
|
}
|
|
@@ -104,10 +114,10 @@ function B({ entry: l, onDone: d }) {
|
|
|
104
114
|
"button",
|
|
105
115
|
{
|
|
106
116
|
type: "button",
|
|
107
|
-
disabled:
|
|
108
|
-
onClick: () =>
|
|
117
|
+
disabled: h.isPending,
|
|
118
|
+
onClick: () => h.mutate(),
|
|
109
119
|
className: "h-9 rounded-md bg-nvr-cyan px-3 text-[12px] font-semibold text-white disabled:opacity-50",
|
|
110
|
-
children:
|
|
120
|
+
children: h.isPending ? "Saving…" : "Save"
|
|
111
121
|
}
|
|
112
122
|
),
|
|
113
123
|
/* @__PURE__ */ e(
|
|
@@ -119,31 +129,36 @@ function B({ entry: l, onDone: d }) {
|
|
|
119
129
|
children: "Cancel"
|
|
120
130
|
}
|
|
121
131
|
),
|
|
122
|
-
|
|
132
|
+
h.isError && /* @__PURE__ */ e("span", { className: "text-[11.5px] text-red-600", children: ((i = (w = h.error) == null ? void 0 : w.response) == null ? void 0 : i.error) ?? "Save failed" })
|
|
123
133
|
] }) : /* @__PURE__ */ e(
|
|
124
134
|
"button",
|
|
125
135
|
{
|
|
126
136
|
type: "button",
|
|
127
137
|
onClick: () => r(!0),
|
|
128
138
|
className: "text-[11.5px] text-slate-500 underline decoration-dotted underline-offset-2 hover:text-slate-800 dark:hover:text-slate-200",
|
|
129
|
-
children:
|
|
139
|
+
children: n.delegate ? "Change" : "Assign delegate"
|
|
130
140
|
}
|
|
131
141
|
);
|
|
132
142
|
}
|
|
133
|
-
function
|
|
134
|
-
|
|
143
|
+
function q({
|
|
144
|
+
rows: n,
|
|
145
|
+
isAdmin: s,
|
|
146
|
+
onChanged: d,
|
|
147
|
+
showWindow: o
|
|
148
|
+
}) {
|
|
149
|
+
return n.length === 0 ? /* @__PURE__ */ e("p", { className: "px-4 py-4 text-[12px] text-slate-400", children: "Nobody." }) : /* @__PURE__ */ a("table", { className: "w-full text-[12px]", children: [
|
|
135
150
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ a("tr", { className: "text-left text-[10.5px] uppercase tracking-wide text-slate-400", children: [
|
|
136
151
|
/* @__PURE__ */ e("th", { className: "px-4 py-1.5 font-semibold", children: "Person" }),
|
|
137
|
-
|
|
152
|
+
o && /* @__PURE__ */ e("th", { className: "px-2 py-1.5 font-semibold", children: "Out" }),
|
|
138
153
|
/* @__PURE__ */ e("th", { className: "px-2 py-1.5 font-semibold", children: "Delegate" }),
|
|
139
154
|
/* @__PURE__ */ e("th", { className: "px-2 py-1.5 font-semibold", children: "Covers" }),
|
|
140
155
|
/* @__PURE__ */ e("th", { className: "px-2 py-1.5 text-right font-semibold", children: "Pending" }),
|
|
141
|
-
|
|
156
|
+
s && /* @__PURE__ */ e("th", { className: "px-2 py-1.5 font-semibold" })
|
|
142
157
|
] }) }),
|
|
143
|
-
/* @__PURE__ */ e("tbody", { children:
|
|
144
|
-
/* @__PURE__ */ e("td", { className: "px-4 py-2", children: /* @__PURE__ */ e(
|
|
145
|
-
|
|
146
|
-
/* @__PURE__ */ e("td", { className: "px-2 py-2", children: /* @__PURE__ */ e(
|
|
158
|
+
/* @__PURE__ */ e("tbody", { children: n.map((r) => /* @__PURE__ */ a("tr", { className: "border-t border-slate-100 align-top dark:border-border", children: [
|
|
159
|
+
/* @__PURE__ */ e("td", { className: "px-4 py-2", children: /* @__PURE__ */ e(y, { userId: r.user.id, size: "compact" }) }),
|
|
160
|
+
o && /* @__PURE__ */ e("td", { className: "px-2 py-2 whitespace-nowrap text-slate-600 dark:text-muted-foreground", children: r.ooo_start || r.ooo_end ? `${N(r.ooo_start)} → ${r.ooo_end ? N(r.ooo_end) : "open"}` : r.currently_out ? "until switched off" : "—" }),
|
|
161
|
+
/* @__PURE__ */ e("td", { className: "px-2 py-2", children: /* @__PURE__ */ e(B, { e: r }) }),
|
|
147
162
|
/* @__PURE__ */ e("td", { className: "px-2 py-2 text-slate-500", children: r.group_seats > 0 ? /* @__PURE__ */ a("span", { title: r.states.join(", "), "data-tip": r.states.join(", "), children: [
|
|
148
163
|
r.group_seats,
|
|
149
164
|
" seat",
|
|
@@ -157,183 +172,295 @@ function $({ rows: l, isAdmin: d, onChanged: o, showWindow: s }) {
|
|
|
157
172
|
/* @__PURE__ */ e(
|
|
158
173
|
"td",
|
|
159
174
|
{
|
|
160
|
-
className:
|
|
175
|
+
className: m(
|
|
161
176
|
"px-2 py-2 text-right tabular-nums",
|
|
162
177
|
r.pending_estimate > 0 && !r.delegate_ok ? "font-semibold text-red-600 dark:text-red-400" : "text-slate-600 dark:text-muted-foreground"
|
|
163
178
|
),
|
|
164
179
|
children: r.pending_estimate
|
|
165
180
|
}
|
|
166
181
|
),
|
|
167
|
-
|
|
182
|
+
s && /* @__PURE__ */ e("td", { className: "px-2 py-2", children: /* @__PURE__ */ e(G, { entry: r, onDone: d }) })
|
|
168
183
|
] }, r.user.id)) })
|
|
169
184
|
] });
|
|
170
185
|
}
|
|
171
|
-
function
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
186
|
+
function se({
|
|
187
|
+
className: n,
|
|
188
|
+
onNotice: s,
|
|
189
|
+
compactHeader: d = !1
|
|
190
|
+
}) {
|
|
191
|
+
const o = D(), r = I(), g = Q(), b = U(), c = !!(g != null && g.isAdmin), [p, h] = _(14), { data: l, isLoading: k } = $({
|
|
192
|
+
queryKey: ["delegation-overview", p],
|
|
193
|
+
queryFn: () => o.request(S("/delegation/overview", { days: p })).then((t) => t.data)
|
|
194
|
+
}), { data: w } = $({
|
|
176
195
|
queryKey: ["nvr-profile-user", "me"],
|
|
177
|
-
queryFn: () => o.request(
|
|
178
|
-
}), { data:
|
|
196
|
+
queryFn: () => o.request(P("me")).then((t) => t.data)
|
|
197
|
+
}), { data: i } = $({
|
|
179
198
|
queryKey: ["coverage-gaps"],
|
|
180
|
-
queryFn: () => o.request(
|
|
181
|
-
enabled:
|
|
199
|
+
queryFn: () => o.request(S("/coverage-gaps")).then((t) => t.data),
|
|
200
|
+
enabled: c,
|
|
182
201
|
staleTime: 6e4
|
|
183
|
-
}),
|
|
184
|
-
|
|
202
|
+
}), x = () => {
|
|
203
|
+
r.invalidateQueries({ queryKey: ["delegation-overview"] }), r.invalidateQueries({ queryKey: ["nvr-profile-user"] }), r.invalidateQueries({ queryKey: ["coverage-gaps"] }), s == null || s("Saved");
|
|
185
204
|
};
|
|
186
|
-
|
|
205
|
+
F(
|
|
187
206
|
"delegation",
|
|
188
207
|
() => {
|
|
189
|
-
|
|
208
|
+
r.invalidateQueries({ queryKey: ["delegation-overview"] }), r.invalidateQueries({ queryKey: ["coverage-gaps"] });
|
|
190
209
|
},
|
|
191
210
|
{ debounceMs: 1e3 }
|
|
192
211
|
);
|
|
193
|
-
const
|
|
194
|
-
return /* @__PURE__ */ a("div", { className:
|
|
195
|
-
/* @__PURE__ */ e(
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
212
|
+
const C = b.consoleUrl ? b.consoleUrl("/coverage-gaps") : "/coverage-gaps";
|
|
213
|
+
return /* @__PURE__ */ a("div", { className: m("flex flex-1 min-h-0 flex-col", n), "data-nvr-delegation-console": !0, children: [
|
|
214
|
+
/* @__PURE__ */ e(
|
|
215
|
+
"header",
|
|
216
|
+
{
|
|
217
|
+
className: m(
|
|
218
|
+
d ? "flex min-h-16 shrink-0 flex-col justify-center border-b border-slate-200 bg-white px-4 py-3 sm:px-6 dark:border-border dark:bg-card" : "shrink-0 border-b border-slate-200 bg-white px-6 py-4 dark:border-border dark:bg-card"
|
|
219
|
+
),
|
|
220
|
+
children: /* @__PURE__ */ a("div", { className: "flex items-center gap-2.5", children: [
|
|
221
|
+
!d && /* @__PURE__ */ e(T, { className: "h-5 w-5 text-muted-foreground" }),
|
|
222
|
+
/* @__PURE__ */ a("div", { children: [
|
|
223
|
+
!d && /* @__PURE__ */ e("h1", { className: "text-[17px] font-semibold text-slate-900 dark:text-foreground", children: "Delegation" }),
|
|
224
|
+
/* @__PURE__ */ e(
|
|
225
|
+
"p",
|
|
226
|
+
{
|
|
227
|
+
className: m(
|
|
228
|
+
d ? "m-0 max-w-[72ch] text-[12px] leading-relaxed text-slate-600 dark:text-muted-foreground" : "mt-0.5 text-[12.5px] text-slate-500 dark:text-muted-foreground"
|
|
229
|
+
),
|
|
230
|
+
children: "Who is out, who covers them, what expires soon, and whose absence leaves approvals with nobody — plus your own delegate."
|
|
231
|
+
}
|
|
232
|
+
)
|
|
233
|
+
] }),
|
|
234
|
+
/* @__PURE__ */ e("span", { className: "flex-1" }),
|
|
235
|
+
/* @__PURE__ */ e("div", { className: "inline-flex rounded-md border border-slate-200 p-0.5 dark:border-border", children: [7, 14, 30].map((t) => /* @__PURE__ */ a(
|
|
236
|
+
"button",
|
|
237
|
+
{
|
|
238
|
+
type: "button",
|
|
239
|
+
onClick: () => h(t),
|
|
240
|
+
className: m(
|
|
241
|
+
"rounded px-2.5 py-1 text-[12px] font-medium",
|
|
242
|
+
p === t ? "bg-slate-900 text-white dark:bg-nvr-cyan dark:text-[#172940]" : "text-slate-600 hover:bg-slate-100 dark:text-muted-foreground dark:hover:bg-muted"
|
|
243
|
+
),
|
|
244
|
+
children: [
|
|
245
|
+
"next ",
|
|
246
|
+
t,
|
|
247
|
+
"d"
|
|
248
|
+
]
|
|
249
|
+
},
|
|
250
|
+
t
|
|
251
|
+
)) })
|
|
252
|
+
] })
|
|
253
|
+
}
|
|
254
|
+
),
|
|
255
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto bg-slate-50 p-6 dark:bg-background", children: k || !l ? /* @__PURE__ */ e("p", { className: "text-[13px] text-slate-400", children: "Loading…" }) : /* @__PURE__ */ a("div", { className: "space-y-5", children: [
|
|
221
256
|
/* @__PURE__ */ a("div", { className: "grid grid-cols-2 gap-3 md:grid-cols-3 xl:grid-cols-6", children: [
|
|
222
|
-
/* @__PURE__ */ e(
|
|
223
|
-
/* @__PURE__ */ e(
|
|
224
|
-
/* @__PURE__ */ e(
|
|
257
|
+
/* @__PURE__ */ e(v, { label: "Out now", value: l.totals.out_now }),
|
|
258
|
+
/* @__PURE__ */ e(v, { label: `Out in next ${p}d`, value: l.totals.upcoming }),
|
|
259
|
+
/* @__PURE__ */ e(v, { label: "People covering", value: l.totals.covering }),
|
|
225
260
|
/* @__PURE__ */ e(
|
|
226
|
-
|
|
261
|
+
v,
|
|
227
262
|
{
|
|
228
263
|
label: "Expiring",
|
|
229
|
-
value:
|
|
230
|
-
tone:
|
|
231
|
-
hint: `delegations ending in ${
|
|
264
|
+
value: l.totals.expiring,
|
|
265
|
+
tone: l.expiring.some((t) => t.expired) ? "bad" : l.totals.expiring ? "warn" : void 0,
|
|
266
|
+
hint: `delegations ending in ${p}d`
|
|
232
267
|
}
|
|
233
268
|
),
|
|
234
269
|
/* @__PURE__ */ e(
|
|
235
|
-
|
|
270
|
+
v,
|
|
236
271
|
{
|
|
237
272
|
label: "Uncovered",
|
|
238
|
-
value:
|
|
239
|
-
tone:
|
|
273
|
+
value: l.totals.uncovered,
|
|
274
|
+
tone: l.totals.uncovered ? "bad" : void 0,
|
|
240
275
|
hint: "out (or by tomorrow) with no working delegate"
|
|
241
276
|
}
|
|
242
277
|
),
|
|
243
278
|
/* @__PURE__ */ e(
|
|
244
|
-
|
|
279
|
+
v,
|
|
245
280
|
{
|
|
246
281
|
label: "Approvals at risk",
|
|
247
|
-
value:
|
|
248
|
-
tone:
|
|
282
|
+
value: l.totals.pending_uncovered,
|
|
283
|
+
tone: l.totals.pending_uncovered ? "bad" : void 0,
|
|
249
284
|
hint: "open items in states they cover"
|
|
250
285
|
}
|
|
251
286
|
)
|
|
252
287
|
] }),
|
|
253
|
-
|
|
254
|
-
|
|
288
|
+
l.uncovered.length > 0 && /* @__PURE__ */ e(
|
|
289
|
+
f,
|
|
255
290
|
{
|
|
256
291
|
tone: "bad",
|
|
257
292
|
title: "Would go unowned — no working delegate",
|
|
258
293
|
hint: "Out now, or entering an OOO window within 24 hours, with nobody able to act for them. Pending = open items sitting in states they help cover.",
|
|
259
|
-
children: /* @__PURE__ */ e(
|
|
294
|
+
children: /* @__PURE__ */ e(
|
|
295
|
+
q,
|
|
296
|
+
{
|
|
297
|
+
rows: l.uncovered,
|
|
298
|
+
isAdmin: c,
|
|
299
|
+
onChanged: x,
|
|
300
|
+
showWindow: !0
|
|
301
|
+
}
|
|
302
|
+
)
|
|
260
303
|
}
|
|
261
304
|
),
|
|
262
305
|
/* @__PURE__ */ a("div", { className: "grid grid-cols-1 gap-4 xl:grid-cols-2", children: [
|
|
263
306
|
/* @__PURE__ */ a("div", { className: "space-y-4", children: [
|
|
264
|
-
/* @__PURE__ */ e(
|
|
265
|
-
|
|
307
|
+
/* @__PURE__ */ e(f, { title: "Out now", hint: "Currently out of office.", children: /* @__PURE__ */ e(
|
|
308
|
+
q,
|
|
309
|
+
{
|
|
310
|
+
rows: l.out_now,
|
|
311
|
+
isAdmin: c,
|
|
312
|
+
onChanged: x,
|
|
313
|
+
showWindow: !0
|
|
314
|
+
}
|
|
315
|
+
) }),
|
|
316
|
+
/* @__PURE__ */ e(
|
|
317
|
+
f,
|
|
318
|
+
{
|
|
319
|
+
title: `Coming up (next ${p} days)`,
|
|
320
|
+
hint: "Scheduled OOO windows — the flag flips on entry and clears on exit.",
|
|
321
|
+
children: /* @__PURE__ */ e(
|
|
322
|
+
q,
|
|
323
|
+
{
|
|
324
|
+
rows: l.upcoming,
|
|
325
|
+
isAdmin: c,
|
|
326
|
+
onChanged: x,
|
|
327
|
+
showWindow: !0
|
|
328
|
+
}
|
|
329
|
+
)
|
|
330
|
+
}
|
|
331
|
+
)
|
|
266
332
|
] }),
|
|
267
333
|
/* @__PURE__ */ a("div", { className: "space-y-4", children: [
|
|
268
|
-
|
|
269
|
-
/* @__PURE__ */ e(
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
"
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
334
|
+
w && /* @__PURE__ */ e(W, { user: w, onSaved: x }),
|
|
335
|
+
/* @__PURE__ */ e(
|
|
336
|
+
f,
|
|
337
|
+
{
|
|
338
|
+
title: "Who covers whom",
|
|
339
|
+
hint: "Active delegations: the delegate and everyone routing to them right now.",
|
|
340
|
+
children: l.covering.length === 0 ? /* @__PURE__ */ e("p", { className: "px-4 py-4 text-[12px] text-slate-400", children: "No active delegations." }) : /* @__PURE__ */ e("ul", { className: "divide-y divide-slate-100 dark:divide-border", children: l.covering.map((t) => /* @__PURE__ */ a(
|
|
341
|
+
"li",
|
|
342
|
+
{
|
|
343
|
+
className: "flex flex-wrap items-start gap-2 px-4 py-2 text-[12px]",
|
|
344
|
+
children: [
|
|
345
|
+
/* @__PURE__ */ e(y, { userId: t.delegate.id, size: "compact" }),
|
|
346
|
+
/* @__PURE__ */ e("span", { className: "mt-1 text-slate-400", children: "covers" }),
|
|
347
|
+
/* @__PURE__ */ e("span", { className: "flex flex-wrap gap-1", children: t.covers.map((u) => /* @__PURE__ */ a("span", { className: "inline-flex items-center gap-1", children: [
|
|
348
|
+
/* @__PURE__ */ e(y, { userId: u.id, size: "compact" }),
|
|
349
|
+
u.expires_at && /* @__PURE__ */ a("span", { className: "text-[10.5px] text-slate-400", children: [
|
|
350
|
+
"until ",
|
|
351
|
+
N(u.expires_at)
|
|
352
|
+
] })
|
|
353
|
+
] }, u.id)) })
|
|
354
|
+
]
|
|
355
|
+
},
|
|
356
|
+
t.delegate.id
|
|
357
|
+
)) })
|
|
358
|
+
}
|
|
359
|
+
),
|
|
360
|
+
/* @__PURE__ */ e(
|
|
361
|
+
f,
|
|
362
|
+
{
|
|
363
|
+
title: "Expiring delegations",
|
|
364
|
+
hint: `Ending within ${p} days — an expired one while the person is still out means approvals are stalling.`,
|
|
365
|
+
children: l.expiring.length === 0 ? /* @__PURE__ */ e("p", { className: "px-4 py-4 text-[12px] text-slate-400", children: "Nothing expiring." }) : /* @__PURE__ */ e("ul", { className: "divide-y divide-slate-100 dark:divide-border", children: l.expiring.map((t) => /* @__PURE__ */ a(
|
|
366
|
+
"li",
|
|
367
|
+
{
|
|
368
|
+
className: "flex flex-wrap items-center gap-2 px-4 py-2 text-[12px]",
|
|
369
|
+
children: [
|
|
370
|
+
/* @__PURE__ */ e(
|
|
371
|
+
j,
|
|
372
|
+
{
|
|
373
|
+
className: m(
|
|
374
|
+
"h-3.5 w-3.5",
|
|
375
|
+
t.expired ? "text-red-500" : "text-amber-500"
|
|
376
|
+
)
|
|
377
|
+
}
|
|
378
|
+
),
|
|
379
|
+
/* @__PURE__ */ e(y, { userId: t.user.id, size: "compact" }),
|
|
380
|
+
/* @__PURE__ */ e("span", { className: "text-slate-400", children: "→" }),
|
|
381
|
+
/* @__PURE__ */ e(y, { userId: t.delegate.id, size: "compact" }),
|
|
382
|
+
/* @__PURE__ */ e(
|
|
383
|
+
"span",
|
|
384
|
+
{
|
|
385
|
+
className: m(
|
|
386
|
+
"ml-auto text-[11.5px]",
|
|
387
|
+
t.expired ? "font-semibold text-red-600 dark:text-red-400" : "text-slate-500"
|
|
388
|
+
),
|
|
389
|
+
children: t.expired ? `expired ${N(t.expires_at)}${t.currently_out ? " · still out" : ""}` : `ends ${N(t.expires_at)}`
|
|
390
|
+
}
|
|
391
|
+
)
|
|
392
|
+
]
|
|
393
|
+
},
|
|
394
|
+
t.user.id
|
|
395
|
+
)) })
|
|
396
|
+
}
|
|
397
|
+
)
|
|
287
398
|
] })
|
|
288
399
|
] }),
|
|
289
|
-
|
|
290
|
-
|
|
400
|
+
c && /* @__PURE__ */ e(
|
|
401
|
+
f,
|
|
291
402
|
{
|
|
292
403
|
title: "Records blocked right now",
|
|
293
404
|
hint: "Open records whose entire owner set cannot act (out with no working delegate, suspended, inactive). Live resolution over open instances.",
|
|
294
|
-
children:
|
|
405
|
+
children: i ? i.blocked.length === 0 ? /* @__PURE__ */ a("p", { className: "px-4 py-4 text-[12px] text-slate-400", children: [
|
|
295
406
|
"Nothing blocked — every open record has at least one owner who can act.",
|
|
296
|
-
|
|
297
|
-
] }) : /* @__PURE__ */ a(
|
|
407
|
+
i.no_owner_count > 0 && ` (${i.no_owner_count} resolve no owners at all — an owner-matrix coverage question, see Coverage Gaps.)`
|
|
408
|
+
] }) : /* @__PURE__ */ a(E, { children: [
|
|
298
409
|
/* @__PURE__ */ a("table", { className: "w-full text-[12px]", children: [
|
|
299
410
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ a("tr", { className: "text-left text-[10.5px] uppercase tracking-wide text-slate-400", children: [
|
|
300
411
|
/* @__PURE__ */ e("th", { className: "px-4 py-1.5 font-semibold", children: "Record" }),
|
|
301
412
|
/* @__PURE__ */ e("th", { className: "px-2 py-1.5 font-semibold", children: "State" }),
|
|
302
413
|
/* @__PURE__ */ e("th", { className: "px-2 py-1.5 font-semibold", children: "Owners who cannot act" })
|
|
303
414
|
] }) }),
|
|
304
|
-
/* @__PURE__ */ e("tbody", { children:
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
415
|
+
/* @__PURE__ */ e("tbody", { children: i.blocked.slice(0, 40).map((t) => /* @__PURE__ */ a(
|
|
416
|
+
"tr",
|
|
417
|
+
{
|
|
418
|
+
className: "border-t border-slate-100 dark:border-border",
|
|
419
|
+
children: [
|
|
420
|
+
/* @__PURE__ */ a("td", { className: "px-4 py-1.5", children: [
|
|
421
|
+
/* @__PURE__ */ e(
|
|
422
|
+
"button",
|
|
423
|
+
{
|
|
424
|
+
type: "button",
|
|
425
|
+
onClick: () => b.navigate(`/collections/${t.collection}/${t.item}`),
|
|
426
|
+
className: "text-nvr-navy underline decoration-dotted underline-offset-2 dark:text-nvr-cyan",
|
|
427
|
+
children: t.label
|
|
428
|
+
}
|
|
429
|
+
),
|
|
430
|
+
/* @__PURE__ */ e("span", { className: "ml-1 text-[10.5px] text-slate-400", children: t.collection.replace(/_/g, " ") })
|
|
431
|
+
] }),
|
|
432
|
+
/* @__PURE__ */ e("td", { className: "px-2 py-1.5 text-slate-600 dark:text-muted-foreground", children: t.state ?? "—" }),
|
|
433
|
+
/* @__PURE__ */ e("td", { className: "px-2 py-1.5 text-slate-600 dark:text-muted-foreground", children: t.owners.map((u) => `${u.name} (${u.reason.replace(/_/g, " ")})`).join(", ") })
|
|
434
|
+
]
|
|
435
|
+
},
|
|
436
|
+
`${t.collection}:${t.item}`
|
|
437
|
+
)) })
|
|
320
438
|
] }),
|
|
321
|
-
(
|
|
322
|
-
|
|
323
|
-
|
|
439
|
+
(i.blocked.length > 40 || C) && /* @__PURE__ */ a("p", { className: "px-4 py-2 text-[11.5px] text-slate-400", children: [
|
|
440
|
+
i.blocked.length > 40 ? `Showing 40 of ${i.blocked.length}. ` : "",
|
|
441
|
+
C && /* @__PURE__ */ e(
|
|
442
|
+
"button",
|
|
443
|
+
{
|
|
444
|
+
type: "button",
|
|
445
|
+
onClick: () => b.navigate(C),
|
|
446
|
+
className: "underline decoration-dotted underline-offset-2",
|
|
447
|
+
children: "Full coverage-gap report →"
|
|
448
|
+
}
|
|
449
|
+
)
|
|
324
450
|
] })
|
|
325
451
|
] }) : /* @__PURE__ */ e("p", { className: "px-4 py-4 text-[12px] text-slate-400", children: "Resolving owners…" })
|
|
326
452
|
}
|
|
327
453
|
),
|
|
328
454
|
/* @__PURE__ */ a("p", { className: "flex items-center gap-1 text-[11px] text-slate-400", children: [
|
|
329
455
|
/* @__PURE__ */ e(A, { className: "h-3 w-3" }),
|
|
330
|
-
" Computed live at
|
|
331
|
-
|
|
456
|
+
" Computed live at",
|
|
457
|
+
" ",
|
|
458
|
+
new Date(l.generated_at).toLocaleTimeString(),
|
|
332
459
|
"."
|
|
333
460
|
] })
|
|
334
461
|
] }) })
|
|
335
462
|
] });
|
|
336
463
|
}
|
|
337
464
|
export {
|
|
338
|
-
|
|
465
|
+
se as DelegationConsoleView
|
|
339
466
|
};
|