@nivaro/react 0.3.8 → 0.3.9
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/replayUploadQueue.js +107 -93
- package/dist/hooks/useSessionRecorder.js +103 -101
- package/dist/index.d.ts +46 -1
- package/dist/index.js +300 -292
- package/dist/shared/components/CollectionBrowserView.js +318 -318
- package/dist/shared/components/DataTable.js +230 -223
- package/dist/shared/components/QueryTable.js +49 -49
- package/dist/shared/components/chat/ChatPanel.js +288 -287
- package/dist/shared/components/panels/CommentPanel.js +237 -236
- package/dist/shared/components/profile/usePersonPresence.js +42 -37
- package/dist/shared/lib/presence-live.js +54 -0
- package/dist/shared/lib/presence-state.js +39 -31
- package/dist/shared/lib/request-gate.js +120 -102
- package/dist/shared/lib/rum.js +45 -36
- package/dist/shared/lib/signed-out.js +114 -0
- package/dist/shared/lib/socket-realtime.js +19 -17
- package/dist/shared/lib/use-online-users.js +11 -10
- package/dist/shared/lib/worker-socket.js +89 -79
- package/package.json +1 -1
|
@@ -1,29 +1,30 @@
|
|
|
1
1
|
import { jsxs as s, jsx as e, Fragment as ce } from "react/jsx-runtime";
|
|
2
2
|
import { useQueryClient as xe, useQuery as B, useMutation as A } from "@tanstack/react-query";
|
|
3
3
|
import { MessageSquare as _e, ChevronDown as Ce, ClipboardPlus as Se, Pencil as $e, Trash2 as qe, Check as Ee, X as Re, SmilePlus as he } from "lucide-react";
|
|
4
|
-
import { useState as
|
|
4
|
+
import { useState as C, useRef as J, useEffect as G, useMemo as Y } from "react";
|
|
5
5
|
import { createPortal as Te } from "react-dom";
|
|
6
|
-
import { toast as
|
|
7
|
-
import { useNivaroClient as
|
|
8
|
-
import { useDebounced as
|
|
6
|
+
import { toast as D } from "sonner";
|
|
7
|
+
import { useNivaroClient as ne, useItemEditAuth as De, useDrilldown as Pe } from "../../context.js";
|
|
8
|
+
import { useDebounced as Fe } from "../../hooks/useDebounced.js";
|
|
9
9
|
import { get as U, post as z, patch as Me, del as je } from "../../lib/commands.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
10
|
+
import { usePresenceOnlinePoll as Ie } from "../../lib/presence-live.js";
|
|
11
|
+
import { useRecordSignalPeers as Oe, useRecordSignalSender as Le, signalSentence as Ae } from "../../lib/presence-signals.js";
|
|
12
|
+
import { invalidateRecordTasks as Ke } from "../../lib/record-tasks.js";
|
|
13
|
+
import { formatRelative as ae } from "../../lib/utils.js";
|
|
13
14
|
import { AutolinkedText as re } from "../AutolinkedText.js";
|
|
14
|
-
import { InboundRequestPopover as
|
|
15
|
-
import { UserAvatar as
|
|
16
|
-
import { Avatar as
|
|
15
|
+
import { InboundRequestPopover as Qe } from "../integrations/InboundRequest.js";
|
|
16
|
+
import { UserAvatar as ze } from "../UserAvatar.js";
|
|
17
|
+
import { Avatar as Be, AvatarFallback as Ue } from "../ui/avatar.js";
|
|
17
18
|
import { Button as X } from "../ui/button.js";
|
|
18
19
|
import { Separator as me } from "../ui/separator.js";
|
|
19
|
-
import { Textarea as
|
|
20
|
-
import { RecordEventPathSheet as
|
|
20
|
+
import { Textarea as We } from "../ui/textarea.js";
|
|
21
|
+
import { RecordEventPathSheet as He } from "./IntegrationActivitySection.js";
|
|
21
22
|
const be = ["👍", "✅", "👀", "🎉", "❤️", "😂"];
|
|
22
|
-
function
|
|
23
|
-
var d, c, b,
|
|
24
|
-
return [(d = t.first_name) == null ? void 0 : d[0], (c = t.last_name) == null ? void 0 : c[0]].filter(Boolean).join("").toUpperCase() || ((
|
|
23
|
+
function Xe(t) {
|
|
24
|
+
var d, c, b, m;
|
|
25
|
+
return [(d = t.first_name) == null ? void 0 : d[0], (c = t.last_name) == null ? void 0 : c[0]].filter(Boolean).join("").toUpperCase() || ((m = (b = t.email) == null ? void 0 : b[0]) == null ? void 0 : m.toUpperCase()) || "?";
|
|
25
26
|
}
|
|
26
|
-
function
|
|
27
|
+
function Ge({ comment: t }) {
|
|
27
28
|
const i = (t.mentions ?? []).filter(
|
|
28
29
|
(d) => {
|
|
29
30
|
var c;
|
|
@@ -46,7 +47,7 @@ function Xe({ comment: t }) {
|
|
|
46
47
|
children: [
|
|
47
48
|
d.seen_at ? "✓ " : "",
|
|
48
49
|
c,
|
|
49
|
-
d.seen_at ? ` saw this ${
|
|
50
|
+
d.seen_at ? ` saw this ${ae(d.seen_at)}` : " has not seen this yet"
|
|
50
51
|
]
|
|
51
52
|
},
|
|
52
53
|
d.id
|
|
@@ -58,11 +59,11 @@ function Xe({ comment: t }) {
|
|
|
58
59
|
function ee(t) {
|
|
59
60
|
return [t.first_name, t.last_name].filter(Boolean).join(" ") || t.email;
|
|
60
61
|
}
|
|
61
|
-
function
|
|
62
|
+
function Je(t, i) {
|
|
62
63
|
const c = t.slice(0, i).match(/(^|\s)@([a-zA-Z0-9._-]{2,})$/);
|
|
63
64
|
return c ? { start: i - c[2].length - 1, query: c[2] } : null;
|
|
64
65
|
}
|
|
65
|
-
function
|
|
66
|
+
function pe(t) {
|
|
66
67
|
return t.email.split("@")[0];
|
|
67
68
|
}
|
|
68
69
|
function te({
|
|
@@ -70,103 +71,103 @@ function te({
|
|
|
70
71
|
onChange: i,
|
|
71
72
|
...d
|
|
72
73
|
}) {
|
|
73
|
-
const c =
|
|
74
|
-
queryKey: ["users", "mention-search",
|
|
74
|
+
const c = ne(), b = J(null), [m, h] = C(null), [E, f] = C(0), N = Fe((m == null ? void 0 : m.query) ?? "", 200), { data: M = [] } = B({
|
|
75
|
+
queryKey: ["users", "mention-search", N],
|
|
75
76
|
queryFn: () => c.request(
|
|
76
|
-
U("/users", { limit: 8, sort: "first_name", search:
|
|
77
|
+
U("/users", { limit: 8, sort: "first_name", search: N })
|
|
77
78
|
).then((r) => r.data),
|
|
78
|
-
enabled: !!
|
|
79
|
+
enabled: !!m && N.length >= 2,
|
|
79
80
|
staleTime: 3e4
|
|
80
|
-
}), { data:
|
|
81
|
+
}), j = Ie(15e3, !!m), { data: u } = B({
|
|
81
82
|
queryKey: ["presence-online"],
|
|
82
83
|
queryFn: () => c.request(
|
|
83
84
|
U("/presence/online")
|
|
84
85
|
),
|
|
85
|
-
enabled: !!
|
|
86
|
-
refetchInterval:
|
|
86
|
+
enabled: !!m,
|
|
87
|
+
refetchInterval: j,
|
|
87
88
|
staleTime: 5e3
|
|
88
|
-
}),
|
|
89
|
+
}), g = (r) => {
|
|
89
90
|
var x;
|
|
90
|
-
const l = (x =
|
|
91
|
+
const l = (x = u == null ? void 0 : u.data) == null ? void 0 : x.find((k) => String(k.user_id).toUpperCase() === r.toUpperCase());
|
|
91
92
|
return l ? l.is_idle || l.away ? 1 : 0 : 2;
|
|
92
|
-
},
|
|
93
|
+
}, w = [...M].sort((r, l) => g(r.id) - g(l.id)), { data: I = [] } = B({
|
|
93
94
|
queryKey: ["mention-roles"],
|
|
94
95
|
queryFn: () => c.request(U("/chat/roles")).then((r) => r.data).catch(() => []),
|
|
95
|
-
enabled: !!
|
|
96
|
+
enabled: !!m,
|
|
96
97
|
staleTime: 5 * 6e4
|
|
97
|
-
}),
|
|
98
|
-
(r) => r.name.toLowerCase().replace(/\s+/g, "-").startsWith(
|
|
99
|
-
).slice(0, 3) : [],
|
|
98
|
+
}), P = m ? I.filter(
|
|
99
|
+
(r) => r.name.toLowerCase().replace(/\s+/g, "-").startsWith(N.toLowerCase())
|
|
100
|
+
).slice(0, 3) : [], _ = !!m && N.length >= 2 && "owners".startsWith(N.toLowerCase()), S = !!m && N.length >= 2 && (w.length > 0 || _ || P.length > 0), o = w.length + (_ ? 1 : 0) + P.length, [y, R] = C(null), K = J(null);
|
|
100
101
|
G(() => {
|
|
101
102
|
if (!S || !b.current) {
|
|
102
|
-
|
|
103
|
+
R(null);
|
|
103
104
|
return;
|
|
104
105
|
}
|
|
105
106
|
const r = b.current.getBoundingClientRect();
|
|
106
|
-
|
|
107
|
+
R({ top: r.bottom + 4, left: r.left, width: Math.min(r.width, 360) });
|
|
107
108
|
const l = (k) => {
|
|
108
|
-
var
|
|
109
|
-
(
|
|
109
|
+
var q;
|
|
110
|
+
(q = K.current) != null && q.contains(k.target) || h(null);
|
|
110
111
|
}, x = () => h(null);
|
|
111
112
|
return window.addEventListener("scroll", l, !0), window.addEventListener("resize", x), () => {
|
|
112
113
|
window.removeEventListener("scroll", l, !0), window.removeEventListener("resize", x);
|
|
113
114
|
};
|
|
114
115
|
}, [S]);
|
|
115
|
-
function
|
|
116
|
-
const l =
|
|
116
|
+
function O(r) {
|
|
117
|
+
const l = Je(r.value, r.selectionStart ?? r.value.length);
|
|
117
118
|
h(l), l || f(0);
|
|
118
119
|
}
|
|
119
120
|
function $(r) {
|
|
120
|
-
if (!
|
|
121
|
-
const l = b.current.selectionStart ?? t.length, x = r === "__owners__" ? "@owners " : typeof r == "object" && "role" in r ? `@${r.role.toLowerCase().replace(/\s+/g, "-")} ` : `@${
|
|
121
|
+
if (!m || !b.current) return;
|
|
122
|
+
const l = b.current.selectionStart ?? t.length, x = r === "__owners__" ? "@owners " : typeof r == "object" && "role" in r ? `@${r.role.toLowerCase().replace(/\s+/g, "-")} ` : `@${pe(r)} `, k = t.slice(0, m.start) + x + t.slice(l);
|
|
122
123
|
i(k), h(null), f(0);
|
|
123
|
-
const
|
|
124
|
+
const q = m.start + x.length;
|
|
124
125
|
requestAnimationFrame(() => {
|
|
125
|
-
var
|
|
126
|
-
(
|
|
126
|
+
var F, v;
|
|
127
|
+
(F = b.current) == null || F.focus(), (v = b.current) == null || v.setSelectionRange(q, q);
|
|
127
128
|
});
|
|
128
129
|
}
|
|
129
|
-
function
|
|
130
|
+
function L(r) {
|
|
130
131
|
if (S)
|
|
131
132
|
if (r.key === "ArrowDown")
|
|
132
|
-
r.preventDefault(), f((l) => (l + 1) %
|
|
133
|
+
r.preventDefault(), f((l) => (l + 1) % o);
|
|
133
134
|
else if (r.key === "ArrowUp")
|
|
134
|
-
r.preventDefault(), f((l) => (l - 1 +
|
|
135
|
+
r.preventDefault(), f((l) => (l - 1 + o) % o);
|
|
135
136
|
else if (r.key === "Enter" || r.key === "Tab") {
|
|
136
137
|
r.preventDefault();
|
|
137
|
-
const l = Math.min(E,
|
|
138
|
-
if (
|
|
138
|
+
const l = Math.min(E, o - 1), x = _ ? 1 : 0, k = x + w.length;
|
|
139
|
+
if (_ && l === 0) $("__owners__");
|
|
139
140
|
else if (l >= k) {
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
} else $(
|
|
141
|
+
const q = P[l - k];
|
|
142
|
+
q && $({ role: q.name });
|
|
143
|
+
} else $(w[l - x]);
|
|
143
144
|
} else r.key === "Escape" && (r.preventDefault(), h(null));
|
|
144
145
|
}
|
|
145
146
|
return /* @__PURE__ */ s("div", { className: "relative", children: [
|
|
146
147
|
/* @__PURE__ */ e(
|
|
147
|
-
|
|
148
|
+
We,
|
|
148
149
|
{
|
|
149
150
|
...d,
|
|
150
151
|
ref: b,
|
|
151
152
|
value: t,
|
|
152
153
|
onChange: (r) => {
|
|
153
|
-
i(r.target.value),
|
|
154
|
+
i(r.target.value), O(r.target);
|
|
154
155
|
},
|
|
155
|
-
onKeyDown:
|
|
156
|
-
onClick: (r) =>
|
|
156
|
+
onKeyDown: L,
|
|
157
|
+
onClick: (r) => O(r.currentTarget),
|
|
157
158
|
onBlur: () => setTimeout(() => h(null), 150)
|
|
158
159
|
}
|
|
159
160
|
),
|
|
160
|
-
S &&
|
|
161
|
+
S && y && Te(
|
|
161
162
|
/* @__PURE__ */ s(
|
|
162
163
|
"div",
|
|
163
164
|
{
|
|
164
|
-
ref:
|
|
165
|
+
ref: K,
|
|
165
166
|
className: "fixed z-[110] max-h-60 overflow-y-auto rounded-md border border-slate-200 bg-white shadow-lg dark:border-border dark:bg-popover",
|
|
166
|
-
style: { top:
|
|
167
|
+
style: { top: y.top, left: y.left, width: y.width },
|
|
167
168
|
onMouseDown: (r) => r.preventDefault(),
|
|
168
169
|
children: [
|
|
169
|
-
|
|
170
|
+
_ && /* @__PURE__ */ s(
|
|
170
171
|
"button",
|
|
171
172
|
{
|
|
172
173
|
type: "button",
|
|
@@ -184,27 +185,27 @@ function te({
|
|
|
184
185
|
]
|
|
185
186
|
}
|
|
186
187
|
),
|
|
187
|
-
|
|
188
|
-
var
|
|
189
|
-
const x =
|
|
188
|
+
w.map((r, l) => {
|
|
189
|
+
var q, F;
|
|
190
|
+
const x = _ ? l + 1 : l, k = [r.first_name, r.last_name].filter(Boolean).join(" ") || r.email;
|
|
190
191
|
return /* @__PURE__ */ s(
|
|
191
192
|
"button",
|
|
192
193
|
{
|
|
193
194
|
type: "button",
|
|
194
|
-
onMouseDown: (
|
|
195
|
-
|
|
195
|
+
onMouseDown: (v) => {
|
|
196
|
+
v.preventDefault(), $(r);
|
|
196
197
|
},
|
|
197
198
|
onMouseEnter: () => f(x),
|
|
198
199
|
className: `flex w-full items-center gap-2.5 px-2.5 py-1.5 text-left transition-colors ${x === E ? "bg-nvr-cyan/10" : ""}`,
|
|
199
200
|
children: [
|
|
200
201
|
/* @__PURE__ */ s("span", { className: "relative flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-nvr-cyan/15 text-[10px] font-semibold text-nvr-navy/80 dark:text-nvr-cyan", children: [
|
|
201
|
-
(`${((
|
|
202
|
-
|
|
202
|
+
(`${((q = r.first_name) == null ? void 0 : q[0]) ?? ""}${((F = r.last_name) == null ? void 0 : F[0]) ?? ""}`.trim() || r.email[0]).toUpperCase(),
|
|
203
|
+
g(r.id) < 2 && /* @__PURE__ */ e(
|
|
203
204
|
"span",
|
|
204
205
|
{
|
|
205
|
-
"data-mention-presence":
|
|
206
|
-
title:
|
|
207
|
-
className: `absolute -bottom-px -right-px h-2 w-2 rounded-full ring-2 ring-white dark:ring-popover ${
|
|
206
|
+
"data-mention-presence": g(r.id) === 0 ? "online" : "idle",
|
|
207
|
+
title: g(r.id) === 0 ? "Online" : "Idle",
|
|
208
|
+
className: `absolute -bottom-px -right-px h-2 w-2 rounded-full ring-2 ring-white dark:ring-popover ${g(r.id) === 0 ? "bg-emerald-500" : "border border-amber-500 bg-white dark:bg-popover"}`
|
|
208
209
|
}
|
|
209
210
|
)
|
|
210
211
|
] }),
|
|
@@ -216,7 +217,7 @@ function te({
|
|
|
216
217
|
r.ooo_end ? ` until ${String(r.ooo_end).slice(0, 10)}` : ""
|
|
217
218
|
] }),
|
|
218
219
|
"@",
|
|
219
|
-
|
|
220
|
+
pe(r),
|
|
220
221
|
(r.title || r.department) && /* @__PURE__ */ s("span", { className: "text-slate-400 dark:text-slate-500", children: [
|
|
221
222
|
" · ",
|
|
222
223
|
[r.title, r.department].filter(Boolean).join(", ")
|
|
@@ -228,8 +229,8 @@ function te({
|
|
|
228
229
|
r.id
|
|
229
230
|
);
|
|
230
231
|
}),
|
|
231
|
-
|
|
232
|
-
const x =
|
|
232
|
+
P.map((r, l) => {
|
|
233
|
+
const x = w.length + (_ ? 1 : 0) + l;
|
|
233
234
|
return /* @__PURE__ */ s(
|
|
234
235
|
"button",
|
|
235
236
|
{
|
|
@@ -257,7 +258,7 @@ function te({
|
|
|
257
258
|
)
|
|
258
259
|
] });
|
|
259
260
|
}
|
|
260
|
-
function
|
|
261
|
+
function ue(t) {
|
|
261
262
|
if (t.kind === "comment") return "people";
|
|
262
263
|
switch (t.note.source) {
|
|
263
264
|
case "note":
|
|
@@ -269,81 +270,81 @@ function pe(t) {
|
|
|
269
270
|
return "system";
|
|
270
271
|
}
|
|
271
272
|
}
|
|
272
|
-
const
|
|
273
|
+
const Ve = {
|
|
273
274
|
people: "People",
|
|
274
275
|
system: "System",
|
|
275
276
|
integration: "Integration"
|
|
276
|
-
},
|
|
277
|
-
function
|
|
277
|
+
}, Ze = "integrations:";
|
|
278
|
+
function Ye({
|
|
278
279
|
note: t,
|
|
279
280
|
collection: i,
|
|
280
281
|
item: d
|
|
281
282
|
}) {
|
|
282
|
-
var
|
|
283
|
-
const c =
|
|
283
|
+
var S;
|
|
284
|
+
const c = Pe(), [b, m] = C(!1), h = t.source === "external" && !!t.provider && !t.provider.startsWith(Ze), E = ne(), f = xe(), [N, M] = C(!1), j = A({
|
|
284
285
|
mutationFn: (o) => E.request(z(`/comments/${t.comment_id}/reactions`, { emoji: o })),
|
|
285
286
|
onSuccess: () => {
|
|
286
|
-
|
|
287
|
+
M(!1), f.invalidateQueries({ queryKey: ["comments-related"] }), f.invalidateQueries({ queryKey: ["row-comment-counts"] });
|
|
287
288
|
},
|
|
288
|
-
onError: () =>
|
|
289
|
-
}), [
|
|
289
|
+
onError: () => D.error("Failed to react")
|
|
290
|
+
}), [u, g] = C(!1), w = A({
|
|
290
291
|
mutationFn: () => E.request(
|
|
291
292
|
z(`/integration-events/${encodeURIComponent(t.provider ?? "")}/replay`, {
|
|
292
293
|
entry_id: t.id.replace(/^external:/, "")
|
|
293
294
|
})
|
|
294
295
|
),
|
|
295
296
|
onSuccess: (o) => {
|
|
296
|
-
var
|
|
297
|
-
g(!1),
|
|
298
|
-
description: (
|
|
297
|
+
var y;
|
|
298
|
+
g(!1), D.success("Event replayed", {
|
|
299
|
+
description: (y = o == null ? void 0 : o.data) == null ? void 0 : y.detail
|
|
299
300
|
}), f.invalidateQueries({ queryKey: ["comments-related"] });
|
|
300
301
|
},
|
|
301
302
|
onError: (o) => {
|
|
302
|
-
var
|
|
303
|
+
var R;
|
|
303
304
|
g(!1);
|
|
304
|
-
const
|
|
305
|
-
|
|
305
|
+
const y = (R = o == null ? void 0 : o.response) == null ? void 0 : R.error;
|
|
306
|
+
D.error(y ?? (o == null ? void 0 : o.message) ?? "Replay failed", { duration: 8e3 });
|
|
306
307
|
}
|
|
307
|
-
}),
|
|
308
|
+
}), I = t.link ? () => {
|
|
308
309
|
const o = t.link;
|
|
309
310
|
if (!o) return;
|
|
310
|
-
const
|
|
311
|
-
if (
|
|
312
|
-
|
|
311
|
+
const y = document.querySelector(`[data-o2m-row="${o.collection}:${o.item_id}"]`);
|
|
312
|
+
if (y) {
|
|
313
|
+
y.scrollIntoView({ behavior: "smooth", block: "center" }), y.classList.add("nvr-row-flash"), setTimeout(() => y.classList.remove("nvr-row-flash"), 2400);
|
|
313
314
|
return;
|
|
314
315
|
}
|
|
315
316
|
c == null || c.open({ collection: o.collection, itemId: o.item_id });
|
|
316
|
-
} : null,
|
|
317
|
+
} : null, P = 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", _ = t.source === "import" && ((S = t.import) != null && S.file_id) ? t.import : null;
|
|
317
318
|
return /* @__PURE__ */ s("div", { className: "flex gap-3", "data-recorded-note": t.source, children: [
|
|
318
319
|
/* @__PURE__ */ e("div", { className: "mt-1 h-8 w-8 shrink-0", "aria-hidden": !0 }),
|
|
319
320
|
/* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: [
|
|
320
321
|
/* @__PURE__ */ s("div", { className: "flex flex-wrap items-center gap-x-2 gap-y-1", children: [
|
|
321
|
-
/* @__PURE__ */ e("span", { className: `rounded border px-1.5 py-px text-[10px] font-medium ${
|
|
322
|
+
/* @__PURE__ */ e("span", { className: `rounded border px-1.5 py-px text-[10px] font-medium ${P}`, children: t.label }),
|
|
322
323
|
t.user_name && /* @__PURE__ */ e("span", { className: "text-[12px] font-medium text-slate-700 dark:text-slate-200", children: t.user_name }),
|
|
323
|
-
t.context && (
|
|
324
|
+
t.context && (I ? /* @__PURE__ */ e(
|
|
324
325
|
"button",
|
|
325
326
|
{
|
|
326
327
|
type: "button",
|
|
327
|
-
onClick:
|
|
328
|
+
onClick: I,
|
|
328
329
|
className: "truncate text-[11px] text-nvr-navy underline-offset-2 hover:underline dark:text-nvr-cyan",
|
|
329
330
|
"data-line-comment-link": !0,
|
|
330
331
|
children: t.context
|
|
331
332
|
}
|
|
332
|
-
) :
|
|
333
|
+
) : _ ? /* @__PURE__ */ e(
|
|
333
334
|
"a",
|
|
334
335
|
{
|
|
335
|
-
href: `/api/files/${
|
|
336
|
+
href: `/api/files/${_.file_id}?download=1`,
|
|
336
337
|
target: "_blank",
|
|
337
338
|
rel: "noreferrer",
|
|
338
339
|
onClick: (o) => o.stopPropagation(),
|
|
339
340
|
className: "truncate text-[11px] text-nvr-navy underline decoration-dotted underline-offset-2 dark:text-nvr-cyan",
|
|
340
|
-
"data-note-import-file":
|
|
341
|
+
"data-note-import-file": _.file_id ?? void 0,
|
|
341
342
|
children: t.context
|
|
342
343
|
}
|
|
343
344
|
) : /* @__PURE__ */ e("span", { className: "truncate text-[11px] text-slate-400", children: t.context })),
|
|
344
|
-
/* @__PURE__ */ e("span", { className: "text-[11px] text-slate-400", children:
|
|
345
|
+
/* @__PURE__ */ e("span", { className: "text-[11px] text-slate-400", children: ae(t.created_at) }),
|
|
345
346
|
t.source === "inbound" && t.inbound && /* @__PURE__ */ e(
|
|
346
|
-
|
|
347
|
+
Qe,
|
|
347
348
|
{
|
|
348
349
|
activityId: t.inbound.activity_id,
|
|
349
350
|
callerName: t.label,
|
|
@@ -367,7 +368,7 @@ function Ze({
|
|
|
367
368
|
"button",
|
|
368
369
|
{
|
|
369
370
|
type: "button",
|
|
370
|
-
onClick: () =>
|
|
371
|
+
onClick: () => m(!0),
|
|
371
372
|
"data-note-show-path": t.id,
|
|
372
373
|
className: "ml-auto rounded px-1.5 py-px text-[10.5px] font-medium text-sky-700 transition-colors hover:bg-sky-50 dark:text-sky-300 dark:hover:bg-sky-900/20",
|
|
373
374
|
"data-tip": "Everything this event set off, step by step",
|
|
@@ -378,13 +379,13 @@ function Ze({
|
|
|
378
379
|
"button",
|
|
379
380
|
{
|
|
380
381
|
type: "button",
|
|
381
|
-
onClick: () =>
|
|
382
|
+
onClick: () => u ? w.mutate() : g(!0),
|
|
382
383
|
onBlur: () => g(!1),
|
|
383
|
-
disabled:
|
|
384
|
+
disabled: w.isPending,
|
|
384
385
|
"data-note-replay": t.id,
|
|
385
|
-
className: `rounded px-1.5 py-px text-[10.5px] font-medium transition-colors ${
|
|
386
|
+
className: `rounded px-1.5 py-px text-[10.5px] font-medium transition-colors ${u ? "bg-sky-600 text-white" : "text-sky-700 hover:bg-sky-50 dark:text-sky-300 dark:hover:bg-sky-900/20"}`,
|
|
386
387
|
"data-tip": "Re-apply this event from its stored payload",
|
|
387
|
-
children:
|
|
388
|
+
children: w.isPending ? "Replaying…" : u ? "Replay this event?" : "Replay"
|
|
388
389
|
}
|
|
389
390
|
)
|
|
390
391
|
] }),
|
|
@@ -394,7 +395,7 @@ function Ze({
|
|
|
394
395
|
"button",
|
|
395
396
|
{
|
|
396
397
|
type: "button",
|
|
397
|
-
onClick: () =>
|
|
398
|
+
onClick: () => j.mutate(o.emoji),
|
|
398
399
|
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"}`,
|
|
399
400
|
children: [
|
|
400
401
|
o.emoji,
|
|
@@ -408,17 +409,17 @@ function Ze({
|
|
|
408
409
|
"button",
|
|
409
410
|
{
|
|
410
411
|
type: "button",
|
|
411
|
-
onClick: () =>
|
|
412
|
+
onClick: () => M((o) => !o),
|
|
412
413
|
className: "rounded p-0.5 text-slate-300 transition-colors hover:bg-slate-100 hover:text-slate-500 dark:hover:bg-muted",
|
|
413
414
|
"aria-label": "Add reaction",
|
|
414
415
|
children: /* @__PURE__ */ e(he, { className: "h-3.5 w-3.5" })
|
|
415
416
|
}
|
|
416
417
|
),
|
|
417
|
-
|
|
418
|
+
N && /* @__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: be.map((o) => /* @__PURE__ */ e(
|
|
418
419
|
"button",
|
|
419
420
|
{
|
|
420
421
|
type: "button",
|
|
421
|
-
onClick: () =>
|
|
422
|
+
onClick: () => j.mutate(o),
|
|
422
423
|
className: "rounded-full px-1 text-[14px] hover:bg-muted",
|
|
423
424
|
children: o
|
|
424
425
|
},
|
|
@@ -428,7 +429,7 @@ function Ze({
|
|
|
428
429
|
] })
|
|
429
430
|
] }),
|
|
430
431
|
h && t.provider && /* @__PURE__ */ e(
|
|
431
|
-
|
|
432
|
+
He,
|
|
432
433
|
{
|
|
433
434
|
target: b ? {
|
|
434
435
|
source: t.provider,
|
|
@@ -436,104 +437,104 @@ function Ze({
|
|
|
436
437
|
record: { collection: i, item: d }
|
|
437
438
|
} : null,
|
|
438
439
|
event: { label: t.label },
|
|
439
|
-
onClose: () =>
|
|
440
|
+
onClose: () => m(!1)
|
|
440
441
|
}
|
|
441
442
|
)
|
|
442
443
|
] });
|
|
443
444
|
}
|
|
444
|
-
function
|
|
445
|
+
function kt({
|
|
445
446
|
collection: t,
|
|
446
447
|
item: i,
|
|
447
448
|
title: d,
|
|
448
449
|
defaultExpanded: c,
|
|
449
450
|
queuedComments: b,
|
|
450
|
-
onQueueComment:
|
|
451
|
+
onQueueComment: m
|
|
451
452
|
}) {
|
|
452
|
-
const h =
|
|
453
|
+
const h = ne(), { userId: E } = De(), f = xe(), [N, M] = C(!1), j = J(!1);
|
|
453
454
|
G(() => {
|
|
454
|
-
!
|
|
455
|
+
!j.current && c !== void 0 && (j.current = !0, M(c));
|
|
455
456
|
}, [c]);
|
|
456
|
-
const [
|
|
457
|
-
var
|
|
458
|
-
if (!(!
|
|
459
|
-
|
|
457
|
+
const [u, g] = C(""), [w, I] = C(!1), P = async () => {
|
|
458
|
+
var n;
|
|
459
|
+
if (!(!u.trim() || w)) {
|
|
460
|
+
I(!0);
|
|
460
461
|
try {
|
|
461
|
-
const
|
|
462
|
-
z("/ai/cleanup", { text:
|
|
462
|
+
const a = await h.request(
|
|
463
|
+
z("/ai/cleanup", { text: u })
|
|
463
464
|
);
|
|
464
|
-
(
|
|
465
|
+
(n = a.data) != null && n.text && g(a.data.text);
|
|
465
466
|
} catch {
|
|
466
467
|
} finally {
|
|
467
|
-
|
|
468
|
+
I(!1);
|
|
468
469
|
}
|
|
469
470
|
}
|
|
470
|
-
},
|
|
471
|
+
}, _ = Oe(t, i, "note"), S = Le(t, i, "note"), o = J(0);
|
|
471
472
|
G(() => {
|
|
472
|
-
if (!
|
|
473
|
-
o.current &&
|
|
473
|
+
if (!u.trim()) {
|
|
474
|
+
o.current && S("stop"), o.current = 0;
|
|
474
475
|
return;
|
|
475
476
|
}
|
|
476
|
-
const
|
|
477
|
-
|
|
478
|
-
}, [
|
|
479
|
-
const [
|
|
480
|
-
queryKey:
|
|
481
|
-
queryFn: () => h.request(U("/comments", { collection: t, item: i })).then((
|
|
482
|
-
enabled:
|
|
483
|
-
}),
|
|
477
|
+
const n = Date.now();
|
|
478
|
+
n - o.current < 2500 || (o.current = n, S("start"));
|
|
479
|
+
}, [u, S]), G(() => () => S("stop"), [S]);
|
|
480
|
+
const [y, R] = C(null), [K, O] = C(""), $ = !i || i === "new", L = ["comments", t, String(i)], { data: r, isLoading: l, isError: x } = B({
|
|
481
|
+
queryKey: L,
|
|
482
|
+
queryFn: () => h.request(U("/comments", { collection: t, item: i })).then((n) => n.data),
|
|
483
|
+
enabled: !$
|
|
484
|
+
}), k = r ?? [], { data: q } = B({
|
|
484
485
|
queryKey: ["comments-related", t, String(i)],
|
|
485
|
-
queryFn: () => h.request(U("/comments/related", { collection: t, item: i })).then((
|
|
486
|
-
enabled:
|
|
486
|
+
queryFn: () => h.request(U("/comments/related", { collection: t, item: i })).then((n) => n.data ?? []).catch(() => []),
|
|
487
|
+
enabled: !$,
|
|
487
488
|
staleTime: 3e4
|
|
488
|
-
}),
|
|
489
|
-
const
|
|
490
|
-
return [...
|
|
491
|
-
}, [
|
|
492
|
-
const
|
|
493
|
-
for (const
|
|
494
|
-
return
|
|
495
|
-
}, [
|
|
496
|
-
const
|
|
497
|
-
return
|
|
498
|
-
}, [
|
|
499
|
-
const p = new Set(
|
|
500
|
-
return p.has(
|
|
489
|
+
}), F = q ?? [], v = Y(() => {
|
|
490
|
+
const n = k.map((p) => ({ kind: "comment", at: p.created_at, comment: p })), a = F.map((p) => ({ kind: "related", at: p.created_at, note: p }));
|
|
491
|
+
return [...n, ...a].sort((p, Q) => new Date(Q.at).getTime() - new Date(p.at).getTime());
|
|
492
|
+
}, [k, F]), [W, fe] = C(() => /* @__PURE__ */ new Set()), [H, ge] = C(""), ye = Y(() => {
|
|
493
|
+
const n = { people: 0, system: 0, integration: 0 };
|
|
494
|
+
for (const a of v) n[ue(a)]++;
|
|
495
|
+
return n;
|
|
496
|
+
}, [v]), V = Y(() => {
|
|
497
|
+
const n = H.trim().toLowerCase();
|
|
498
|
+
return v.filter((a) => W.has(ue(a)) ? !1 : n ? (a.kind === "comment" ? `${a.comment.text} ${ee(a.comment.user)}` : `${a.note.text} ${a.note.user_name ?? ""} ${a.note.label} ${a.note.context ?? ""} ${a.note.provider ?? ""}`).toLowerCase().includes(n) : !0);
|
|
499
|
+
}, [v, W, H]), ve = (n) => fe((a) => {
|
|
500
|
+
const p = new Set(a);
|
|
501
|
+
return p.has(n) ? p.delete(n) : p.add(n), p;
|
|
501
502
|
}), ke = W.size > 0 || H.trim() !== "", Z = A({
|
|
502
|
-
mutationFn: (
|
|
503
|
+
mutationFn: (n) => h.request(z("/comments", { collection: t, item: i, text: n })),
|
|
503
504
|
onSuccess: () => {
|
|
504
|
-
f.invalidateQueries({ queryKey:
|
|
505
|
+
f.invalidateQueries({ queryKey: L }), g("");
|
|
505
506
|
},
|
|
506
|
-
onError: () =>
|
|
507
|
+
onError: () => D.error("Failed to post comment")
|
|
507
508
|
}), se = A({
|
|
508
|
-
mutationFn: ({ id:
|
|
509
|
+
mutationFn: ({ id: n, text: a }) => h.request(Me(`/comments/${n}`, { text: a })),
|
|
509
510
|
onSuccess: () => {
|
|
510
|
-
f.invalidateQueries({ queryKey:
|
|
511
|
+
f.invalidateQueries({ queryKey: L }), R(null), O("");
|
|
511
512
|
},
|
|
512
|
-
onError: () =>
|
|
513
|
+
onError: () => D.error("Failed to update comment")
|
|
513
514
|
}), Ne = A({
|
|
514
|
-
mutationFn: (
|
|
515
|
-
onSuccess: () => f.invalidateQueries({ queryKey:
|
|
516
|
-
onError: () =>
|
|
515
|
+
mutationFn: (n) => h.request(je(`/comments/${n}`)),
|
|
516
|
+
onSuccess: () => f.invalidateQueries({ queryKey: L }),
|
|
517
|
+
onError: () => D.error("Failed to delete comment")
|
|
517
518
|
}), oe = A({
|
|
518
|
-
mutationFn: ({ id:
|
|
519
|
-
onSuccess: () => f.invalidateQueries({ queryKey:
|
|
520
|
-
onError: () =>
|
|
521
|
-
}), [le, ie] =
|
|
522
|
-
mutationFn: (
|
|
519
|
+
mutationFn: ({ id: n, emoji: a }) => h.request(z(`/comments/${n}/reactions`, { emoji: a })),
|
|
520
|
+
onSuccess: () => f.invalidateQueries({ queryKey: L }),
|
|
521
|
+
onError: () => D.error("Failed to react")
|
|
522
|
+
}), [le, ie] = C(null), we = A({
|
|
523
|
+
mutationFn: (n) => h.request(
|
|
523
524
|
z("/tasks", {
|
|
524
525
|
collection: t,
|
|
525
526
|
item: i,
|
|
526
|
-
title:
|
|
527
|
+
title: n.text.replace(/<[^>]*>/g, "").replace(/@\[([^\]]+)\]/g, "@$1").slice(0, 200),
|
|
527
528
|
assignee: E
|
|
528
529
|
})
|
|
529
530
|
),
|
|
530
531
|
onSuccess: () => {
|
|
531
|
-
|
|
532
|
+
Ke(f, t, i), D.success("Task created from comment — assigned to you");
|
|
532
533
|
},
|
|
533
|
-
onError: () =>
|
|
534
|
+
onError: () => D.error("Could not create a task")
|
|
534
535
|
});
|
|
535
|
-
function de(
|
|
536
|
-
|
|
536
|
+
function de(n) {
|
|
537
|
+
n.preventDefault(), u.trim() && ($ && m ? (m(u.trim()), g("")) : Z.mutate(u.trim()));
|
|
537
538
|
}
|
|
538
539
|
return (
|
|
539
540
|
// Addressable from elsewhere (the summary panel jumps here), which needs
|
|
@@ -542,7 +543,7 @@ function yt({
|
|
|
542
543
|
"div",
|
|
543
544
|
{
|
|
544
545
|
"data-panel": "notes",
|
|
545
|
-
"data-panel-expanded":
|
|
546
|
+
"data-panel-expanded": N ? "true" : "false",
|
|
546
547
|
className: "overflow-hidden rounded-xl border border-slate-200 bg-white dark:bg-card dark:border-border",
|
|
547
548
|
children: [
|
|
548
549
|
/* @__PURE__ */ s(
|
|
@@ -550,25 +551,25 @@ function yt({
|
|
|
550
551
|
{
|
|
551
552
|
type: "button",
|
|
552
553
|
"data-panel-toggle": "notes",
|
|
553
|
-
onClick: () =>
|
|
554
|
+
onClick: () => M((n) => !n),
|
|
554
555
|
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]",
|
|
555
556
|
children: [
|
|
556
557
|
/* @__PURE__ */ s("span", { className: "flex w-full items-center gap-2.5", children: [
|
|
557
558
|
/* @__PURE__ */ e(_e, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }),
|
|
558
559
|
/* @__PURE__ */ e("span", { className: "text-[13px] font-medium text-slate-800 dark:text-slate-200", children: d || "Comments" }),
|
|
559
|
-
(
|
|
560
|
+
(v.length > 0 || (b ?? []).length > 0) && /* @__PURE__ */ e("span", { 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", children: $ ? (b ?? []).length : v.length }),
|
|
560
561
|
/* @__PURE__ */ e(
|
|
561
562
|
Ce,
|
|
562
563
|
{
|
|
563
|
-
className: `ml-auto h-3.5 w-3.5 shrink-0 text-slate-400 transition-transform duration-150${
|
|
564
|
+
className: `ml-auto h-3.5 w-3.5 shrink-0 text-slate-400 transition-transform duration-150${N ? " rotate-180" : ""}`
|
|
564
565
|
}
|
|
565
566
|
)
|
|
566
567
|
] }),
|
|
567
|
-
!
|
|
568
|
-
const
|
|
568
|
+
!N && !$ && v.length > 0 && (() => {
|
|
569
|
+
const n = v[0], a = n.kind === "comment" ? ee(n.comment.user) : n.note.user_name ?? "System", p = (n.kind === "comment" ? n.comment.text : n.note.text).replace(/<[^>]*>/g, " ").replace(/@\[([^\]]+)\]/g, "@$1").replace(/\s+/g, " ").trim();
|
|
569
570
|
return p ? /* @__PURE__ */ s("span", { className: "mt-1 w-full truncate pl-6 text-[11.5px] text-slate-400", children: [
|
|
570
571
|
/* @__PURE__ */ s("span", { className: "font-medium text-slate-500 dark:text-slate-400", children: [
|
|
571
|
-
|
|
572
|
+
a,
|
|
572
573
|
":"
|
|
573
574
|
] }),
|
|
574
575
|
" ",
|
|
@@ -578,12 +579,12 @@ function yt({
|
|
|
578
579
|
]
|
|
579
580
|
}
|
|
580
581
|
),
|
|
581
|
-
|
|
582
|
+
N && /* @__PURE__ */ e("div", { className: "border-t border-slate-100 px-5 py-4 dark:border-border/60", children: $ ? /* @__PURE__ */ s("div", { className: "space-y-4", children: [
|
|
582
583
|
/* @__PURE__ */ s("form", { onSubmit: de, className: "space-y-2", children: [
|
|
583
584
|
/* @__PURE__ */ e(
|
|
584
585
|
te,
|
|
585
586
|
{
|
|
586
|
-
value:
|
|
587
|
+
value: u,
|
|
587
588
|
onChange: g,
|
|
588
589
|
placeholder: "Write a comment…",
|
|
589
590
|
rows: 3,
|
|
@@ -592,21 +593,21 @@ function yt({
|
|
|
592
593
|
),
|
|
593
594
|
/* @__PURE__ */ s("div", { className: "flex items-center justify-between", children: [
|
|
594
595
|
/* @__PURE__ */ e("p", { className: "text-[11px] text-slate-400", children: "Comment will be posted after the record is saved." }),
|
|
595
|
-
/* @__PURE__ */ e(X, { type: "submit", size: "sm", disabled: !
|
|
596
|
+
/* @__PURE__ */ e(X, { type: "submit", size: "sm", disabled: !u.trim(), children: "Queue" })
|
|
596
597
|
] })
|
|
597
598
|
] }),
|
|
598
599
|
(b ?? []).length > 0 && /* @__PURE__ */ s("div", { className: "space-y-2", children: [
|
|
599
600
|
/* @__PURE__ */ e(me, {}),
|
|
600
|
-
(b ?? []).map((
|
|
601
|
+
(b ?? []).map((n, a) => /* @__PURE__ */ s(
|
|
601
602
|
"div",
|
|
602
603
|
{
|
|
603
604
|
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",
|
|
604
605
|
children: [
|
|
605
606
|
/* @__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" }),
|
|
606
|
-
/* @__PURE__ */ e("p", { className: "text-[13px] leading-relaxed text-slate-600 dark:text-slate-300", children:
|
|
607
|
+
/* @__PURE__ */ e("p", { className: "text-[13px] leading-relaxed text-slate-600 dark:text-slate-300", children: n })
|
|
607
608
|
]
|
|
608
609
|
},
|
|
609
|
-
|
|
610
|
+
a
|
|
610
611
|
))
|
|
611
612
|
] })
|
|
612
613
|
] }) : /* @__PURE__ */ s(ce, { children: [
|
|
@@ -614,7 +615,7 @@ function yt({
|
|
|
614
615
|
/* @__PURE__ */ e(
|
|
615
616
|
te,
|
|
616
617
|
{
|
|
617
|
-
value:
|
|
618
|
+
value: u,
|
|
618
619
|
onChange: g,
|
|
619
620
|
placeholder: "Write a comment…",
|
|
620
621
|
rows: 3,
|
|
@@ -628,56 +629,56 @@ function yt({
|
|
|
628
629
|
"button",
|
|
629
630
|
{
|
|
630
631
|
type: "button",
|
|
631
|
-
disabled: !
|
|
632
|
-
onClick: () => void
|
|
632
|
+
disabled: !u.trim() || w,
|
|
633
|
+
onClick: () => void P(),
|
|
633
634
|
"data-tip": "✨ Fix grammar & clarity (meaning preserved)",
|
|
634
635
|
className: "rounded-md border border-slate-200 px-2 py-1 text-[11.5px] text-slate-500 hover:bg-muted disabled:opacity-50 dark:border-border",
|
|
635
|
-
children:
|
|
636
|
+
children: w ? "…" : "✨ Polish"
|
|
636
637
|
}
|
|
637
638
|
),
|
|
638
|
-
/* @__PURE__ */ e(X, { type: "submit", size: "sm", disabled: !
|
|
639
|
+
/* @__PURE__ */ e(X, { type: "submit", size: "sm", disabled: !u.trim() || Z.isPending, children: Z.isPending ? "Posting…" : "Comment" })
|
|
639
640
|
] })
|
|
640
641
|
] })
|
|
641
642
|
] }),
|
|
642
|
-
|
|
643
|
+
_.length > 0 && /* @__PURE__ */ s(
|
|
643
644
|
"p",
|
|
644
645
|
{
|
|
645
646
|
className: "flex items-center gap-1.5 text-[11.5px] italic text-slate-400",
|
|
646
647
|
"data-note-typing": !0,
|
|
647
648
|
children: [
|
|
648
649
|
/* @__PURE__ */ e("span", { className: "h-1.5 w-1.5 animate-pulse rounded-full bg-nvr-cyan" }),
|
|
649
|
-
|
|
650
|
+
Ae(_, "writing a note"),
|
|
650
651
|
"…"
|
|
651
652
|
]
|
|
652
653
|
}
|
|
653
654
|
),
|
|
654
655
|
/* @__PURE__ */ e(me, { className: "my-4" }),
|
|
655
|
-
|
|
656
|
-
["people", "system", "integration"].map((
|
|
657
|
-
const
|
|
656
|
+
v.length > 0 && /* @__PURE__ */ s("div", { className: "mb-3 flex flex-wrap items-center gap-1.5", "data-notes-filters": !0, children: [
|
|
657
|
+
["people", "system", "integration"].map((n) => {
|
|
658
|
+
const a = !W.has(n), p = ye[n];
|
|
658
659
|
return /* @__PURE__ */ s(
|
|
659
660
|
"button",
|
|
660
661
|
{
|
|
661
662
|
type: "button",
|
|
662
|
-
onClick: () => ve(
|
|
663
|
-
"aria-pressed":
|
|
664
|
-
"data-notes-filter":
|
|
665
|
-
disabled: p === 0 &&
|
|
666
|
-
className: `inline-flex items-center gap-1 rounded-full border px-2 py-px text-[11px] font-medium transition-colors ${
|
|
667
|
-
title:
|
|
663
|
+
onClick: () => ve(n),
|
|
664
|
+
"aria-pressed": a,
|
|
665
|
+
"data-notes-filter": n,
|
|
666
|
+
disabled: p === 0 && a,
|
|
667
|
+
className: `inline-flex items-center gap-1 rounded-full border px-2 py-px text-[11px] font-medium transition-colors ${a ? "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`,
|
|
668
|
+
title: n === "people" ? "Comments and notes people wrote" : n === "system" ? "State changes, change reasons, addendums and imports" : "Events an integration recorded",
|
|
668
669
|
children: [
|
|
669
|
-
|
|
670
|
+
Ve[n],
|
|
670
671
|
/* @__PURE__ */ e("span", { className: "tabular-nums text-[10px] opacity-70", children: p })
|
|
671
672
|
]
|
|
672
673
|
},
|
|
673
|
-
|
|
674
|
+
n
|
|
674
675
|
);
|
|
675
676
|
}),
|
|
676
677
|
/* @__PURE__ */ e(
|
|
677
678
|
"input",
|
|
678
679
|
{
|
|
679
680
|
value: H,
|
|
680
|
-
onChange: (
|
|
681
|
+
onChange: (n) => ge(n.target.value),
|
|
681
682
|
placeholder: "Search notes…",
|
|
682
683
|
"aria-label": "Search notes",
|
|
683
684
|
"data-notes-search": !0,
|
|
@@ -687,40 +688,40 @@ function yt({
|
|
|
687
688
|
ke && /* @__PURE__ */ s("span", { className: "text-[10.5px] tabular-nums text-slate-400", "data-notes-shown": !0, children: [
|
|
688
689
|
V.length,
|
|
689
690
|
" of ",
|
|
690
|
-
|
|
691
|
+
v.length
|
|
691
692
|
] })
|
|
692
693
|
] }),
|
|
693
|
-
|
|
694
|
+
l ? /* @__PURE__ */ e("div", { className: "space-y-4", children: ["a", "b"].map((n) => /* @__PURE__ */ s("div", { className: "flex gap-3", children: [
|
|
694
695
|
/* @__PURE__ */ e("div", { className: "h-8 w-8 shrink-0 animate-pulse rounded-full bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }),
|
|
695
696
|
/* @__PURE__ */ s("div", { className: "flex-1 space-y-1.5", children: [
|
|
696
697
|
/* @__PURE__ */ e("div", { className: "h-3 w-32 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }),
|
|
697
698
|
/* @__PURE__ */ e("div", { className: "h-3 w-full animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" })
|
|
698
699
|
] })
|
|
699
|
-
] },
|
|
700
|
-
if (
|
|
700
|
+
] }, n)) }) : x ? /* @__PURE__ */ e("p", { className: "py-6 text-center text-[12px] text-red-500", children: "Failed to load comments." }) : v.length === 0 ? /* @__PURE__ */ e("p", { className: "py-6 text-center text-[12px] text-slate-400", children: "No notes yet." }) : V.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: V.map((n) => {
|
|
701
|
+
if (n.kind === "related")
|
|
701
702
|
return /* @__PURE__ */ e("div", { className: "nvr-section-enter", children: /* @__PURE__ */ e(
|
|
702
|
-
|
|
703
|
+
Ye,
|
|
703
704
|
{
|
|
704
|
-
note:
|
|
705
|
+
note: n.note,
|
|
705
706
|
collection: t,
|
|
706
707
|
item: String(i)
|
|
707
708
|
}
|
|
708
|
-
) },
|
|
709
|
-
const
|
|
709
|
+
) }, n.note.id);
|
|
710
|
+
const a = n.comment, p = E === a.user.id, Q = y === a.id;
|
|
710
711
|
return /* @__PURE__ */ s("div", { className: "nvr-section-enter group flex gap-3", children: [
|
|
711
712
|
/* @__PURE__ */ e(
|
|
712
|
-
|
|
713
|
+
ze,
|
|
713
714
|
{
|
|
714
|
-
userId:
|
|
715
|
+
userId: a.user.id,
|
|
715
716
|
className: "h-8 w-8",
|
|
716
|
-
fallback: /* @__PURE__ */ e(
|
|
717
|
+
fallback: /* @__PURE__ */ e(Be, { className: "h-8 w-8 shrink-0", children: /* @__PURE__ */ e(Ue, { className: "bg-nvr-cyan/15 text-[11px] font-bold text-nvr-navy", children: Xe(a.user) }) })
|
|
717
718
|
}
|
|
718
719
|
),
|
|
719
720
|
/* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: [
|
|
720
721
|
/* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
|
|
721
|
-
/* @__PURE__ */ e("span", { className: "text-[13px] font-medium text-slate-800", children: ee(
|
|
722
|
-
/* @__PURE__ */ e("span", { className: "text-[11px] text-slate-400", children:
|
|
723
|
-
|
|
722
|
+
/* @__PURE__ */ e("span", { className: "text-[13px] font-medium text-slate-800", children: ee(a.user) }),
|
|
723
|
+
/* @__PURE__ */ e("span", { className: "text-[11px] text-slate-400", children: ae(a.created_at) }),
|
|
724
|
+
a.updated_at && a.updated_at !== a.created_at && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-300", children: "(edited)" }),
|
|
724
725
|
!Q && /* @__PURE__ */ s("div", { className: "ml-auto flex items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100", children: [
|
|
725
726
|
/* @__PURE__ */ e(
|
|
726
727
|
"button",
|
|
@@ -728,7 +729,7 @@ function yt({
|
|
|
728
729
|
type: "button",
|
|
729
730
|
title: "Make a task from this comment",
|
|
730
731
|
className: "rounded p-1 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted",
|
|
731
|
-
onClick: () => we.mutate(
|
|
732
|
+
onClick: () => we.mutate(a),
|
|
732
733
|
children: /* @__PURE__ */ e(Se, { className: "h-3 w-3" })
|
|
733
734
|
}
|
|
734
735
|
),
|
|
@@ -739,7 +740,7 @@ function yt({
|
|
|
739
740
|
type: "button",
|
|
740
741
|
className: "rounded p-1 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-700",
|
|
741
742
|
onClick: () => {
|
|
742
|
-
|
|
743
|
+
R(a.id), O(a.text);
|
|
743
744
|
},
|
|
744
745
|
children: /* @__PURE__ */ e($e, { className: "h-3 w-3" })
|
|
745
746
|
}
|
|
@@ -749,7 +750,7 @@ function yt({
|
|
|
749
750
|
{
|
|
750
751
|
type: "button",
|
|
751
752
|
className: "rounded p-1 text-slate-400 transition-colors hover:bg-red-50 hover:text-red-500",
|
|
752
|
-
onClick: () => Ne.mutate(
|
|
753
|
+
onClick: () => Ne.mutate(a.id),
|
|
753
754
|
children: /* @__PURE__ */ e(qe, { className: "h-3 w-3" })
|
|
754
755
|
}
|
|
755
756
|
)
|
|
@@ -761,7 +762,7 @@ function yt({
|
|
|
761
762
|
te,
|
|
762
763
|
{
|
|
763
764
|
value: K,
|
|
764
|
-
onChange:
|
|
765
|
+
onChange: O,
|
|
765
766
|
rows: 3,
|
|
766
767
|
className: "text-[13px]"
|
|
767
768
|
}
|
|
@@ -773,7 +774,7 @@ function yt({
|
|
|
773
774
|
size: "sm",
|
|
774
775
|
className: "h-7 gap-1.5",
|
|
775
776
|
disabled: !K.trim() || se.isPending,
|
|
776
|
-
onClick: () => se.mutate({ id:
|
|
777
|
+
onClick: () => se.mutate({ id: a.id, text: K.trim() }),
|
|
777
778
|
children: [
|
|
778
779
|
/* @__PURE__ */ e(Ee, { className: "h-3 w-3" }),
|
|
779
780
|
" Save"
|
|
@@ -787,7 +788,7 @@ function yt({
|
|
|
787
788
|
variant: "outline",
|
|
788
789
|
className: "h-7 gap-1.5",
|
|
789
790
|
onClick: () => {
|
|
790
|
-
|
|
791
|
+
R(null), O("");
|
|
791
792
|
},
|
|
792
793
|
children: [
|
|
793
794
|
/* @__PURE__ */ e(Re, { className: "h-3 w-3" }),
|
|
@@ -796,49 +797,49 @@ function yt({
|
|
|
796
797
|
}
|
|
797
798
|
)
|
|
798
799
|
] })
|
|
799
|
-
] }) : /* @__PURE__ */ e("p", { className: "mt-0.5 whitespace-pre-wrap text-[13px] leading-relaxed text-slate-600", children: /* @__PURE__ */ e(re, { text:
|
|
800
|
-
!Q && /* @__PURE__ */ e(
|
|
800
|
+
] }) : /* @__PURE__ */ e("p", { className: "mt-0.5 whitespace-pre-wrap text-[13px] leading-relaxed text-slate-600", children: /* @__PURE__ */ e(re, { text: a.text }) }),
|
|
801
|
+
!Q && /* @__PURE__ */ e(Ge, { comment: a }),
|
|
801
802
|
!Q && /* @__PURE__ */ s("div", { className: "mt-1 flex flex-wrap items-center gap-1", children: [
|
|
802
|
-
(
|
|
803
|
+
(a.reactions ?? []).map((T) => /* @__PURE__ */ s(
|
|
803
804
|
"button",
|
|
804
805
|
{
|
|
805
806
|
type: "button",
|
|
806
|
-
onClick: () => oe.mutate({ id:
|
|
807
|
-
className: `inline-flex items-center gap-1 rounded-full border px-1.5 py-px text-[11px] transition-colors ${
|
|
807
|
+
onClick: () => oe.mutate({ id: a.id, emoji: T.emoji }),
|
|
808
|
+
className: `inline-flex items-center gap-1 rounded-full border px-1.5 py-px text-[11px] transition-colors ${T.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"}`,
|
|
808
809
|
children: [
|
|
809
|
-
|
|
810
|
-
/* @__PURE__ */ e("span", { className: "tabular-nums text-[10px] font-semibold", children:
|
|
810
|
+
T.emoji,
|
|
811
|
+
/* @__PURE__ */ e("span", { className: "tabular-nums text-[10px] font-semibold", children: T.count })
|
|
811
812
|
]
|
|
812
813
|
},
|
|
813
|
-
|
|
814
|
+
T.emoji
|
|
814
815
|
)),
|
|
815
816
|
/* @__PURE__ */ s("span", { className: "relative", children: [
|
|
816
817
|
/* @__PURE__ */ e(
|
|
817
818
|
"button",
|
|
818
819
|
{
|
|
819
820
|
type: "button",
|
|
820
|
-
onClick: () => ie(le ===
|
|
821
|
+
onClick: () => ie(le === a.id ? null : a.id),
|
|
821
822
|
className: "rounded p-0.5 text-slate-300 transition-colors hover:bg-slate-100 hover:text-slate-500 dark:hover:bg-muted",
|
|
822
823
|
"aria-label": "Add reaction",
|
|
823
824
|
children: /* @__PURE__ */ e(he, { className: "h-3.5 w-3.5" })
|
|
824
825
|
}
|
|
825
826
|
),
|
|
826
|
-
le ===
|
|
827
|
+
le === a.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: be.map((T) => /* @__PURE__ */ e(
|
|
827
828
|
"button",
|
|
828
829
|
{
|
|
829
830
|
type: "button",
|
|
830
831
|
onClick: () => {
|
|
831
|
-
oe.mutate({ id:
|
|
832
|
+
oe.mutate({ id: a.id, emoji: T }), ie(null);
|
|
832
833
|
},
|
|
833
834
|
className: "rounded-full px-1 text-[14px] hover:bg-muted",
|
|
834
|
-
children:
|
|
835
|
+
children: T
|
|
835
836
|
},
|
|
836
|
-
|
|
837
|
+
T
|
|
837
838
|
)) })
|
|
838
839
|
] })
|
|
839
840
|
] })
|
|
840
841
|
] })
|
|
841
|
-
] },
|
|
842
|
+
] }, a.id);
|
|
842
843
|
}) })
|
|
843
844
|
] }) })
|
|
844
845
|
]
|
|
@@ -847,5 +848,5 @@ function yt({
|
|
|
847
848
|
);
|
|
848
849
|
}
|
|
849
850
|
export {
|
|
850
|
-
|
|
851
|
+
kt as CommentPanel
|
|
851
852
|
};
|