@nivaro/react 0.3.51 β 0.3.53
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 +47 -3
- package/dist/shared/components/ItemEditForm.js +3885 -3847
- package/dist/shared/components/NotificationBell.js +163 -150
- package/dist/shared/components/PageRenderer.js +600 -549
- package/dist/shared/components/ProfileView.js +36 -34
- package/dist/shared/components/QueryStatStrip.js +96 -89
- package/dist/shared/components/QueryTable.js +214 -215
- package/dist/shared/components/ReportView.js +548 -529
- package/dist/shared/components/alerts/AlertManagerView.js +346 -320
- package/dist/shared/components/item-edit/CatalogPickerField.js +1300 -1219
- package/dist/shared/components/item-edit/FieldAffordances.js +145 -136
- package/dist/shared/components/item-edit/FieldRenderer.js +366 -326
- package/dist/shared/components/item-edit/InlineTableField.js +3047 -2932
- package/dist/shared/components/item-edit/NestedRelationEditor.js +149 -143
- package/dist/shared/components/item-edit/PlanGrid.js +718 -705
- package/dist/shared/components/item-edit/SummaryPanel.js +351 -337
- package/dist/shared/components/item-edit/line-qty.js +115 -53
- package/dist/shared/components/item-edit/save-refusal.js +18 -18
- package/dist/shared/components/item-edit/usePersonalDefaults.js +210 -207
- package/dist/shared/components/panels/CommentPanel.js +204 -197
- package/dist/shared/components/panels/ItemLockBanner.js +318 -291
- package/dist/shared/components/panels/PipelinePanel.js +1388 -1218
- package/dist/shared/components/panels/RecordIntegrityBanner.js +201 -172
- package/dist/shared/components/panels/RevisionsPanel.js +101 -106
- package/dist/shared/components/panels/TransitionRequirementsDialog.js +564 -534
- package/dist/shared/components/panels/requirement-side-effects.js +46 -29
- package/dist/shared/components/queue/QueueItemSheet.js +219 -146
- package/dist/shared/components/queue/QueueWorklist.js +738 -730
- package/dist/shared/components/widgets/ReviewListWidget.js +236 -201
- package/dist/shared/lib/activity-sentence.js +236 -227
- package/dist/shared/lib/record-ref.js +43 -34
- package/package.json +1 -1
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { jsxs as s, jsx as e, Fragment as Y } from "react/jsx-runtime";
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { MessageSquare as
|
|
2
|
+
import { useQueryClient as ve, useQuery as z, useMutation as L } from "@tanstack/react-query";
|
|
3
|
+
import { MessageSquare as De, ChevronDown as Pe, ClipboardPlus as Te, Pencil as Fe, Trash2 as Re, Check as Me, X as Ie, SmilePlus as ke } from "lucide-react";
|
|
4
4
|
import { useState as N, useRef as U, useEffect as Q, useMemo as V } from "react";
|
|
5
|
-
import { createPortal as
|
|
5
|
+
import { createPortal as je } from "react-dom";
|
|
6
6
|
import { toast as I } from "sonner";
|
|
7
|
-
import { useNivaroClient as oe, useItemEditAuth as
|
|
8
|
-
import { useDebounced as
|
|
9
|
-
import { get as W, post as B, patch as
|
|
10
|
-
import { usePresenceOnlinePoll as
|
|
11
|
-
import { useRecordSignalPeers as
|
|
12
|
-
import { invalidateRecordTasks as
|
|
13
|
-
import { formatRelative as le, titleCase as
|
|
14
|
-
import { AgentBadge as
|
|
7
|
+
import { useNivaroClient as oe, useItemEditAuth as Oe, useDrilldown as Le } from "../../context.js";
|
|
8
|
+
import { useDebounced as Ae } from "../../hooks/useDebounced.js";
|
|
9
|
+
import { get as W, post as B, patch as Ke, del as Be } from "../../lib/commands.js";
|
|
10
|
+
import { usePresenceOnlinePoll as Qe } from "../../lib/presence-live.js";
|
|
11
|
+
import { useRecordSignalPeers as ze, useRecordSignalSender as Ue, signalSentence as We } from "../../lib/presence-signals.js";
|
|
12
|
+
import { invalidateRecordTasks as Ge } from "../../lib/record-tasks.js";
|
|
13
|
+
import { formatRelative as le, titleCase as He } from "../../lib/utils.js";
|
|
14
|
+
import { AgentBadge as Xe } from "../AgentBadge.js";
|
|
15
15
|
import { AutolinkedText as se } from "../AutolinkedText.js";
|
|
16
|
-
import { InboundRequestPopover as
|
|
17
|
-
import { useFieldComments as
|
|
18
|
-
import { UserAvatar as
|
|
19
|
-
import { Avatar as
|
|
16
|
+
import { InboundRequestPopover as Je } from "../integrations/InboundRequest.js";
|
|
17
|
+
import { useFieldComments as Ve } from "../item-edit/field-comments-context.js";
|
|
18
|
+
import { UserAvatar as Ze } from "../UserAvatar.js";
|
|
19
|
+
import { Avatar as Ye, AvatarFallback as et } from "../ui/avatar.js";
|
|
20
20
|
import { Button as Z } from "../ui/button.js";
|
|
21
|
-
import { Separator as
|
|
22
|
-
import { Textarea as
|
|
23
|
-
import { RecordEventPathSheet as
|
|
24
|
-
const
|
|
25
|
-
function
|
|
21
|
+
import { Separator as fe } from "../ui/separator.js";
|
|
22
|
+
import { Textarea as tt } from "../ui/textarea.js";
|
|
23
|
+
import { RecordEventPathSheet as nt } from "./IntegrationActivitySection.js";
|
|
24
|
+
const Ne = ["π", "β
", "π", "π", "β€οΈ", "π"];
|
|
25
|
+
function at(t) {
|
|
26
26
|
var d, c, h, m;
|
|
27
27
|
return [(d = t.first_name) == null ? void 0 : d[0], (c = t.last_name) == null ? void 0 : c[0]].filter(Boolean).join("").toUpperCase() || ((m = (h = t.email) == null ? void 0 : h[0]) == null ? void 0 : m.toUpperCase()) || "?";
|
|
28
28
|
}
|
|
@@ -58,10 +58,10 @@ function rt({ comment: t }) {
|
|
|
58
58
|
}
|
|
59
59
|
);
|
|
60
60
|
}
|
|
61
|
-
function
|
|
61
|
+
function ae(t) {
|
|
62
62
|
return [t.first_name, t.last_name].filter(Boolean).join(" ") || t.email;
|
|
63
63
|
}
|
|
64
|
-
function
|
|
64
|
+
function st({
|
|
65
65
|
field: t,
|
|
66
66
|
label: i,
|
|
67
67
|
resolved: d,
|
|
@@ -84,47 +84,47 @@ function at({
|
|
|
84
84
|
}
|
|
85
85
|
) : /* @__PURE__ */ e("span", { "data-comment-field": t, className: m, children: h });
|
|
86
86
|
}
|
|
87
|
-
function
|
|
87
|
+
function ot(t, i) {
|
|
88
88
|
const c = t.slice(0, i).match(/(^|\s)@([a-zA-Z0-9._-]{2,})$/);
|
|
89
89
|
return c ? { start: i - c[2].length - 1, query: c[2] } : null;
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function ge(t) {
|
|
92
92
|
return t.email.split("@")[0];
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function re({
|
|
95
95
|
value: t,
|
|
96
96
|
onChange: i,
|
|
97
97
|
...d
|
|
98
98
|
}) {
|
|
99
|
-
const c = oe(), h = U(null), [m, C] = N(null), [y, w] = N(0), v =
|
|
99
|
+
const c = oe(), h = U(null), [m, C] = N(null), [y, w] = N(0), v = Ae((m == null ? void 0 : m.query) ?? "", 200), { data: q = [] } = z({
|
|
100
100
|
queryKey: ["users", "mention-search", v],
|
|
101
101
|
queryFn: () => c.request(
|
|
102
102
|
W("/users", { limit: 8, sort: "first_name", search: v })
|
|
103
103
|
).then((n) => n.data),
|
|
104
104
|
enabled: !!m && v.length >= 2,
|
|
105
105
|
staleTime: 3e4
|
|
106
|
-
}),
|
|
106
|
+
}), F = Qe(15e3, !!m), { data: E } = z({
|
|
107
107
|
queryKey: ["presence-online"],
|
|
108
108
|
queryFn: () => c.request(
|
|
109
109
|
W("/presence/online")
|
|
110
110
|
),
|
|
111
111
|
enabled: !!m,
|
|
112
|
-
refetchInterval:
|
|
112
|
+
refetchInterval: F,
|
|
113
113
|
staleTime: 5e3
|
|
114
114
|
}), _ = (n) => {
|
|
115
115
|
var p;
|
|
116
|
-
const l = (p =
|
|
116
|
+
const l = (p = E == null ? void 0 : E.data) == null ? void 0 : p.find((b) => String(b.user_id).toUpperCase() === n.toUpperCase());
|
|
117
117
|
return l ? l.is_idle || l.away ? 1 : 0 : 2;
|
|
118
|
-
}, u = [...q].sort((n, l) => _(n.id) - _(l.id)), { data:
|
|
118
|
+
}, u = [...q].sort((n, l) => _(n.id) - _(l.id)), { data: D = [] } = z({
|
|
119
119
|
queryKey: ["mention-roles"],
|
|
120
120
|
queryFn: () => c.request(W("/chat/roles")).then((n) => n.data).catch(() => []),
|
|
121
121
|
enabled: !!m,
|
|
122
122
|
staleTime: 5 * 6e4
|
|
123
|
-
}), S = m ?
|
|
123
|
+
}), S = m ? D.filter(
|
|
124
124
|
(n) => n.name.toLowerCase().replace(/\s+/g, "-").startsWith(v.toLowerCase())
|
|
125
|
-
).slice(0, 3) : [], k = !!m && v.length >= 2 && "owners".startsWith(v.toLowerCase()),
|
|
125
|
+
).slice(0, 3) : [], k = !!m && v.length >= 2 && "owners".startsWith(v.toLowerCase()), P = !!m && v.length >= 2 && (u.length > 0 || k || S.length > 0), o = u.length + (k ? 1 : 0) + S.length, [f, $] = N(null), O = U(null);
|
|
126
126
|
Q(() => {
|
|
127
|
-
if (!
|
|
127
|
+
if (!P || !h.current) {
|
|
128
128
|
$(null);
|
|
129
129
|
return;
|
|
130
130
|
}
|
|
@@ -137,14 +137,14 @@ function ae({
|
|
|
137
137
|
return window.addEventListener("scroll", l, !0), window.addEventListener("resize", p), () => {
|
|
138
138
|
window.removeEventListener("scroll", l, !0), window.removeEventListener("resize", p);
|
|
139
139
|
};
|
|
140
|
-
}, [
|
|
140
|
+
}, [P]);
|
|
141
141
|
function G(n) {
|
|
142
|
-
const l =
|
|
142
|
+
const l = ot(n.value, n.selectionStart ?? n.value.length);
|
|
143
143
|
C(l), l || w(0);
|
|
144
144
|
}
|
|
145
|
-
function
|
|
145
|
+
function T(n) {
|
|
146
146
|
if (!m || !h.current) return;
|
|
147
|
-
const l = h.current.selectionStart ?? t.length, p = n === "__owners__" ? "@owners " : typeof n == "object" && "role" in n ? `@${n.role.toLowerCase().replace(/\s+/g, "-")} ` : `@${
|
|
147
|
+
const l = h.current.selectionStart ?? t.length, p = n === "__owners__" ? "@owners " : typeof n == "object" && "role" in n ? `@${n.role.toLowerCase().replace(/\s+/g, "-")} ` : `@${ge(n)} `, b = t.slice(0, m.start) + p + t.slice(l);
|
|
148
148
|
i(b), C(null), w(0);
|
|
149
149
|
const g = m.start + p.length;
|
|
150
150
|
requestAnimationFrame(() => {
|
|
@@ -153,7 +153,7 @@ function ae({
|
|
|
153
153
|
});
|
|
154
154
|
}
|
|
155
155
|
function H(n) {
|
|
156
|
-
if (
|
|
156
|
+
if (P)
|
|
157
157
|
if (n.key === "ArrowDown")
|
|
158
158
|
n.preventDefault(), w((l) => (l + 1) % o);
|
|
159
159
|
else if (n.key === "ArrowUp")
|
|
@@ -161,16 +161,16 @@ function ae({
|
|
|
161
161
|
else if (n.key === "Enter" || n.key === "Tab") {
|
|
162
162
|
n.preventDefault();
|
|
163
163
|
const l = Math.min(y, o - 1), p = k ? 1 : 0, b = p + u.length;
|
|
164
|
-
if (k && l === 0)
|
|
164
|
+
if (k && l === 0) T("__owners__");
|
|
165
165
|
else if (l >= b) {
|
|
166
166
|
const g = S[l - b];
|
|
167
|
-
g &&
|
|
168
|
-
} else
|
|
167
|
+
g && T({ role: g.name });
|
|
168
|
+
} else T(u[l - p]);
|
|
169
169
|
} else n.key === "Escape" && (n.preventDefault(), C(null));
|
|
170
170
|
}
|
|
171
171
|
return /* @__PURE__ */ s("div", { className: "relative", children: [
|
|
172
172
|
/* @__PURE__ */ e(
|
|
173
|
-
|
|
173
|
+
tt,
|
|
174
174
|
{
|
|
175
175
|
...d,
|
|
176
176
|
ref: h,
|
|
@@ -183,7 +183,7 @@ function ae({
|
|
|
183
183
|
onBlur: () => setTimeout(() => C(null), 150)
|
|
184
184
|
}
|
|
185
185
|
),
|
|
186
|
-
|
|
186
|
+
P && f && je(
|
|
187
187
|
/* @__PURE__ */ s(
|
|
188
188
|
"div",
|
|
189
189
|
{
|
|
@@ -198,7 +198,7 @@ function ae({
|
|
|
198
198
|
{
|
|
199
199
|
type: "button",
|
|
200
200
|
onMouseDown: (n) => {
|
|
201
|
-
n.preventDefault(),
|
|
201
|
+
n.preventDefault(), T("__owners__");
|
|
202
202
|
},
|
|
203
203
|
onMouseEnter: () => w(0),
|
|
204
204
|
className: `flex w-full items-center gap-2.5 px-2.5 py-1.5 text-left transition-colors ${y === 0 ? "bg-nvr-cyan/10" : ""}`,
|
|
@@ -219,7 +219,7 @@ function ae({
|
|
|
219
219
|
{
|
|
220
220
|
type: "button",
|
|
221
221
|
onMouseDown: (A) => {
|
|
222
|
-
A.preventDefault(),
|
|
222
|
+
A.preventDefault(), T(n);
|
|
223
223
|
},
|
|
224
224
|
onMouseEnter: () => w(p),
|
|
225
225
|
className: `flex w-full items-center gap-2.5 px-2.5 py-1.5 text-left transition-colors ${p === y ? "bg-nvr-cyan/10" : ""}`,
|
|
@@ -243,7 +243,7 @@ function ae({
|
|
|
243
243
|
n.ooo_end ? ` until ${String(n.ooo_end).slice(0, 10)}` : ""
|
|
244
244
|
] }),
|
|
245
245
|
"@",
|
|
246
|
-
|
|
246
|
+
ge(n),
|
|
247
247
|
(n.title || n.department) && /* @__PURE__ */ s("span", { className: "text-slate-400 dark:text-slate-500", children: [
|
|
248
248
|
" Β· ",
|
|
249
249
|
[n.title, n.department].filter(Boolean).join(", ")
|
|
@@ -262,7 +262,7 @@ function ae({
|
|
|
262
262
|
{
|
|
263
263
|
type: "button",
|
|
264
264
|
onMouseDown: (b) => {
|
|
265
|
-
b.preventDefault(),
|
|
265
|
+
b.preventDefault(), T({ role: n.name });
|
|
266
266
|
},
|
|
267
267
|
onMouseEnter: () => w(p),
|
|
268
268
|
className: `flex w-full items-center gap-2.5 px-2.5 py-1.5 text-left transition-colors ${p === y ? "bg-nvr-cyan/10" : ""}`,
|
|
@@ -284,7 +284,7 @@ function ae({
|
|
|
284
284
|
)
|
|
285
285
|
] });
|
|
286
286
|
}
|
|
287
|
-
function
|
|
287
|
+
function ye(t) {
|
|
288
288
|
if (t.kind === "comment") return "people";
|
|
289
289
|
switch (t.note.source) {
|
|
290
290
|
case "note":
|
|
@@ -296,24 +296,24 @@ function fe(t) {
|
|
|
296
296
|
return "system";
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
|
-
const
|
|
299
|
+
const lt = {
|
|
300
300
|
people: "People",
|
|
301
301
|
system: "System",
|
|
302
302
|
integration: "Integration"
|
|
303
|
-
},
|
|
304
|
-
function
|
|
303
|
+
}, it = "integrations:";
|
|
304
|
+
function dt({
|
|
305
305
|
note: t,
|
|
306
306
|
collection: i,
|
|
307
307
|
item: d
|
|
308
308
|
}) {
|
|
309
|
-
var
|
|
310
|
-
const c =
|
|
309
|
+
var P;
|
|
310
|
+
const c = Le(), [h, m] = N(!1), C = t.source === "external" && !!t.provider && !t.provider.startsWith(it), y = oe(), w = ve(), [v, q] = N(!1), F = L({
|
|
311
311
|
mutationFn: (o) => y.request(B(`/comments/${t.comment_id}/reactions`, { emoji: o })),
|
|
312
312
|
onSuccess: () => {
|
|
313
313
|
q(!1), w.invalidateQueries({ queryKey: ["comments-related"] }), w.invalidateQueries({ queryKey: ["row-comment-counts"] });
|
|
314
314
|
},
|
|
315
315
|
onError: () => I.error("Failed to react")
|
|
316
|
-
}), [
|
|
316
|
+
}), [E, _] = N(!1), u = L({
|
|
317
317
|
mutationFn: () => y.request(
|
|
318
318
|
B(`/integration-events/${encodeURIComponent(t.provider ?? "")}/replay`, {
|
|
319
319
|
entry_id: t.id.replace(/^external:/, "")
|
|
@@ -331,7 +331,7 @@ function it({
|
|
|
331
331
|
const f = ($ = o == null ? void 0 : o.response) == null ? void 0 : $.error;
|
|
332
332
|
I.error(f ?? (o == null ? void 0 : o.message) ?? "Replay failed", { duration: 8e3 });
|
|
333
333
|
}
|
|
334
|
-
}),
|
|
334
|
+
}), D = t.link ? () => {
|
|
335
335
|
const o = t.link;
|
|
336
336
|
if (!o) return;
|
|
337
337
|
const f = document.querySelector(`[data-o2m-row="${o.collection}:${o.item_id}"]`);
|
|
@@ -340,18 +340,18 @@ function it({
|
|
|
340
340
|
return;
|
|
341
341
|
}
|
|
342
342
|
c == null || c.open({ collection: o.collection, itemId: o.item_id });
|
|
343
|
-
} : null, S = t.source === "transition" ? "border-nvr-cyan/30 bg-nvr-cyan/[0.06] text-nvr-navy dark:text-nvr-cyan" : t.source === "addendum" ? "border-amber-200 bg-amber-50/60 text-amber-700 dark:border-amber-900/40 dark:bg-amber-900/10 dark:text-amber-400" : t.source === "external" || t.source === "inbound" ? "border-sky-200 bg-sky-50/70 text-sky-700 dark:border-sky-900/40 dark:bg-sky-900/10 dark:text-sky-300" : t.source === "import" ? "border-emerald-200 bg-emerald-50/70 text-emerald-700 dark:border-emerald-900/40 dark:bg-emerald-900/10 dark:text-emerald-300" : "border-slate-200 bg-slate-50/80 text-slate-600 dark:border-border dark:bg-muted/40 dark:text-slate-300", k = t.source === "import" && ((
|
|
343
|
+
} : null, S = t.source === "transition" ? "border-nvr-cyan/30 bg-nvr-cyan/[0.06] text-nvr-navy dark:text-nvr-cyan" : t.source === "addendum" ? "border-amber-200 bg-amber-50/60 text-amber-700 dark:border-amber-900/40 dark:bg-amber-900/10 dark:text-amber-400" : t.source === "external" || t.source === "inbound" ? "border-sky-200 bg-sky-50/70 text-sky-700 dark:border-sky-900/40 dark:bg-sky-900/10 dark:text-sky-300" : t.source === "import" ? "border-emerald-200 bg-emerald-50/70 text-emerald-700 dark:border-emerald-900/40 dark:bg-emerald-900/10 dark:text-emerald-300" : "border-slate-200 bg-slate-50/80 text-slate-600 dark:border-border dark:bg-muted/40 dark:text-slate-300", k = t.source === "import" && ((P = t.import) != null && P.file_id) ? t.import : null;
|
|
344
344
|
return /* @__PURE__ */ s("div", { className: "flex gap-3", "data-recorded-note": t.source, children: [
|
|
345
345
|
/* @__PURE__ */ e("div", { className: "mt-1 h-8 w-8 shrink-0", "aria-hidden": !0 }),
|
|
346
346
|
/* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: [
|
|
347
347
|
/* @__PURE__ */ s("div", { className: "flex flex-wrap items-center gap-x-2 gap-y-1", children: [
|
|
348
348
|
/* @__PURE__ */ e("span", { className: `rounded border px-1.5 py-px text-[10px] font-medium ${S}`, children: t.label }),
|
|
349
349
|
t.user_name && /* @__PURE__ */ e("span", { className: "text-[12px] font-medium text-slate-700 dark:text-slate-200", children: t.user_name }),
|
|
350
|
-
t.context && (
|
|
350
|
+
t.context && (D ? /* @__PURE__ */ e(
|
|
351
351
|
"button",
|
|
352
352
|
{
|
|
353
353
|
type: "button",
|
|
354
|
-
onClick:
|
|
354
|
+
onClick: D,
|
|
355
355
|
className: "truncate text-[11px] text-nvr-navy underline-offset-2 hover:underline dark:text-nvr-cyan",
|
|
356
356
|
"data-line-comment-link": !0,
|
|
357
357
|
children: t.context
|
|
@@ -370,7 +370,7 @@ function it({
|
|
|
370
370
|
) : /* @__PURE__ */ e("span", { className: "truncate text-[11px] text-slate-400", children: t.context })),
|
|
371
371
|
/* @__PURE__ */ e("span", { className: "text-[11px] text-slate-400", children: le(t.created_at) }),
|
|
372
372
|
t.source === "inbound" && t.inbound && /* @__PURE__ */ e(
|
|
373
|
-
|
|
373
|
+
Je,
|
|
374
374
|
{
|
|
375
375
|
activityId: t.inbound.activity_id,
|
|
376
376
|
callerName: t.label,
|
|
@@ -405,13 +405,13 @@ function it({
|
|
|
405
405
|
"button",
|
|
406
406
|
{
|
|
407
407
|
type: "button",
|
|
408
|
-
onClick: () =>
|
|
408
|
+
onClick: () => E ? u.mutate() : _(!0),
|
|
409
409
|
onBlur: () => _(!1),
|
|
410
410
|
disabled: u.isPending,
|
|
411
411
|
"data-note-replay": t.id,
|
|
412
|
-
className: `rounded px-1.5 py-px text-[10.5px] font-medium transition-colors ${
|
|
412
|
+
className: `rounded px-1.5 py-px text-[10.5px] font-medium transition-colors ${E ? "bg-sky-600 text-white" : "text-sky-700 hover:bg-sky-50 dark:text-sky-300 dark:hover:bg-sky-900/20"}`,
|
|
413
413
|
"data-tip": "Re-apply this event from its stored payload",
|
|
414
|
-
children: u.isPending ? "Replayingβ¦" :
|
|
414
|
+
children: u.isPending ? "Replayingβ¦" : E ? "Replay this event?" : "Replay"
|
|
415
415
|
}
|
|
416
416
|
)
|
|
417
417
|
] }),
|
|
@@ -421,7 +421,7 @@ function it({
|
|
|
421
421
|
"button",
|
|
422
422
|
{
|
|
423
423
|
type: "button",
|
|
424
|
-
onClick: () =>
|
|
424
|
+
onClick: () => F.mutate(o.emoji),
|
|
425
425
|
className: `inline-flex items-center gap-1 rounded-full border px-1.5 py-px text-[11px] transition-colors ${o.mine ? "border-nvr-cyan/40 bg-nvr-cyan/10 text-nvr-navy dark:text-nvr-cyan" : "border-slate-200 bg-slate-50 text-slate-600 hover:border-slate-300 dark:border-border dark:bg-muted dark:text-slate-300"}`,
|
|
426
426
|
children: [
|
|
427
427
|
o.emoji,
|
|
@@ -438,14 +438,14 @@ function it({
|
|
|
438
438
|
onClick: () => q((o) => !o),
|
|
439
439
|
className: "rounded p-0.5 text-slate-300 transition-colors hover:bg-slate-100 hover:text-slate-500 dark:hover:bg-muted",
|
|
440
440
|
"aria-label": "Add reaction",
|
|
441
|
-
children: /* @__PURE__ */ e(
|
|
441
|
+
children: /* @__PURE__ */ e(ke, { className: "h-3.5 w-3.5" })
|
|
442
442
|
}
|
|
443
443
|
),
|
|
444
|
-
v && /* @__PURE__ */ e("span", { className: "absolute bottom-6 left-0 z-20 flex gap-0.5 rounded-full border border-slate-200 bg-white px-1.5 py-1 shadow-lg dark:border-border dark:bg-popover", children:
|
|
444
|
+
v && /* @__PURE__ */ e("span", { className: "absolute bottom-6 left-0 z-20 flex gap-0.5 rounded-full border border-slate-200 bg-white px-1.5 py-1 shadow-lg dark:border-border dark:bg-popover", children: Ne.map((o) => /* @__PURE__ */ e(
|
|
445
445
|
"button",
|
|
446
446
|
{
|
|
447
447
|
type: "button",
|
|
448
|
-
onClick: () =>
|
|
448
|
+
onClick: () => F.mutate(o),
|
|
449
449
|
className: "rounded-full px-1 text-[14px] hover:bg-muted",
|
|
450
450
|
children: o
|
|
451
451
|
},
|
|
@@ -455,7 +455,7 @@ function it({
|
|
|
455
455
|
] })
|
|
456
456
|
] }),
|
|
457
457
|
C && t.provider && /* @__PURE__ */ e(
|
|
458
|
-
|
|
458
|
+
nt,
|
|
459
459
|
{
|
|
460
460
|
target: h ? {
|
|
461
461
|
source: t.provider,
|
|
@@ -468,7 +468,7 @@ function it({
|
|
|
468
468
|
)
|
|
469
469
|
] });
|
|
470
470
|
}
|
|
471
|
-
function
|
|
471
|
+
function Ft({
|
|
472
472
|
collection: t,
|
|
473
473
|
item: i,
|
|
474
474
|
title: d,
|
|
@@ -477,96 +477,96 @@ function Tt({
|
|
|
477
477
|
onQueueComment: m,
|
|
478
478
|
onUnsentDraft: C
|
|
479
479
|
}) {
|
|
480
|
-
const y = oe(), { userId: w } =
|
|
480
|
+
const y = oe(), { userId: w } = Oe(), v = ve(), q = Ve(), [F, E] = N(!1), _ = U(!1);
|
|
481
481
|
Q(() => {
|
|
482
|
-
!_.current && c !== void 0 && (_.current = !0,
|
|
482
|
+
!_.current && c !== void 0 && (_.current = !0, E(c));
|
|
483
483
|
}, [c]);
|
|
484
|
-
const [u,
|
|
484
|
+
const [u, D] = N(""), S = U(C);
|
|
485
485
|
S.current = C, Q(() => {
|
|
486
|
-
var
|
|
487
|
-
(
|
|
486
|
+
var a;
|
|
487
|
+
(a = S.current) == null || a.call(S, u);
|
|
488
488
|
}, [u]);
|
|
489
|
-
const [k,
|
|
490
|
-
var
|
|
489
|
+
const [k, P] = N(!1), o = async () => {
|
|
490
|
+
var a;
|
|
491
491
|
if (!(!u.trim() || k)) {
|
|
492
|
-
|
|
492
|
+
P(!0);
|
|
493
493
|
try {
|
|
494
|
-
const
|
|
494
|
+
const r = await y.request(
|
|
495
495
|
B("/ai/cleanup", { text: u })
|
|
496
496
|
);
|
|
497
|
-
(
|
|
497
|
+
(a = r.data) != null && a.text && D(r.data.text);
|
|
498
498
|
} catch {
|
|
499
499
|
} finally {
|
|
500
|
-
|
|
500
|
+
P(!1);
|
|
501
501
|
}
|
|
502
502
|
}
|
|
503
|
-
}, f =
|
|
503
|
+
}, f = ze(t, i, "note"), $ = Ue(t, i, "note"), O = U(0);
|
|
504
504
|
Q(() => {
|
|
505
505
|
if (!u.trim()) {
|
|
506
506
|
O.current && $("stop"), O.current = 0;
|
|
507
507
|
return;
|
|
508
508
|
}
|
|
509
|
-
const
|
|
510
|
-
|
|
509
|
+
const a = Date.now();
|
|
510
|
+
a - O.current < 2500 || (O.current = a, $("start"));
|
|
511
511
|
}, [u, $]), Q(() => () => $("stop"), [$]);
|
|
512
|
-
const [G,
|
|
512
|
+
const [G, T] = N(null), [H, n] = N(null), [l, p] = N(""), b = !i || i === "new", g = ["comments", t, String(i)], { data: j, isLoading: A, isError: we } = z({
|
|
513
513
|
queryKey: g,
|
|
514
|
-
queryFn: () => y.request(W("/comments", { collection: t, item: i })).then((
|
|
514
|
+
queryFn: () => y.request(W("/comments", { collection: t, item: i })).then((a) => a.data),
|
|
515
515
|
enabled: !b
|
|
516
|
-
}), ie = V(() => (j ?? []).filter((
|
|
516
|
+
}), ie = V(() => (j ?? []).filter((a) => !a.deleted), [j]), { data: _e } = z({
|
|
517
517
|
queryKey: ["comments-related", t, String(i)],
|
|
518
|
-
queryFn: () => y.request(W("/comments/related", { collection: t, item: i })).then((
|
|
518
|
+
queryFn: () => y.request(W("/comments/related", { collection: t, item: i })).then((a) => a.data ?? []).catch(() => []),
|
|
519
519
|
enabled: !b,
|
|
520
520
|
staleTime: 3e4
|
|
521
|
-
}), de =
|
|
522
|
-
const
|
|
523
|
-
return [...
|
|
524
|
-
}, [ie, de]), [X,
|
|
525
|
-
const
|
|
526
|
-
for (const
|
|
527
|
-
return
|
|
528
|
-
}, [
|
|
529
|
-
const
|
|
530
|
-
return
|
|
531
|
-
}, [
|
|
532
|
-
const x = new Set(
|
|
533
|
-
return x.has(
|
|
534
|
-
}),
|
|
535
|
-
mutationFn: (
|
|
521
|
+
}), de = _e ?? [], R = V(() => {
|
|
522
|
+
const a = ie.map((x) => ({ kind: "comment", at: x.created_at, comment: x })), r = de.map((x) => ({ kind: "related", at: x.created_at, note: x }));
|
|
523
|
+
return [...a, ...r].sort((x, K) => new Date(K.at).getTime() - new Date(x.at).getTime());
|
|
524
|
+
}, [ie, de]), [X, Ce] = N(() => /* @__PURE__ */ new Set()), [J, Se] = N(""), ce = V(() => {
|
|
525
|
+
const a = { people: 0, system: 0, integration: 0 };
|
|
526
|
+
for (const r of R) a[ye(r)]++;
|
|
527
|
+
return a;
|
|
528
|
+
}, [R]), me = b ? (h ?? []).length : ce.people, ee = V(() => {
|
|
529
|
+
const a = J.trim().toLowerCase();
|
|
530
|
+
return R.filter((r) => X.has(ye(r)) ? !1 : a ? (r.kind === "comment" ? `${r.comment.text} ${ae(r.comment.user)}` : `${r.note.text} ${r.note.user_name ?? ""} ${r.note.label} ${r.note.context ?? ""} ${r.note.provider ?? ""}`).toLowerCase().includes(a) : !0);
|
|
531
|
+
}, [R, X, J]), $e = (a) => Ce((r) => {
|
|
532
|
+
const x = new Set(r);
|
|
533
|
+
return x.has(a) ? x.delete(a) : x.add(a), x;
|
|
534
|
+
}), qe = X.size > 0 || J.trim() !== "", te = L({
|
|
535
|
+
mutationFn: (a) => y.request(B("/comments", { collection: t, item: i, text: a })),
|
|
536
536
|
onSuccess: () => {
|
|
537
|
-
v.invalidateQueries({ queryKey: g }),
|
|
537
|
+
v.invalidateQueries({ queryKey: g }), D("");
|
|
538
538
|
},
|
|
539
539
|
onError: () => I.error("Failed to post comment")
|
|
540
|
-
}),
|
|
541
|
-
mutationFn: ({ id:
|
|
540
|
+
}), ue = L({
|
|
541
|
+
mutationFn: ({ id: a, text: r }) => y.request(Ke(`/comments/${a}`, { text: r })),
|
|
542
542
|
onSuccess: () => {
|
|
543
|
-
v.invalidateQueries({ queryKey: g }),
|
|
543
|
+
v.invalidateQueries({ queryKey: g }), T(null), p("");
|
|
544
544
|
},
|
|
545
545
|
onError: () => I.error("Failed to update comment")
|
|
546
546
|
}), ne = L({
|
|
547
|
-
mutationFn: (
|
|
547
|
+
mutationFn: (a) => y.request(Be(`/comments/${a}`)),
|
|
548
548
|
onSuccess: () => v.invalidateQueries({ queryKey: g }),
|
|
549
549
|
onError: () => I.error("Failed to delete comment")
|
|
550
|
-
}),
|
|
551
|
-
mutationFn: ({ id:
|
|
550
|
+
}), pe = L({
|
|
551
|
+
mutationFn: ({ id: a, emoji: r }) => y.request(B(`/comments/${a}/reactions`, { emoji: r })),
|
|
552
552
|
onSuccess: () => v.invalidateQueries({ queryKey: g }),
|
|
553
553
|
onError: () => I.error("Failed to react")
|
|
554
|
-
}), [
|
|
555
|
-
mutationFn: (
|
|
554
|
+
}), [xe, he] = N(null), Ee = L({
|
|
555
|
+
mutationFn: (a) => y.request(
|
|
556
556
|
B("/tasks", {
|
|
557
557
|
collection: t,
|
|
558
558
|
item: i,
|
|
559
|
-
title:
|
|
559
|
+
title: a.text.replace(/<[^>]*>/g, "").replace(/@\[([^\]]+)\]/g, "@$1").slice(0, 200),
|
|
560
560
|
assignee: w
|
|
561
561
|
})
|
|
562
562
|
),
|
|
563
563
|
onSuccess: () => {
|
|
564
|
-
|
|
564
|
+
Ge(v, t, i), I.success("Task created from comment β assigned to you");
|
|
565
565
|
},
|
|
566
566
|
onError: () => I.error("Could not create a task")
|
|
567
567
|
});
|
|
568
|
-
function
|
|
569
|
-
|
|
568
|
+
function be(a) {
|
|
569
|
+
a.preventDefault(), u.trim() && (b && m ? (m(u.trim()), D("")) : te.mutate(u.trim()));
|
|
570
570
|
}
|
|
571
571
|
return (
|
|
572
572
|
// Addressable from elsewhere (the summary panel jumps here), which needs
|
|
@@ -575,7 +575,7 @@ function Tt({
|
|
|
575
575
|
"div",
|
|
576
576
|
{
|
|
577
577
|
"data-panel": "notes",
|
|
578
|
-
"data-panel-expanded":
|
|
578
|
+
"data-panel-expanded": F ? "true" : "false",
|
|
579
579
|
className: "overflow-hidden rounded-xl border border-slate-200 bg-white dark:bg-card dark:border-border",
|
|
580
580
|
children: [
|
|
581
581
|
/* @__PURE__ */ s(
|
|
@@ -583,25 +583,32 @@ function Tt({
|
|
|
583
583
|
{
|
|
584
584
|
type: "button",
|
|
585
585
|
"data-panel-toggle": "notes",
|
|
586
|
-
onClick: () =>
|
|
586
|
+
onClick: () => E((a) => !a),
|
|
587
587
|
className: "flex w-full flex-col px-5 py-3.5 text-left transition-colors hover:bg-slate-50/50 dark:hover:bg-white/[0.02]",
|
|
588
588
|
children: [
|
|
589
589
|
/* @__PURE__ */ s("span", { className: "flex w-full items-center gap-2.5", children: [
|
|
590
|
-
/* @__PURE__ */ e(
|
|
590
|
+
/* @__PURE__ */ e(De, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }),
|
|
591
591
|
/* @__PURE__ */ e("span", { className: "text-[13px] font-medium text-slate-800 dark:text-slate-200", children: d || "Comments" }),
|
|
592
|
-
|
|
592
|
+
me > 0 && /* @__PURE__ */ e(
|
|
593
|
+
"span",
|
|
594
|
+
{
|
|
595
|
+
className: "rounded-full bg-slate-100 px-1.5 py-px text-[10.5px] font-semibold tabular-nums text-slate-500 dark:bg-muted dark:text-slate-400",
|
|
596
|
+
"data-notes-badge": !0,
|
|
597
|
+
children: me
|
|
598
|
+
}
|
|
599
|
+
),
|
|
593
600
|
/* @__PURE__ */ e(
|
|
594
|
-
|
|
601
|
+
Pe,
|
|
595
602
|
{
|
|
596
|
-
className: `ml-auto h-3.5 w-3.5 shrink-0 text-slate-400 transition-transform duration-150${
|
|
603
|
+
className: `ml-auto h-3.5 w-3.5 shrink-0 text-slate-400 transition-transform duration-150${F ? " rotate-180" : ""}`
|
|
597
604
|
}
|
|
598
605
|
)
|
|
599
606
|
] }),
|
|
600
|
-
!
|
|
601
|
-
const
|
|
607
|
+
!F && !b && R.length > 0 && (() => {
|
|
608
|
+
const a = R[0], r = a.kind === "comment" ? ae(a.comment.user) : a.note.user_name ?? "System", x = (a.kind === "comment" ? a.comment.text : a.note.text).replace(/<[^>]*>/g, " ").replace(/@\[([^\]]+)\]/g, "@$1").replace(/\s+/g, " ").trim();
|
|
602
609
|
return x ? /* @__PURE__ */ s("span", { className: "mt-1 w-full truncate pl-6 text-[11.5px] text-slate-400", children: [
|
|
603
610
|
/* @__PURE__ */ s("span", { className: "font-medium text-slate-500 dark:text-slate-400", children: [
|
|
604
|
-
|
|
611
|
+
r,
|
|
605
612
|
":"
|
|
606
613
|
] }),
|
|
607
614
|
" ",
|
|
@@ -611,13 +618,13 @@ function Tt({
|
|
|
611
618
|
]
|
|
612
619
|
}
|
|
613
620
|
),
|
|
614
|
-
|
|
615
|
-
/* @__PURE__ */ s("form", { onSubmit:
|
|
621
|
+
F && /* @__PURE__ */ e("div", { className: "border-t border-slate-100 px-5 py-4 dark:border-border/60", children: b ? /* @__PURE__ */ s("div", { className: "space-y-4", children: [
|
|
622
|
+
/* @__PURE__ */ s("form", { onSubmit: be, className: "space-y-2", children: [
|
|
616
623
|
/* @__PURE__ */ e(
|
|
617
|
-
|
|
624
|
+
re,
|
|
618
625
|
{
|
|
619
626
|
value: u,
|
|
620
|
-
onChange:
|
|
627
|
+
onChange: D,
|
|
621
628
|
placeholder: "Write a commentβ¦",
|
|
622
629
|
rows: 3,
|
|
623
630
|
className: "text-[13px]"
|
|
@@ -629,26 +636,26 @@ function Tt({
|
|
|
629
636
|
] })
|
|
630
637
|
] }),
|
|
631
638
|
(h ?? []).length > 0 && /* @__PURE__ */ s("div", { className: "space-y-2", children: [
|
|
632
|
-
/* @__PURE__ */ e(
|
|
633
|
-
(h ?? []).map((
|
|
639
|
+
/* @__PURE__ */ e(fe, {}),
|
|
640
|
+
(h ?? []).map((a, r) => /* @__PURE__ */ s(
|
|
634
641
|
"div",
|
|
635
642
|
{
|
|
636
643
|
className: "flex items-start gap-2.5 rounded-lg border border-dashed border-amber-200/70 bg-amber-50/40 px-3 py-2 dark:border-amber-500/20 dark:bg-amber-500/5",
|
|
637
644
|
children: [
|
|
638
645
|
/* @__PURE__ */ e("span", { className: "mt-0.5 inline-flex shrink-0 items-center rounded-full bg-amber-100 px-1.5 py-0.5 text-[10px] font-medium text-amber-600 dark:bg-amber-500/15 dark:text-amber-400", children: "Pending" }),
|
|
639
|
-
/* @__PURE__ */ e("p", { className: "text-[13px] leading-relaxed text-slate-600 dark:text-slate-300", children:
|
|
646
|
+
/* @__PURE__ */ e("p", { className: "text-[13px] leading-relaxed text-slate-600 dark:text-slate-300", children: a })
|
|
640
647
|
]
|
|
641
648
|
},
|
|
642
|
-
|
|
649
|
+
r
|
|
643
650
|
))
|
|
644
651
|
] })
|
|
645
652
|
] }) : /* @__PURE__ */ s(Y, { children: [
|
|
646
|
-
/* @__PURE__ */ s("form", { onSubmit:
|
|
653
|
+
/* @__PURE__ */ s("form", { onSubmit: be, className: "space-y-2", children: [
|
|
647
654
|
/* @__PURE__ */ e(
|
|
648
|
-
|
|
655
|
+
re,
|
|
649
656
|
{
|
|
650
657
|
value: u,
|
|
651
|
-
onChange:
|
|
658
|
+
onChange: D,
|
|
652
659
|
placeholder: "Write a commentβ¦",
|
|
653
660
|
rows: 3,
|
|
654
661
|
className: "text-[13px]"
|
|
@@ -679,95 +686,95 @@ function Tt({
|
|
|
679
686
|
"data-note-typing": !0,
|
|
680
687
|
children: [
|
|
681
688
|
/* @__PURE__ */ e("span", { className: "h-1.5 w-1.5 animate-pulse rounded-full bg-nvr-cyan" }),
|
|
682
|
-
|
|
689
|
+
We(f, "writing a note"),
|
|
683
690
|
"β¦"
|
|
684
691
|
]
|
|
685
692
|
}
|
|
686
693
|
),
|
|
687
|
-
/* @__PURE__ */ e(
|
|
688
|
-
|
|
689
|
-
["people", "system", "integration"].map((
|
|
690
|
-
const
|
|
694
|
+
/* @__PURE__ */ e(fe, { className: "my-4" }),
|
|
695
|
+
R.length > 0 && /* @__PURE__ */ s("div", { className: "mb-3 flex flex-wrap items-center gap-1.5", "data-notes-filters": !0, children: [
|
|
696
|
+
["people", "system", "integration"].map((a) => {
|
|
697
|
+
const r = !X.has(a), x = ce[a];
|
|
691
698
|
return /* @__PURE__ */ s(
|
|
692
699
|
"button",
|
|
693
700
|
{
|
|
694
701
|
type: "button",
|
|
695
|
-
onClick: () =>
|
|
696
|
-
"aria-pressed":
|
|
697
|
-
"data-notes-filter":
|
|
698
|
-
disabled: x === 0 &&
|
|
699
|
-
className: `inline-flex items-center gap-1 rounded-full border px-2 py-px text-[11px] font-medium transition-colors ${
|
|
700
|
-
title:
|
|
702
|
+
onClick: () => $e(a),
|
|
703
|
+
"aria-pressed": r,
|
|
704
|
+
"data-notes-filter": a,
|
|
705
|
+
disabled: x === 0 && r,
|
|
706
|
+
className: `inline-flex items-center gap-1 rounded-full border px-2 py-px text-[11px] font-medium transition-colors ${r ? "border-nvr-cyan/40 bg-nvr-cyan/10 text-nvr-navy dark:text-nvr-cyan" : "border-slate-200 text-slate-400 line-through decoration-slate-300 dark:border-border"} disabled:opacity-50`,
|
|
707
|
+
title: a === "people" ? "Comments and notes people wrote" : a === "system" ? "State changes, change reasons, addendums and imports" : "Events an integration recorded",
|
|
701
708
|
children: [
|
|
702
|
-
|
|
709
|
+
lt[a],
|
|
703
710
|
/* @__PURE__ */ e("span", { className: "tabular-nums text-[10px] opacity-70", children: x })
|
|
704
711
|
]
|
|
705
712
|
},
|
|
706
|
-
|
|
713
|
+
a
|
|
707
714
|
);
|
|
708
715
|
}),
|
|
709
716
|
/* @__PURE__ */ e(
|
|
710
717
|
"input",
|
|
711
718
|
{
|
|
712
719
|
value: J,
|
|
713
|
-
onChange: (
|
|
720
|
+
onChange: (a) => Se(a.target.value),
|
|
714
721
|
placeholder: "Search notesβ¦",
|
|
715
722
|
"aria-label": "Search notes",
|
|
716
723
|
"data-notes-search": !0,
|
|
717
724
|
className: "ml-auto h-6 w-[150px] rounded-md border border-slate-200 bg-background px-2 text-[11.5px] dark:border-border"
|
|
718
725
|
}
|
|
719
726
|
),
|
|
720
|
-
|
|
727
|
+
qe && /* @__PURE__ */ s("span", { className: "text-[10.5px] tabular-nums text-slate-400", "data-notes-shown": !0, children: [
|
|
721
728
|
ee.length,
|
|
722
729
|
" of ",
|
|
723
|
-
|
|
730
|
+
R.length
|
|
724
731
|
] })
|
|
725
732
|
] }),
|
|
726
|
-
A ? /* @__PURE__ */ e("div", { className: "space-y-4", children: ["a", "b"].map((
|
|
733
|
+
A ? /* @__PURE__ */ e("div", { className: "space-y-4", children: ["a", "b"].map((a) => /* @__PURE__ */ s("div", { className: "flex gap-3", children: [
|
|
727
734
|
/* @__PURE__ */ e("div", { className: "h-8 w-8 shrink-0 animate-pulse rounded-full bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }),
|
|
728
735
|
/* @__PURE__ */ s("div", { className: "flex-1 space-y-1.5", children: [
|
|
729
736
|
/* @__PURE__ */ e("div", { className: "h-3 w-32 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }),
|
|
730
737
|
/* @__PURE__ */ e("div", { className: "h-3 w-full animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" })
|
|
731
738
|
] })
|
|
732
|
-
] },
|
|
733
|
-
if (
|
|
739
|
+
] }, a)) }) : we ? /* @__PURE__ */ e("p", { className: "py-6 text-center text-[12px] text-red-500", children: "Failed to load comments." }) : R.length === 0 ? /* @__PURE__ */ e("p", { className: "py-6 text-center text-[12px] text-slate-400", children: "No notes yet." }) : ee.length === 0 ? /* @__PURE__ */ e("p", { className: "py-6 text-center text-[12px] text-slate-400", children: "No notes match β clear the search or turn a filter back on." }) : /* @__PURE__ */ e("div", { className: "nvr-stagger-direct space-y-4", children: ee.map((a) => {
|
|
740
|
+
if (a.kind === "related")
|
|
734
741
|
return /* @__PURE__ */ e("div", { className: "nvr-section-enter", children: /* @__PURE__ */ e(
|
|
735
|
-
|
|
742
|
+
dt,
|
|
736
743
|
{
|
|
737
|
-
note:
|
|
744
|
+
note: a.note,
|
|
738
745
|
collection: t,
|
|
739
746
|
item: String(i)
|
|
740
747
|
}
|
|
741
|
-
) },
|
|
742
|
-
const
|
|
748
|
+
) }, a.note.id);
|
|
749
|
+
const r = a.comment, x = w === r.user.id, K = G === r.id;
|
|
743
750
|
return /* @__PURE__ */ s("div", { className: "nvr-section-enter group flex gap-3", children: [
|
|
744
751
|
/* @__PURE__ */ e(
|
|
745
|
-
|
|
752
|
+
Ze,
|
|
746
753
|
{
|
|
747
|
-
userId:
|
|
754
|
+
userId: r.user.id,
|
|
748
755
|
className: "h-8 w-8",
|
|
749
|
-
fallback: /* @__PURE__ */ e(
|
|
756
|
+
fallback: /* @__PURE__ */ e(Ye, { className: "h-8 w-8 shrink-0", children: /* @__PURE__ */ e(et, { className: "bg-nvr-cyan/15 text-[11px] font-bold text-nvr-navy", children: at(r.user) }) })
|
|
750
757
|
}
|
|
751
758
|
),
|
|
752
759
|
/* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: [
|
|
753
760
|
/* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
|
|
754
|
-
/* @__PURE__ */ e("span", { className: "text-[13px] font-medium text-slate-800", children:
|
|
755
|
-
/* @__PURE__ */ e(
|
|
756
|
-
/* @__PURE__ */ e("span", { className: "text-[11px] text-slate-400", children: le(
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
761
|
+
/* @__PURE__ */ e("span", { className: "text-[13px] font-medium text-slate-800", children: ae(r.user) }),
|
|
762
|
+
/* @__PURE__ */ e(Xe, { label: r.via_agent }),
|
|
763
|
+
/* @__PURE__ */ e("span", { className: "text-[11px] text-slate-400", children: le(r.created_at) }),
|
|
764
|
+
r.updated_at && r.updated_at !== r.created_at && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-300", children: "(edited)" }),
|
|
765
|
+
r.field && /* @__PURE__ */ e(
|
|
766
|
+
st,
|
|
760
767
|
{
|
|
761
|
-
field:
|
|
762
|
-
label: (q == null ? void 0 : q.labelOf(
|
|
763
|
-
resolved: !!
|
|
764
|
-
onJump: q ? () => q.jump(
|
|
768
|
+
field: r.field,
|
|
769
|
+
label: (q == null ? void 0 : q.labelOf(r.field)) ?? He(r.field),
|
|
770
|
+
resolved: !!r.resolved_at,
|
|
771
|
+
onJump: q ? () => q.jump(r.field) : void 0
|
|
765
772
|
}
|
|
766
773
|
),
|
|
767
774
|
!K && /* @__PURE__ */ s(
|
|
768
775
|
"div",
|
|
769
776
|
{
|
|
770
|
-
className: `ml-auto flex items-center gap-1 transition-opacity group-hover:opacity-100 focus-within:opacity-100 ${H ===
|
|
777
|
+
className: `ml-auto flex items-center gap-1 transition-opacity group-hover:opacity-100 focus-within:opacity-100 ${H === r.id ? "opacity-100" : "opacity-0"}`,
|
|
771
778
|
children: [
|
|
772
779
|
/* @__PURE__ */ e(
|
|
773
780
|
"button",
|
|
@@ -776,20 +783,20 @@ function Tt({
|
|
|
776
783
|
title: "Make a task from this comment",
|
|
777
784
|
"aria-label": "Make a task from this comment",
|
|
778
785
|
className: "rounded p-1 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted",
|
|
779
|
-
onClick: () => Ee.mutate(
|
|
780
|
-
children: /* @__PURE__ */ e(
|
|
786
|
+
onClick: () => Ee.mutate(r),
|
|
787
|
+
children: /* @__PURE__ */ e(Te, { className: "h-3 w-3" })
|
|
781
788
|
}
|
|
782
789
|
),
|
|
783
|
-
x && (H ===
|
|
790
|
+
x && (H === r.id ? /* @__PURE__ */ s(Y, { children: [
|
|
784
791
|
/* @__PURE__ */ e(
|
|
785
792
|
"button",
|
|
786
793
|
{
|
|
787
794
|
type: "button",
|
|
788
795
|
autoFocus: !0,
|
|
789
796
|
disabled: ne.isPending,
|
|
790
|
-
"data-comment-delete-confirm":
|
|
797
|
+
"data-comment-delete-confirm": r.id,
|
|
791
798
|
className: "rounded bg-red-600 px-1.5 py-px text-[10.5px] font-medium text-white transition-colors hover:bg-red-700 disabled:opacity-60",
|
|
792
|
-
onClick: () => ne.mutate(
|
|
799
|
+
onClick: () => ne.mutate(r.id, {
|
|
793
800
|
onSettled: () => n(null)
|
|
794
801
|
}),
|
|
795
802
|
children: ne.isPending ? "Deletingβ¦" : "Delete comment?"
|
|
@@ -813,9 +820,9 @@ function Tt({
|
|
|
813
820
|
"aria-label": "Edit comment",
|
|
814
821
|
className: "rounded p-1 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-700",
|
|
815
822
|
onClick: () => {
|
|
816
|
-
|
|
823
|
+
T(r.id), p(r.text);
|
|
817
824
|
},
|
|
818
|
-
children: /* @__PURE__ */ e(
|
|
825
|
+
children: /* @__PURE__ */ e(Fe, { className: "h-3 w-3" })
|
|
819
826
|
}
|
|
820
827
|
),
|
|
821
828
|
/* @__PURE__ */ e(
|
|
@@ -825,8 +832,8 @@ function Tt({
|
|
|
825
832
|
title: "Delete comment",
|
|
826
833
|
"aria-label": "Delete comment",
|
|
827
834
|
className: "rounded p-1 text-slate-400 transition-colors hover:bg-red-50 hover:text-red-500",
|
|
828
|
-
onClick: () => n(
|
|
829
|
-
children: /* @__PURE__ */ e(
|
|
835
|
+
onClick: () => n(r.id),
|
|
836
|
+
children: /* @__PURE__ */ e(Re, { className: "h-3 w-3" })
|
|
830
837
|
}
|
|
831
838
|
)
|
|
832
839
|
] }))
|
|
@@ -836,7 +843,7 @@ function Tt({
|
|
|
836
843
|
] }),
|
|
837
844
|
K ? /* @__PURE__ */ s("div", { className: "mt-1.5 space-y-2", children: [
|
|
838
845
|
/* @__PURE__ */ e(
|
|
839
|
-
|
|
846
|
+
re,
|
|
840
847
|
{
|
|
841
848
|
value: l,
|
|
842
849
|
onChange: p,
|
|
@@ -850,10 +857,10 @@ function Tt({
|
|
|
850
857
|
{
|
|
851
858
|
size: "sm",
|
|
852
859
|
className: "h-7 gap-1.5",
|
|
853
|
-
disabled: !l.trim() ||
|
|
854
|
-
onClick: () =>
|
|
860
|
+
disabled: !l.trim() || ue.isPending,
|
|
861
|
+
onClick: () => ue.mutate({ id: r.id, text: l.trim() }),
|
|
855
862
|
children: [
|
|
856
|
-
/* @__PURE__ */ e(
|
|
863
|
+
/* @__PURE__ */ e(Me, { className: "h-3 w-3" }),
|
|
857
864
|
" Save"
|
|
858
865
|
]
|
|
859
866
|
}
|
|
@@ -865,23 +872,23 @@ function Tt({
|
|
|
865
872
|
variant: "outline",
|
|
866
873
|
className: "h-7 gap-1.5",
|
|
867
874
|
onClick: () => {
|
|
868
|
-
|
|
875
|
+
T(null), p("");
|
|
869
876
|
},
|
|
870
877
|
children: [
|
|
871
|
-
/* @__PURE__ */ e(
|
|
878
|
+
/* @__PURE__ */ e(Ie, { className: "h-3 w-3" }),
|
|
872
879
|
" Cancel"
|
|
873
880
|
]
|
|
874
881
|
}
|
|
875
882
|
)
|
|
876
883
|
] })
|
|
877
|
-
] }) : /* @__PURE__ */ e("p", { className: "mt-0.5 whitespace-pre-wrap text-[13px] leading-relaxed text-slate-600", children: /* @__PURE__ */ e(se, { text:
|
|
878
|
-
!K && /* @__PURE__ */ e(rt, { comment:
|
|
884
|
+
] }) : /* @__PURE__ */ e("p", { className: "mt-0.5 whitespace-pre-wrap text-[13px] leading-relaxed text-slate-600", children: /* @__PURE__ */ e(se, { text: r.text }) }),
|
|
885
|
+
!K && /* @__PURE__ */ e(rt, { comment: r }),
|
|
879
886
|
!K && /* @__PURE__ */ s("div", { className: "mt-1 flex flex-wrap items-center gap-1", children: [
|
|
880
|
-
(
|
|
887
|
+
(r.reactions ?? []).map((M) => /* @__PURE__ */ s(
|
|
881
888
|
"button",
|
|
882
889
|
{
|
|
883
890
|
type: "button",
|
|
884
|
-
onClick: () =>
|
|
891
|
+
onClick: () => pe.mutate({ id: r.id, emoji: M.emoji }),
|
|
885
892
|
className: `inline-flex items-center gap-1 rounded-full border px-1.5 py-px text-[11px] transition-colors ${M.mine ? "border-nvr-cyan/40 bg-nvr-cyan/10 text-nvr-navy dark:text-nvr-cyan" : "border-slate-200 bg-slate-50 text-slate-600 hover:border-slate-300 dark:border-border dark:bg-muted dark:text-slate-300"}`,
|
|
886
893
|
children: [
|
|
887
894
|
M.emoji,
|
|
@@ -895,18 +902,18 @@ function Tt({
|
|
|
895
902
|
"button",
|
|
896
903
|
{
|
|
897
904
|
type: "button",
|
|
898
|
-
onClick: () =>
|
|
905
|
+
onClick: () => he(xe === r.id ? null : r.id),
|
|
899
906
|
className: "rounded p-0.5 text-slate-300 transition-colors hover:bg-slate-100 hover:text-slate-500 dark:hover:bg-muted",
|
|
900
907
|
"aria-label": "Add reaction",
|
|
901
|
-
children: /* @__PURE__ */ e(
|
|
908
|
+
children: /* @__PURE__ */ e(ke, { className: "h-3.5 w-3.5" })
|
|
902
909
|
}
|
|
903
910
|
),
|
|
904
|
-
|
|
911
|
+
xe === r.id && /* @__PURE__ */ e("span", { className: "absolute bottom-6 left-0 z-20 flex gap-0.5 rounded-full border border-slate-200 bg-white px-1.5 py-1 shadow-lg dark:border-border dark:bg-popover", children: Ne.map((M) => /* @__PURE__ */ e(
|
|
905
912
|
"button",
|
|
906
913
|
{
|
|
907
914
|
type: "button",
|
|
908
915
|
onClick: () => {
|
|
909
|
-
|
|
916
|
+
pe.mutate({ id: r.id, emoji: M }), he(null);
|
|
910
917
|
},
|
|
911
918
|
className: "rounded-full px-1 text-[14px] hover:bg-muted",
|
|
912
919
|
children: M
|
|
@@ -916,7 +923,7 @@ function Tt({
|
|
|
916
923
|
] })
|
|
917
924
|
] })
|
|
918
925
|
] })
|
|
919
|
-
] },
|
|
926
|
+
] }, r.id);
|
|
920
927
|
}) })
|
|
921
928
|
] }) })
|
|
922
929
|
]
|
|
@@ -925,6 +932,6 @@ function Tt({
|
|
|
925
932
|
);
|
|
926
933
|
}
|
|
927
934
|
export {
|
|
928
|
-
|
|
929
|
-
|
|
935
|
+
Ft as CommentPanel,
|
|
936
|
+
re as MentionTextarea
|
|
930
937
|
};
|