@nivaro/react 0.3.105 β 0.3.107
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 -0
- package/dist/index.js +713 -708
- package/dist/shared/components/CollectionBrowserView.js +908 -892
- package/dist/shared/components/EnvironmentNotice.js +127 -0
- package/dist/shared/components/WidgetSlot.js +51 -50
- package/dist/shared/components/item-edit/GroupSection.js +116 -112
- package/dist/shared/components/panels/AddendumPanel.js +548 -547
- package/dist/shared/components/panels/CommentPanel.js +253 -256
- package/dist/shared/components/panels/OwnersSlot.js +35 -39
- package/dist/shared/components/panels/PipelinePanel.js +1048 -1051
- package/dist/shared/components/panels/ReferencedByPanel.js +16 -16
- package/dist/shared/components/panels/RelatedRecordsPanel.js +33 -32
- package/dist/shared/components/panels/TaskPanel.js +259 -262
- package/dist/shared/lib/use-starts-open.js +10 -0
- package/package.json +1 -1
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { jsxs as s, jsx as e, Fragment as
|
|
2
|
-
import { useQueryClient as ke, useQuery as z, useMutation as
|
|
3
|
-
import { MessageSquare as
|
|
4
|
-
import { useState as
|
|
1
|
+
import { jsxs as s, jsx as e, Fragment as V } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as ke, useQuery as z, useMutation as j } from "@tanstack/react-query";
|
|
3
|
+
import { MessageSquare as De, ChevronDown as Te, ClipboardPlus as Pe, Pencil as Fe, Trash2 as Re, Check as Me, X as Ie, SmilePlus as Ne } from "lucide-react";
|
|
4
|
+
import { useState as _, useRef as Y, useEffect as Z, useMemo as X } from "react";
|
|
5
5
|
import { createPortal as Oe } 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
|
|
10
|
-
import { usePresenceOnlinePoll as
|
|
11
|
-
import { useRecordSignalPeers as
|
|
12
|
-
import { invalidateRecordTasks as
|
|
7
|
+
import { useNivaroClient as oe, useItemEditAuth as je, useDrilldown as Ae } from "../../context.js";
|
|
8
|
+
import { useDebounced as Le } from "../../hooks/useDebounced.js";
|
|
9
|
+
import { get as U, 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 { useStartsOpen as He } from "../../lib/use-starts-open.js";
|
|
13
14
|
import { formatRelative as le, formatDateTime as ie, titleCase as Xe } from "../../lib/utils.js";
|
|
14
15
|
import { AgentBadge as Je } from "../AgentBadge.js";
|
|
15
16
|
import { AutolinkedText as se } from "../AutolinkedText.js";
|
|
@@ -17,29 +18,29 @@ import { InboundRequestPopover as Ve } from "../integrations/InboundRequest.js";
|
|
|
17
18
|
import { useFieldComments as Ze } from "../item-edit/field-comments-context.js";
|
|
18
19
|
import { UserAvatar as Ye } from "../UserAvatar.js";
|
|
19
20
|
import { Avatar as et, AvatarFallback as tt } from "../ui/avatar.js";
|
|
20
|
-
import { Button as
|
|
21
|
+
import { Button as J } from "../ui/button.js";
|
|
21
22
|
import { Separator as ge } from "../ui/separator.js";
|
|
22
23
|
import { Textarea as at } from "../ui/textarea.js";
|
|
23
24
|
import { RecordEventPathSheet as nt } from "./IntegrationActivitySection.js";
|
|
24
25
|
const we = ["π", "β
", "π", "π", "β€οΈ", "π"];
|
|
25
26
|
function rt(t) {
|
|
26
|
-
var d,
|
|
27
|
-
return [(d = t.first_name) == null ? void 0 : d[0], (
|
|
27
|
+
var d, u, b, m;
|
|
28
|
+
return [(d = t.first_name) == null ? void 0 : d[0], (u = t.last_name) == null ? void 0 : u[0]].filter(Boolean).join("").toUpperCase() || ((m = (b = t.email) == null ? void 0 : b[0]) == null ? void 0 : m.toUpperCase()) || "?";
|
|
28
29
|
}
|
|
29
30
|
function st({ comment: t }) {
|
|
30
|
-
const
|
|
31
|
+
const i = (t.mentions ?? []).filter(
|
|
31
32
|
(d) => {
|
|
32
|
-
var
|
|
33
|
-
return d.id && String(d.id).toUpperCase() !== String(((
|
|
33
|
+
var u;
|
|
34
|
+
return d.id && String(d.id).toUpperCase() !== String(((u = t.user) == null ? void 0 : u.id) ?? "").toUpperCase();
|
|
34
35
|
}
|
|
35
36
|
);
|
|
36
|
-
return
|
|
37
|
+
return i.length === 0 ? null : /* @__PURE__ */ e(
|
|
37
38
|
"p",
|
|
38
39
|
{
|
|
39
40
|
className: "mt-1 flex flex-wrap items-center gap-x-3 gap-y-0.5 text-[11px]",
|
|
40
41
|
"data-mention-receipts": !0,
|
|
41
|
-
children:
|
|
42
|
-
const
|
|
42
|
+
children: i.map((d) => {
|
|
43
|
+
const u = [d.first_name, d.last_name].filter(Boolean).join(" ") || d.email || "Someone";
|
|
43
44
|
return /* @__PURE__ */ s(
|
|
44
45
|
"span",
|
|
45
46
|
{
|
|
@@ -48,7 +49,7 @@ function st({ comment: t }) {
|
|
|
48
49
|
className: d.seen_at ? "text-emerald-600 dark:text-emerald-400" : "text-slate-400",
|
|
49
50
|
children: [
|
|
50
51
|
d.seen_at ? "β " : "",
|
|
51
|
-
|
|
52
|
+
u,
|
|
52
53
|
d.seen_at ? ` saw this ${le(d.seen_at)}` : " has not seen this yet"
|
|
53
54
|
]
|
|
54
55
|
},
|
|
@@ -63,109 +64,109 @@ function ne(t) {
|
|
|
63
64
|
}
|
|
64
65
|
function ot({
|
|
65
66
|
field: t,
|
|
66
|
-
label:
|
|
67
|
+
label: i,
|
|
67
68
|
resolved: d,
|
|
68
|
-
onJump:
|
|
69
|
+
onJump: u
|
|
69
70
|
}) {
|
|
70
|
-
const
|
|
71
|
+
const b = /* @__PURE__ */ s(V, { children: [
|
|
71
72
|
"on ",
|
|
72
|
-
/* @__PURE__ */ e("span", { className: "font-medium", children:
|
|
73
|
+
/* @__PURE__ */ e("span", { className: "font-medium", children: i }),
|
|
73
74
|
d && /* @__PURE__ */ e("span", { className: "text-slate-400 dark:text-slate-500", children: " Β· resolved" })
|
|
74
75
|
] }), m = "inline-flex min-w-0 max-w-[220px] items-center gap-1 truncate rounded-full border border-slate-200 bg-slate-50 px-1.5 py-px text-[10.5px] text-slate-600 dark:border-border dark:bg-muted dark:text-slate-300";
|
|
75
|
-
return
|
|
76
|
+
return u ? /* @__PURE__ */ e(
|
|
76
77
|
"button",
|
|
77
78
|
{
|
|
78
79
|
type: "button",
|
|
79
80
|
"data-comment-field": t,
|
|
80
|
-
onClick:
|
|
81
|
-
"data-tip": `Go to ${
|
|
81
|
+
onClick: u,
|
|
82
|
+
"data-tip": `Go to ${i}`,
|
|
82
83
|
className: `${m} transition-colors hover:border-nvr-cyan/50 hover:text-[#0e7490] dark:hover:text-nvr-cyan`,
|
|
83
|
-
children:
|
|
84
|
+
children: b
|
|
84
85
|
}
|
|
85
|
-
) : /* @__PURE__ */ e("span", { "data-comment-field": t, className: m, children:
|
|
86
|
+
) : /* @__PURE__ */ e("span", { "data-comment-field": t, className: m, children: b });
|
|
86
87
|
}
|
|
87
|
-
function lt(t,
|
|
88
|
-
const
|
|
89
|
-
return
|
|
88
|
+
function lt(t, i) {
|
|
89
|
+
const u = t.slice(0, i).match(/(^|\s)@([a-zA-Z0-9._-]{2,})$/);
|
|
90
|
+
return u ? { start: i - u[2].length - 1, query: u[2] } : null;
|
|
90
91
|
}
|
|
91
92
|
function ye(t) {
|
|
92
93
|
return t.email.split("@")[0];
|
|
93
94
|
}
|
|
94
95
|
function re({
|
|
95
96
|
value: t,
|
|
96
|
-
onChange:
|
|
97
|
+
onChange: i,
|
|
97
98
|
...d
|
|
98
99
|
}) {
|
|
99
|
-
const
|
|
100
|
+
const u = oe(), b = Y(null), [m, C] = _(null), [g, k] = _(0), v = Le((m == null ? void 0 : m.query) ?? "", 200), { data: S = [] } = z({
|
|
100
101
|
queryKey: ["users", "mention-search", v],
|
|
101
|
-
queryFn: () =>
|
|
102
|
-
|
|
102
|
+
queryFn: () => u.request(
|
|
103
|
+
U("/users", { limit: 8, sort: "first_name", search: v })
|
|
103
104
|
).then((a) => a.data),
|
|
104
105
|
enabled: !!m && v.length >= 2,
|
|
105
106
|
staleTime: 3e4
|
|
106
|
-
}),
|
|
107
|
+
}), q = Qe(15e3, !!m), { data: D } = z({
|
|
107
108
|
queryKey: ["presence-online"],
|
|
108
|
-
queryFn: () =>
|
|
109
|
-
|
|
109
|
+
queryFn: () => u.request(
|
|
110
|
+
U("/presence/online")
|
|
110
111
|
),
|
|
111
112
|
enabled: !!m,
|
|
112
|
-
refetchInterval:
|
|
113
|
+
refetchInterval: q,
|
|
113
114
|
staleTime: 5e3
|
|
114
|
-
}),
|
|
115
|
+
}), c = (a) => {
|
|
115
116
|
var p;
|
|
116
|
-
const
|
|
117
|
-
return
|
|
118
|
-
},
|
|
117
|
+
const l = (p = D == null ? void 0 : D.data) == null ? void 0 : p.find((f) => String(f.user_id).toUpperCase() === a.toUpperCase());
|
|
118
|
+
return l ? l.is_idle || l.away ? 1 : 0 : 2;
|
|
119
|
+
}, y = [...S].sort((a, l) => c(a.id) - c(l.id)), { data: T = [] } = z({
|
|
119
120
|
queryKey: ["mention-roles"],
|
|
120
|
-
queryFn: () =>
|
|
121
|
+
queryFn: () => u.request(U("/chat/roles")).then((a) => a.data).catch(() => []),
|
|
121
122
|
enabled: !!m,
|
|
122
123
|
staleTime: 5 * 6e4
|
|
123
|
-
}),
|
|
124
|
+
}), $ = m ? T.filter(
|
|
124
125
|
(a) => a.name.toLowerCase().replace(/\s+/g, "-").startsWith(v.toLowerCase())
|
|
125
|
-
).slice(0, 3) : [],
|
|
126
|
-
|
|
127
|
-
if (!
|
|
128
|
-
|
|
126
|
+
).slice(0, 3) : [], N = !!m && v.length >= 2 && "owners".startsWith(v.toLowerCase()), P = !!m && v.length >= 2 && (y.length > 0 || N || $.length > 0), o = y.length + (N ? 1 : 0) + $.length, [h, E] = _(null), W = Y(null);
|
|
127
|
+
Z(() => {
|
|
128
|
+
if (!P || !b.current) {
|
|
129
|
+
E(null);
|
|
129
130
|
return;
|
|
130
131
|
}
|
|
131
|
-
const a =
|
|
132
|
-
|
|
133
|
-
const
|
|
134
|
-
var
|
|
135
|
-
(
|
|
132
|
+
const a = b.current.getBoundingClientRect();
|
|
133
|
+
E({ top: a.bottom + 4, left: a.left, width: Math.min(a.width, 360) });
|
|
134
|
+
const l = (f) => {
|
|
135
|
+
var w;
|
|
136
|
+
(w = W.current) != null && w.contains(f.target) || C(null);
|
|
136
137
|
}, p = () => C(null);
|
|
137
|
-
return window.addEventListener("scroll",
|
|
138
|
-
window.removeEventListener("scroll",
|
|
138
|
+
return window.addEventListener("scroll", l, !0), window.addEventListener("resize", p), () => {
|
|
139
|
+
window.removeEventListener("scroll", l, !0), window.removeEventListener("resize", p);
|
|
139
140
|
};
|
|
140
|
-
}, [
|
|
141
|
-
function
|
|
142
|
-
const
|
|
143
|
-
C(
|
|
141
|
+
}, [P]);
|
|
142
|
+
function A(a) {
|
|
143
|
+
const l = lt(a.value, a.selectionStart ?? a.value.length);
|
|
144
|
+
C(l), l || k(0);
|
|
144
145
|
}
|
|
145
|
-
function
|
|
146
|
-
if (!m || !
|
|
147
|
-
const
|
|
148
|
-
|
|
149
|
-
const
|
|
146
|
+
function F(a) {
|
|
147
|
+
if (!m || !b.current) return;
|
|
148
|
+
const l = b.current.selectionStart ?? t.length, p = a === "__owners__" ? "@owners " : typeof a == "object" && "role" in a ? `@${a.role.toLowerCase().replace(/\s+/g, "-")} ` : `@${ye(a)} `, f = t.slice(0, m.start) + p + t.slice(l);
|
|
149
|
+
i(f), C(null), k(0);
|
|
150
|
+
const w = m.start + p.length;
|
|
150
151
|
requestAnimationFrame(() => {
|
|
151
|
-
var
|
|
152
|
-
(
|
|
152
|
+
var O, L;
|
|
153
|
+
(O = b.current) == null || O.focus(), (L = b.current) == null || L.setSelectionRange(w, w);
|
|
153
154
|
});
|
|
154
155
|
}
|
|
155
|
-
function
|
|
156
|
-
if (
|
|
156
|
+
function Q(a) {
|
|
157
|
+
if (P)
|
|
157
158
|
if (a.key === "ArrowDown")
|
|
158
|
-
a.preventDefault(),
|
|
159
|
+
a.preventDefault(), k((l) => (l + 1) % o);
|
|
159
160
|
else if (a.key === "ArrowUp")
|
|
160
|
-
a.preventDefault(),
|
|
161
|
+
a.preventDefault(), k((l) => (l - 1 + o) % o);
|
|
161
162
|
else if (a.key === "Enter" || a.key === "Tab") {
|
|
162
163
|
a.preventDefault();
|
|
163
|
-
const
|
|
164
|
-
if (
|
|
165
|
-
else if (
|
|
166
|
-
const
|
|
167
|
-
|
|
168
|
-
} else
|
|
164
|
+
const l = Math.min(g, o - 1), p = N ? 1 : 0, f = p + y.length;
|
|
165
|
+
if (N && l === 0) F("__owners__");
|
|
166
|
+
else if (l >= f) {
|
|
167
|
+
const w = $[l - f];
|
|
168
|
+
w && F({ role: w.name });
|
|
169
|
+
} else F(y[l - p]);
|
|
169
170
|
} else a.key === "Escape" && (a.preventDefault(), C(null));
|
|
170
171
|
}
|
|
171
172
|
return /* @__PURE__ */ s("div", { className: "relative", children: [
|
|
@@ -173,35 +174,35 @@ function re({
|
|
|
173
174
|
at,
|
|
174
175
|
{
|
|
175
176
|
...d,
|
|
176
|
-
ref:
|
|
177
|
+
ref: b,
|
|
177
178
|
value: t,
|
|
178
179
|
onChange: (a) => {
|
|
179
|
-
|
|
180
|
+
i(a.target.value), A(a.target);
|
|
180
181
|
},
|
|
181
|
-
onKeyDown:
|
|
182
|
-
onClick: (a) =>
|
|
182
|
+
onKeyDown: Q,
|
|
183
|
+
onClick: (a) => A(a.currentTarget),
|
|
183
184
|
onBlur: () => setTimeout(() => C(null), 150)
|
|
184
185
|
}
|
|
185
186
|
),
|
|
186
|
-
|
|
187
|
+
P && h && Oe(
|
|
187
188
|
/* @__PURE__ */ s(
|
|
188
189
|
"div",
|
|
189
190
|
{
|
|
190
|
-
ref:
|
|
191
|
+
ref: W,
|
|
191
192
|
"data-mention-menu": "",
|
|
192
193
|
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",
|
|
193
|
-
style: { top:
|
|
194
|
+
style: { top: h.top, left: h.left, width: h.width },
|
|
194
195
|
onMouseDown: (a) => a.preventDefault(),
|
|
195
196
|
children: [
|
|
196
|
-
|
|
197
|
+
N && /* @__PURE__ */ s(
|
|
197
198
|
"button",
|
|
198
199
|
{
|
|
199
200
|
type: "button",
|
|
200
201
|
onMouseDown: (a) => {
|
|
201
|
-
a.preventDefault(),
|
|
202
|
+
a.preventDefault(), F("__owners__");
|
|
202
203
|
},
|
|
203
|
-
onMouseEnter: () =>
|
|
204
|
-
className: `flex w-full items-center gap-2.5 px-2.5 py-1.5 text-left transition-colors ${
|
|
204
|
+
onMouseEnter: () => k(0),
|
|
205
|
+
className: `flex w-full items-center gap-2.5 px-2.5 py-1.5 text-left transition-colors ${g === 0 ? "bg-nvr-cyan/10" : ""}`,
|
|
205
206
|
children: [
|
|
206
207
|
/* @__PURE__ */ e("span", { className: "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: "β
" }),
|
|
207
208
|
/* @__PURE__ */ s("span", { className: "min-w-0 flex-1", children: [
|
|
@@ -211,32 +212,32 @@ function re({
|
|
|
211
212
|
]
|
|
212
213
|
}
|
|
213
214
|
),
|
|
214
|
-
|
|
215
|
-
var
|
|
216
|
-
const p =
|
|
215
|
+
y.map((a, l) => {
|
|
216
|
+
var w, O;
|
|
217
|
+
const p = N ? l + 1 : l, f = [a.first_name, a.last_name].filter(Boolean).join(" ") || a.email;
|
|
217
218
|
return /* @__PURE__ */ s(
|
|
218
219
|
"button",
|
|
219
220
|
{
|
|
220
221
|
type: "button",
|
|
221
222
|
onMouseDown: (L) => {
|
|
222
|
-
L.preventDefault(),
|
|
223
|
+
L.preventDefault(), F(a);
|
|
223
224
|
},
|
|
224
|
-
onMouseEnter: () =>
|
|
225
|
-
className: `flex w-full items-center gap-2.5 px-2.5 py-1.5 text-left transition-colors ${p ===
|
|
225
|
+
onMouseEnter: () => k(p),
|
|
226
|
+
className: `flex w-full items-center gap-2.5 px-2.5 py-1.5 text-left transition-colors ${p === g ? "bg-nvr-cyan/10" : ""}`,
|
|
226
227
|
children: [
|
|
227
228
|
/* @__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: [
|
|
228
|
-
(`${((
|
|
229
|
-
|
|
229
|
+
(`${((w = a.first_name) == null ? void 0 : w[0]) ?? ""}${((O = a.last_name) == null ? void 0 : O[0]) ?? ""}`.trim() || a.email[0]).toUpperCase(),
|
|
230
|
+
c(a.id) < 2 && /* @__PURE__ */ e(
|
|
230
231
|
"span",
|
|
231
232
|
{
|
|
232
|
-
"data-mention-presence":
|
|
233
|
-
title:
|
|
234
|
-
className: `absolute -bottom-px -right-px h-2 w-2 rounded-full ring-2 ring-white dark:ring-popover ${
|
|
233
|
+
"data-mention-presence": c(a.id) === 0 ? "online" : "idle",
|
|
234
|
+
title: c(a.id) === 0 ? "Online" : "Idle",
|
|
235
|
+
className: `absolute -bottom-px -right-px h-2 w-2 rounded-full ring-2 ring-white dark:ring-popover ${c(a.id) === 0 ? "bg-emerald-500" : "border border-amber-500 bg-white dark:bg-popover"}`
|
|
235
236
|
}
|
|
236
237
|
)
|
|
237
238
|
] }),
|
|
238
239
|
/* @__PURE__ */ s("span", { className: "min-w-0 flex-1", children: [
|
|
239
|
-
/* @__PURE__ */ e("span", { className: "block truncate text-[12px] font-medium text-slate-700 dark:text-slate-200", children:
|
|
240
|
+
/* @__PURE__ */ e("span", { className: "block truncate text-[12px] font-medium text-slate-700 dark:text-slate-200", children: f }),
|
|
240
241
|
/* @__PURE__ */ s("span", { className: "block truncate text-[11px] text-slate-400", children: [
|
|
241
242
|
a.is_out_of_office && /* @__PURE__ */ s("span", { className: "mr-1 rounded bg-amber-100 px-1 py-px text-[9.5px] font-semibold text-amber-700 dark:bg-amber-400/15 dark:text-amber-400", children: [
|
|
242
243
|
"OOO",
|
|
@@ -255,17 +256,17 @@ function re({
|
|
|
255
256
|
a.id
|
|
256
257
|
);
|
|
257
258
|
}),
|
|
258
|
-
|
|
259
|
-
const p =
|
|
259
|
+
$.map((a, l) => {
|
|
260
|
+
const p = y.length + (N ? 1 : 0) + l;
|
|
260
261
|
return /* @__PURE__ */ s(
|
|
261
262
|
"button",
|
|
262
263
|
{
|
|
263
264
|
type: "button",
|
|
264
|
-
onMouseDown: (
|
|
265
|
-
|
|
265
|
+
onMouseDown: (f) => {
|
|
266
|
+
f.preventDefault(), F({ role: a.name });
|
|
266
267
|
},
|
|
267
|
-
onMouseEnter: () =>
|
|
268
|
-
className: `flex w-full items-center gap-2.5 px-2.5 py-1.5 text-left transition-colors ${p ===
|
|
268
|
+
onMouseEnter: () => k(p),
|
|
269
|
+
className: `flex w-full items-center gap-2.5 px-2.5 py-1.5 text-left transition-colors ${p === g ? "bg-nvr-cyan/10" : ""}`,
|
|
269
270
|
children: [
|
|
270
271
|
/* @__PURE__ */ e("span", { className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-violet-500/15 text-[10px] font-semibold text-violet-600 dark:text-violet-300", children: "R" }),
|
|
271
272
|
/* @__PURE__ */ s("span", { className: "min-w-0 flex-1", children: [
|
|
@@ -302,74 +303,74 @@ const it = {
|
|
|
302
303
|
integration: "Integration"
|
|
303
304
|
};
|
|
304
305
|
function dt(t) {
|
|
305
|
-
const
|
|
306
|
-
return (t.kind === "comment" ?
|
|
306
|
+
const i = t.kind === "comment" ? t.comment.text : t.note.text;
|
|
307
|
+
return (t.kind === "comment" ? i.replace(/<[^>]*>/g, " ") : i).replace(/@\[([^\]]+)\]/g, "@$1").replace(/\s+/g, " ").trim();
|
|
307
308
|
}
|
|
308
309
|
const ct = "integrations:";
|
|
309
310
|
function mt({
|
|
310
311
|
note: t,
|
|
311
|
-
collection:
|
|
312
|
+
collection: i,
|
|
312
313
|
item: d
|
|
313
314
|
}) {
|
|
314
|
-
var
|
|
315
|
-
const
|
|
316
|
-
mutationFn: (o) =>
|
|
315
|
+
var P;
|
|
316
|
+
const u = Ae(), [b, m] = _(!1), C = t.source === "external" && !!t.provider && !t.provider.startsWith(ct), g = oe(), k = ke(), [v, S] = _(!1), q = j({
|
|
317
|
+
mutationFn: (o) => g.request(B(`/comments/${t.comment_id}/reactions`, { emoji: o })),
|
|
317
318
|
onSuccess: () => {
|
|
318
|
-
|
|
319
|
+
S(!1), k.invalidateQueries({ queryKey: ["comments-related"] }), k.invalidateQueries({ queryKey: ["row-comment-counts"] });
|
|
319
320
|
},
|
|
320
321
|
onError: () => I.error("Failed to react")
|
|
321
|
-
}), [
|
|
322
|
-
mutationFn: () =>
|
|
322
|
+
}), [D, c] = _(!1), y = j({
|
|
323
|
+
mutationFn: () => g.request(
|
|
323
324
|
B(`/integration-events/${encodeURIComponent(t.provider ?? "")}/replay`, {
|
|
324
325
|
entry_id: t.id.replace(/^external:/, "")
|
|
325
326
|
})
|
|
326
327
|
),
|
|
327
328
|
onSuccess: (o) => {
|
|
328
|
-
var
|
|
329
|
-
|
|
330
|
-
description: (
|
|
331
|
-
}),
|
|
329
|
+
var h;
|
|
330
|
+
c(!1), I.success("Event replayed", {
|
|
331
|
+
description: (h = o == null ? void 0 : o.data) == null ? void 0 : h.detail
|
|
332
|
+
}), k.invalidateQueries({ queryKey: ["comments-related"] });
|
|
332
333
|
},
|
|
333
334
|
onError: (o) => {
|
|
334
|
-
var
|
|
335
|
-
|
|
336
|
-
const
|
|
337
|
-
I.error(
|
|
335
|
+
var E;
|
|
336
|
+
c(!1);
|
|
337
|
+
const h = (E = o == null ? void 0 : o.response) == null ? void 0 : E.error;
|
|
338
|
+
I.error(h ?? (o == null ? void 0 : o.message) ?? "Replay failed", { duration: 8e3 });
|
|
338
339
|
}
|
|
339
|
-
}),
|
|
340
|
+
}), T = t.link ? () => {
|
|
340
341
|
const o = t.link;
|
|
341
342
|
if (!o) return;
|
|
342
|
-
const
|
|
343
|
-
if (
|
|
344
|
-
|
|
343
|
+
const h = document.querySelector(`[data-o2m-row="${o.collection}:${o.item_id}"]`);
|
|
344
|
+
if (h) {
|
|
345
|
+
h.scrollIntoView({ behavior: "smooth", block: "center" }), h.classList.add("nvr-row-flash"), setTimeout(() => h.classList.remove("nvr-row-flash"), 2400);
|
|
345
346
|
return;
|
|
346
347
|
}
|
|
347
|
-
|
|
348
|
-
} : null,
|
|
348
|
+
u == null || u.open({ collection: o.collection, itemId: o.item_id });
|
|
349
|
+
} : null, $ = 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", N = t.source === "import" && ((P = t.import) != null && P.file_id) ? t.import : null;
|
|
349
350
|
return /* @__PURE__ */ s("div", { className: "flex gap-3", "data-recorded-note": t.source, children: [
|
|
350
351
|
/* @__PURE__ */ e("div", { className: "mt-1 h-8 w-8 shrink-0", "aria-hidden": !0 }),
|
|
351
352
|
/* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: [
|
|
352
353
|
/* @__PURE__ */ s("div", { className: "flex flex-wrap items-center gap-x-2 gap-y-1", children: [
|
|
353
|
-
/* @__PURE__ */ e("span", { className: `rounded border px-1.5 py-px text-[10px] font-medium ${
|
|
354
|
+
/* @__PURE__ */ e("span", { className: `rounded border px-1.5 py-px text-[10px] font-medium ${$}`, children: t.label }),
|
|
354
355
|
t.user_name && /* @__PURE__ */ e("span", { className: "text-[12px] font-medium text-slate-700 dark:text-slate-200", children: t.user_name }),
|
|
355
|
-
t.context && (
|
|
356
|
+
t.context && (T ? /* @__PURE__ */ e(
|
|
356
357
|
"button",
|
|
357
358
|
{
|
|
358
359
|
type: "button",
|
|
359
|
-
onClick:
|
|
360
|
+
onClick: T,
|
|
360
361
|
className: "truncate text-[11px] text-nvr-navy underline-offset-2 hover:underline dark:text-nvr-cyan",
|
|
361
362
|
"data-line-comment-link": !0,
|
|
362
363
|
children: t.context
|
|
363
364
|
}
|
|
364
|
-
) :
|
|
365
|
+
) : N ? /* @__PURE__ */ e(
|
|
365
366
|
"a",
|
|
366
367
|
{
|
|
367
|
-
href: `/api/files/${
|
|
368
|
+
href: `/api/files/${N.file_id}?download=1`,
|
|
368
369
|
target: "_blank",
|
|
369
370
|
rel: "noreferrer",
|
|
370
371
|
onClick: (o) => o.stopPropagation(),
|
|
371
372
|
className: "truncate text-[11px] text-nvr-navy underline decoration-dotted underline-offset-2 dark:text-nvr-cyan",
|
|
372
|
-
"data-note-import-file":
|
|
373
|
+
"data-note-import-file": N.file_id ?? void 0,
|
|
373
374
|
children: t.context
|
|
374
375
|
}
|
|
375
376
|
) : /* @__PURE__ */ e("span", { className: "truncate text-[11px] text-slate-400", children: t.context })),
|
|
@@ -379,7 +380,7 @@ function mt({
|
|
|
379
380
|
{
|
|
380
381
|
activityId: t.inbound.activity_id,
|
|
381
382
|
callerName: t.label,
|
|
382
|
-
collection:
|
|
383
|
+
collection: i,
|
|
383
384
|
itemId: d,
|
|
384
385
|
align: "end",
|
|
385
386
|
children: /* @__PURE__ */ e(
|
|
@@ -410,13 +411,13 @@ function mt({
|
|
|
410
411
|
"button",
|
|
411
412
|
{
|
|
412
413
|
type: "button",
|
|
413
|
-
onClick: () =>
|
|
414
|
-
onBlur: () =>
|
|
415
|
-
disabled:
|
|
414
|
+
onClick: () => D ? y.mutate() : c(!0),
|
|
415
|
+
onBlur: () => c(!1),
|
|
416
|
+
disabled: y.isPending,
|
|
416
417
|
"data-note-replay": t.id,
|
|
417
|
-
className: `rounded px-1.5 py-px text-[10.5px] font-medium transition-colors ${
|
|
418
|
+
className: `rounded px-1.5 py-px text-[10.5px] font-medium transition-colors ${D ? "bg-sky-600 text-white" : "text-sky-700 hover:bg-sky-50 dark:text-sky-300 dark:hover:bg-sky-900/20"}`,
|
|
418
419
|
"data-tip": "Re-apply this event from its stored payload",
|
|
419
|
-
children:
|
|
420
|
+
children: y.isPending ? "Replayingβ¦" : D ? "Replay this event?" : "Replay"
|
|
420
421
|
}
|
|
421
422
|
)
|
|
422
423
|
] }),
|
|
@@ -426,7 +427,7 @@ function mt({
|
|
|
426
427
|
"button",
|
|
427
428
|
{
|
|
428
429
|
type: "button",
|
|
429
|
-
onClick: () =>
|
|
430
|
+
onClick: () => q.mutate(o.emoji),
|
|
430
431
|
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"}`,
|
|
431
432
|
children: [
|
|
432
433
|
o.emoji,
|
|
@@ -440,7 +441,7 @@ function mt({
|
|
|
440
441
|
"button",
|
|
441
442
|
{
|
|
442
443
|
type: "button",
|
|
443
|
-
onClick: () =>
|
|
444
|
+
onClick: () => S((o) => !o),
|
|
444
445
|
className: "rounded p-0.5 text-slate-300 transition-colors hover:bg-slate-100 hover:text-slate-500 dark:hover:bg-muted",
|
|
445
446
|
"aria-label": "Add reaction",
|
|
446
447
|
children: /* @__PURE__ */ e(Ne, { className: "h-3.5 w-3.5" })
|
|
@@ -450,7 +451,7 @@ function mt({
|
|
|
450
451
|
"button",
|
|
451
452
|
{
|
|
452
453
|
type: "button",
|
|
453
|
-
onClick: () =>
|
|
454
|
+
onClick: () => q.mutate(o),
|
|
454
455
|
className: "rounded-full px-1 text-[14px] hover:bg-muted",
|
|
455
456
|
children: o
|
|
456
457
|
},
|
|
@@ -462,10 +463,10 @@ function mt({
|
|
|
462
463
|
C && t.provider && /* @__PURE__ */ e(
|
|
463
464
|
nt,
|
|
464
465
|
{
|
|
465
|
-
target:
|
|
466
|
+
target: b ? {
|
|
466
467
|
source: t.provider,
|
|
467
468
|
id: t.id.replace(/^external:/, ""),
|
|
468
|
-
record: { collection:
|
|
469
|
+
record: { collection: i, item: d }
|
|
469
470
|
} : null,
|
|
470
471
|
event: { label: t.label },
|
|
471
472
|
onClose: () => m(!1)
|
|
@@ -473,105 +474,101 @@ function mt({
|
|
|
473
474
|
)
|
|
474
475
|
] });
|
|
475
476
|
}
|
|
476
|
-
function
|
|
477
|
+
function It({
|
|
477
478
|
collection: t,
|
|
478
|
-
item:
|
|
479
|
+
item: i,
|
|
479
480
|
title: d,
|
|
480
|
-
defaultExpanded:
|
|
481
|
-
queuedComments:
|
|
481
|
+
defaultExpanded: u,
|
|
482
|
+
queuedComments: b,
|
|
482
483
|
onQueueComment: m,
|
|
483
484
|
onUnsentDraft: C
|
|
484
485
|
}) {
|
|
485
|
-
const
|
|
486
|
-
|
|
487
|
-
!_.current && c !== void 0 && (_.current = !0, E(c));
|
|
488
|
-
}, [c]);
|
|
489
|
-
const [u, D] = N(""), S = U(C);
|
|
490
|
-
S.current = C, Q(() => {
|
|
486
|
+
const g = oe(), { userId: k } = je(), v = ke(), S = Ze(), [q, D] = He(u, !1), [c, y] = _(""), T = Y(C);
|
|
487
|
+
T.current = C, Z(() => {
|
|
491
488
|
var r;
|
|
492
|
-
(r =
|
|
493
|
-
}, [
|
|
494
|
-
const [
|
|
489
|
+
(r = T.current) == null || r.call(T, c);
|
|
490
|
+
}, [c]);
|
|
491
|
+
const [$, N] = _(!1), P = async () => {
|
|
495
492
|
var r;
|
|
496
|
-
if (!(!
|
|
497
|
-
|
|
493
|
+
if (!(!c.trim() || $)) {
|
|
494
|
+
N(!0);
|
|
498
495
|
try {
|
|
499
|
-
const n = await
|
|
500
|
-
B("/ai/cleanup", { text:
|
|
496
|
+
const n = await g.request(
|
|
497
|
+
B("/ai/cleanup", { text: c })
|
|
501
498
|
);
|
|
502
|
-
(r = n.data) != null && r.text &&
|
|
499
|
+
(r = n.data) != null && r.text && y(n.data.text);
|
|
503
500
|
} catch {
|
|
504
501
|
} finally {
|
|
505
|
-
|
|
502
|
+
N(!1);
|
|
506
503
|
}
|
|
507
504
|
}
|
|
508
|
-
},
|
|
509
|
-
|
|
510
|
-
if (!
|
|
511
|
-
|
|
505
|
+
}, o = ze(t, i, "note"), h = Ue(t, i, "note"), E = Y(0);
|
|
506
|
+
Z(() => {
|
|
507
|
+
if (!c.trim()) {
|
|
508
|
+
E.current && h("stop"), E.current = 0;
|
|
512
509
|
return;
|
|
513
510
|
}
|
|
514
511
|
const r = Date.now();
|
|
515
|
-
r -
|
|
516
|
-
}, [
|
|
517
|
-
const [
|
|
518
|
-
queryKey:
|
|
519
|
-
queryFn: () =>
|
|
520
|
-
enabled: !
|
|
521
|
-
}), de =
|
|
522
|
-
queryKey: ["comments-related", t, String(
|
|
523
|
-
queryFn: () =>
|
|
524
|
-
enabled: !
|
|
512
|
+
r - E.current < 2500 || (E.current = r, h("start"));
|
|
513
|
+
}, [c, h]), Z(() => () => h("stop"), [h]);
|
|
514
|
+
const [W, A] = _(null), [F, Q] = _(null), [a, l] = _(""), p = !i || i === "new", f = ["comments", t, String(i)], { data: w, isLoading: O, isError: L } = z({
|
|
515
|
+
queryKey: f,
|
|
516
|
+
queryFn: () => g.request(U("/comments", { collection: t, item: i })).then((r) => r.data),
|
|
517
|
+
enabled: !p
|
|
518
|
+
}), de = X(() => (w ?? []).filter((r) => !r.deleted), [w]), { data: _e } = z({
|
|
519
|
+
queryKey: ["comments-related", t, String(i)],
|
|
520
|
+
queryFn: () => g.request(U("/comments/related", { collection: t, item: i })).then((r) => r.data ?? []).catch(() => []),
|
|
521
|
+
enabled: !p,
|
|
525
522
|
staleTime: 3e4
|
|
526
|
-
}), ce =
|
|
523
|
+
}), ce = _e ?? [], R = X(() => {
|
|
527
524
|
const r = de.map((x) => ({ kind: "comment", at: x.created_at, comment: x })), n = ce.map((x) => ({ kind: "related", at: x.created_at, note: x }));
|
|
528
525
|
return [...r, ...n].sort((x, K) => new Date(K.at).getTime() - new Date(x.at).getTime());
|
|
529
|
-
}, [de, ce]), [
|
|
526
|
+
}, [de, ce]), [G, Ce] = _(() => /* @__PURE__ */ new Set()), [H, Se] = _(""), me = X(() => {
|
|
530
527
|
const r = { people: 0, system: 0, integration: 0 };
|
|
531
528
|
for (const n of R) r[ve(n)]++;
|
|
532
529
|
return r;
|
|
533
|
-
}, [R]), ue =
|
|
534
|
-
const r =
|
|
535
|
-
return R.filter((n) =>
|
|
536
|
-
}, [R,
|
|
530
|
+
}, [R]), ue = p ? (b ?? []).length : me.people, ee = X(() => {
|
|
531
|
+
const r = H.trim().toLowerCase();
|
|
532
|
+
return R.filter((n) => G.has(ve(n)) ? !1 : r ? (n.kind === "comment" ? `${n.comment.text} ${ne(n.comment.user)}` : `${n.note.text} ${n.note.user_name ?? ""} ${n.note.label} ${n.note.context ?? ""} ${n.note.provider ?? ""}`).toLowerCase().includes(r) : !0);
|
|
533
|
+
}, [R, G, H]), $e = (r) => Ce((n) => {
|
|
537
534
|
const x = new Set(n);
|
|
538
535
|
return x.has(r) ? x.delete(r) : x.add(r), x;
|
|
539
|
-
}), Ee =
|
|
540
|
-
mutationFn: (r) =>
|
|
536
|
+
}), Ee = G.size > 0 || H.trim() !== "", te = j({
|
|
537
|
+
mutationFn: (r) => g.request(B("/comments", { collection: t, item: i, text: r })),
|
|
541
538
|
onSuccess: () => {
|
|
542
|
-
v.invalidateQueries({ queryKey:
|
|
539
|
+
v.invalidateQueries({ queryKey: f }), y("");
|
|
543
540
|
},
|
|
544
541
|
onError: () => I.error("Failed to post comment")
|
|
545
|
-
}), pe =
|
|
546
|
-
mutationFn: ({ id: r, text: n }) =>
|
|
542
|
+
}), pe = j({
|
|
543
|
+
mutationFn: ({ id: r, text: n }) => g.request(Ke(`/comments/${r}`, { text: n })),
|
|
547
544
|
onSuccess: () => {
|
|
548
|
-
v.invalidateQueries({ queryKey:
|
|
545
|
+
v.invalidateQueries({ queryKey: f }), A(null), l("");
|
|
549
546
|
},
|
|
550
547
|
onError: () => I.error("Failed to update comment")
|
|
551
|
-
}), ae =
|
|
552
|
-
mutationFn: (r) =>
|
|
553
|
-
onSuccess: () => v.invalidateQueries({ queryKey:
|
|
548
|
+
}), ae = j({
|
|
549
|
+
mutationFn: (r) => g.request(Be(`/comments/${r}`)),
|
|
550
|
+
onSuccess: () => v.invalidateQueries({ queryKey: f }),
|
|
554
551
|
onError: () => I.error("Failed to delete comment")
|
|
555
|
-
}), xe =
|
|
556
|
-
mutationFn: ({ id: r, emoji: n }) =>
|
|
557
|
-
onSuccess: () => v.invalidateQueries({ queryKey:
|
|
552
|
+
}), xe = j({
|
|
553
|
+
mutationFn: ({ id: r, emoji: n }) => g.request(B(`/comments/${r}/reactions`, { emoji: n })),
|
|
554
|
+
onSuccess: () => v.invalidateQueries({ queryKey: f }),
|
|
558
555
|
onError: () => I.error("Failed to react")
|
|
559
|
-
}), [he, be] =
|
|
560
|
-
mutationFn: (r) =>
|
|
556
|
+
}), [he, be] = _(null), qe = j({
|
|
557
|
+
mutationFn: (r) => g.request(
|
|
561
558
|
B("/tasks", {
|
|
562
559
|
collection: t,
|
|
563
|
-
item:
|
|
560
|
+
item: i,
|
|
564
561
|
title: r.text.replace(/<[^>]*>/g, "").replace(/@\[([^\]]+)\]/g, "@$1").slice(0, 200),
|
|
565
|
-
assignee:
|
|
562
|
+
assignee: k
|
|
566
563
|
})
|
|
567
564
|
),
|
|
568
565
|
onSuccess: () => {
|
|
569
|
-
|
|
566
|
+
Ge(v, t, i), I.success("Task created from comment β assigned to you");
|
|
570
567
|
},
|
|
571
568
|
onError: () => I.error("Could not create a task")
|
|
572
569
|
});
|
|
573
570
|
function fe(r) {
|
|
574
|
-
r.preventDefault(),
|
|
571
|
+
r.preventDefault(), c.trim() && (p && m ? (m(c.trim()), y("")) : te.mutate(c.trim()));
|
|
575
572
|
}
|
|
576
573
|
return (
|
|
577
574
|
// Addressable from elsewhere (the summary panel jumps here), which needs
|
|
@@ -580,7 +577,7 @@ function Mt({
|
|
|
580
577
|
"div",
|
|
581
578
|
{
|
|
582
579
|
"data-panel": "notes",
|
|
583
|
-
"data-panel-expanded":
|
|
580
|
+
"data-panel-expanded": q ? "true" : "false",
|
|
584
581
|
className: "overflow-hidden rounded-xl border border-slate-200 bg-white dark:bg-card dark:border-border",
|
|
585
582
|
children: [
|
|
586
583
|
/* @__PURE__ */ s(
|
|
@@ -588,11 +585,11 @@ function Mt({
|
|
|
588
585
|
{
|
|
589
586
|
type: "button",
|
|
590
587
|
"data-panel-toggle": "notes",
|
|
591
|
-
onClick: () =>
|
|
588
|
+
onClick: () => D((r) => !r),
|
|
592
589
|
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]",
|
|
593
590
|
children: [
|
|
594
591
|
/* @__PURE__ */ s("span", { className: "flex w-full items-center gap-2.5", children: [
|
|
595
|
-
/* @__PURE__ */ e(
|
|
592
|
+
/* @__PURE__ */ e(De, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }),
|
|
596
593
|
/* @__PURE__ */ e("span", { className: "text-[13px] font-medium text-slate-800 dark:text-slate-200", children: d || "Comments" }),
|
|
597
594
|
ue > 0 && /* @__PURE__ */ e(
|
|
598
595
|
"span",
|
|
@@ -603,13 +600,13 @@ function Mt({
|
|
|
603
600
|
}
|
|
604
601
|
),
|
|
605
602
|
/* @__PURE__ */ e(
|
|
606
|
-
|
|
603
|
+
Te,
|
|
607
604
|
{
|
|
608
|
-
className: `ml-auto h-3.5 w-3.5 shrink-0 text-slate-400 transition-transform duration-150${
|
|
605
|
+
className: `ml-auto h-3.5 w-3.5 shrink-0 text-slate-400 transition-transform duration-150${q ? " rotate-180" : ""}`
|
|
609
606
|
}
|
|
610
607
|
)
|
|
611
608
|
] }),
|
|
612
|
-
!
|
|
609
|
+
!q && !p && R.length > 0 && (() => {
|
|
613
610
|
const r = R[0], n = r.kind === "comment" ? ne(r.comment.user) : r.note.user_name ?? "System", x = dt(r);
|
|
614
611
|
return x ? /* @__PURE__ */ s("span", { className: "mt-1 w-full truncate pl-6 text-[11.5px] text-slate-400", children: [
|
|
615
612
|
/* @__PURE__ */ s("span", { className: "font-medium text-slate-500 dark:text-slate-400", children: [
|
|
@@ -623,13 +620,13 @@ function Mt({
|
|
|
623
620
|
]
|
|
624
621
|
}
|
|
625
622
|
),
|
|
626
|
-
|
|
623
|
+
q && /* @__PURE__ */ e("div", { className: "border-t border-slate-100 px-5 py-4 dark:border-border/60", children: p ? /* @__PURE__ */ s("div", { className: "space-y-4", children: [
|
|
627
624
|
/* @__PURE__ */ s("form", { onSubmit: fe, className: "space-y-2", children: [
|
|
628
625
|
/* @__PURE__ */ e(
|
|
629
626
|
re,
|
|
630
627
|
{
|
|
631
|
-
value:
|
|
632
|
-
onChange:
|
|
628
|
+
value: c,
|
|
629
|
+
onChange: y,
|
|
633
630
|
placeholder: "Write a commentβ¦",
|
|
634
631
|
rows: 3,
|
|
635
632
|
className: "text-[13px]"
|
|
@@ -637,12 +634,12 @@ function Mt({
|
|
|
637
634
|
),
|
|
638
635
|
/* @__PURE__ */ s("div", { className: "flex items-center justify-between", children: [
|
|
639
636
|
/* @__PURE__ */ e("p", { className: "text-[11px] text-slate-400", children: "Comment will be posted after the record is saved." }),
|
|
640
|
-
/* @__PURE__ */ e(
|
|
637
|
+
/* @__PURE__ */ e(J, { type: "submit", size: "sm", disabled: !c.trim(), children: "Queue" })
|
|
641
638
|
] })
|
|
642
639
|
] }),
|
|
643
|
-
(
|
|
640
|
+
(b ?? []).length > 0 && /* @__PURE__ */ s("div", { className: "space-y-2", children: [
|
|
644
641
|
/* @__PURE__ */ e(ge, {}),
|
|
645
|
-
(
|
|
642
|
+
(b ?? []).map((r, n) => /* @__PURE__ */ s(
|
|
646
643
|
"div",
|
|
647
644
|
{
|
|
648
645
|
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",
|
|
@@ -654,13 +651,13 @@ function Mt({
|
|
|
654
651
|
n
|
|
655
652
|
))
|
|
656
653
|
] })
|
|
657
|
-
] }) : /* @__PURE__ */ s(
|
|
654
|
+
] }) : /* @__PURE__ */ s(V, { children: [
|
|
658
655
|
/* @__PURE__ */ s("form", { onSubmit: fe, className: "space-y-2", children: [
|
|
659
656
|
/* @__PURE__ */ e(
|
|
660
657
|
re,
|
|
661
658
|
{
|
|
662
|
-
value:
|
|
663
|
-
onChange:
|
|
659
|
+
value: c,
|
|
660
|
+
onChange: y,
|
|
664
661
|
placeholder: "Write a commentβ¦",
|
|
665
662
|
rows: 3,
|
|
666
663
|
className: "text-[13px]"
|
|
@@ -673,25 +670,25 @@ function Mt({
|
|
|
673
670
|
"button",
|
|
674
671
|
{
|
|
675
672
|
type: "button",
|
|
676
|
-
disabled: !
|
|
677
|
-
onClick: () => void
|
|
673
|
+
disabled: !c.trim() || $,
|
|
674
|
+
onClick: () => void P(),
|
|
678
675
|
"data-tip": "β¨ Fix grammar & clarity (meaning preserved)",
|
|
679
676
|
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",
|
|
680
|
-
children:
|
|
677
|
+
children: $ ? "β¦" : "β¨ Polish"
|
|
681
678
|
}
|
|
682
679
|
),
|
|
683
|
-
/* @__PURE__ */ e(
|
|
680
|
+
/* @__PURE__ */ e(J, { type: "submit", size: "sm", disabled: !c.trim() || te.isPending, children: te.isPending ? "Postingβ¦" : "Comment" })
|
|
684
681
|
] })
|
|
685
682
|
] })
|
|
686
683
|
] }),
|
|
687
|
-
|
|
684
|
+
o.length > 0 && /* @__PURE__ */ s(
|
|
688
685
|
"p",
|
|
689
686
|
{
|
|
690
687
|
className: "flex items-center gap-1.5 text-[11.5px] italic text-slate-400",
|
|
691
688
|
"data-note-typing": !0,
|
|
692
689
|
children: [
|
|
693
690
|
/* @__PURE__ */ e("span", { className: "h-1.5 w-1.5 animate-pulse rounded-full bg-nvr-cyan" }),
|
|
694
|
-
|
|
691
|
+
We(o, "writing a note"),
|
|
695
692
|
"β¦"
|
|
696
693
|
]
|
|
697
694
|
}
|
|
@@ -699,12 +696,12 @@ function Mt({
|
|
|
699
696
|
/* @__PURE__ */ e(ge, { className: "my-4" }),
|
|
700
697
|
R.length > 0 && /* @__PURE__ */ s("div", { className: "mb-3 flex flex-wrap items-center gap-1.5", "data-notes-filters": !0, children: [
|
|
701
698
|
["people", "system", "integration"].map((r) => {
|
|
702
|
-
const n = !
|
|
699
|
+
const n = !G.has(r), x = me[r];
|
|
703
700
|
return /* @__PURE__ */ s(
|
|
704
701
|
"button",
|
|
705
702
|
{
|
|
706
703
|
type: "button",
|
|
707
|
-
onClick: () =>
|
|
704
|
+
onClick: () => $e(r),
|
|
708
705
|
"aria-pressed": n,
|
|
709
706
|
"data-notes-filter": r,
|
|
710
707
|
disabled: x === 0 && n,
|
|
@@ -721,8 +718,8 @@ function Mt({
|
|
|
721
718
|
/* @__PURE__ */ e(
|
|
722
719
|
"input",
|
|
723
720
|
{
|
|
724
|
-
value:
|
|
725
|
-
onChange: (r) =>
|
|
721
|
+
value: H,
|
|
722
|
+
onChange: (r) => Se(r.target.value),
|
|
726
723
|
placeholder: "Search notesβ¦",
|
|
727
724
|
"aria-label": "Search notes",
|
|
728
725
|
"data-notes-search": !0,
|
|
@@ -735,23 +732,23 @@ function Mt({
|
|
|
735
732
|
R.length
|
|
736
733
|
] })
|
|
737
734
|
] }),
|
|
738
|
-
|
|
735
|
+
O ? /* @__PURE__ */ e("div", { className: "space-y-4", children: ["a", "b"].map((r) => /* @__PURE__ */ s("div", { className: "flex gap-3", children: [
|
|
739
736
|
/* @__PURE__ */ e("div", { className: "h-8 w-8 shrink-0 animate-pulse rounded-full bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }),
|
|
740
737
|
/* @__PURE__ */ s("div", { className: "flex-1 space-y-1.5", children: [
|
|
741
738
|
/* @__PURE__ */ e("div", { className: "h-3 w-32 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }),
|
|
742
739
|
/* @__PURE__ */ e("div", { className: "h-3 w-full animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" })
|
|
743
740
|
] })
|
|
744
|
-
] }, r)) }) :
|
|
741
|
+
] }, r)) }) : L ? /* @__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((r) => {
|
|
745
742
|
if (r.kind === "related")
|
|
746
743
|
return /* @__PURE__ */ e("div", { className: "nvr-section-enter", children: /* @__PURE__ */ e(
|
|
747
744
|
mt,
|
|
748
745
|
{
|
|
749
746
|
note: r.note,
|
|
750
747
|
collection: t,
|
|
751
|
-
item: String(
|
|
748
|
+
item: String(i)
|
|
752
749
|
}
|
|
753
750
|
) }, r.note.id);
|
|
754
|
-
const n = r.comment, x =
|
|
751
|
+
const n = r.comment, x = k === n.user.id, K = W === n.id;
|
|
755
752
|
return /* @__PURE__ */ s("div", { className: "nvr-section-enter group flex gap-3", children: [
|
|
756
753
|
/* @__PURE__ */ e(
|
|
757
754
|
Ye,
|
|
@@ -778,15 +775,15 @@ function Mt({
|
|
|
778
775
|
ot,
|
|
779
776
|
{
|
|
780
777
|
field: n.field,
|
|
781
|
-
label: (
|
|
778
|
+
label: (S == null ? void 0 : S.labelOf(n.field)) ?? Xe(n.field),
|
|
782
779
|
resolved: !!n.resolved_at,
|
|
783
|
-
onJump:
|
|
780
|
+
onJump: S ? () => S.jump(n.field) : void 0
|
|
784
781
|
}
|
|
785
782
|
),
|
|
786
783
|
!K && /* @__PURE__ */ s(
|
|
787
784
|
"div",
|
|
788
785
|
{
|
|
789
|
-
className: `ml-auto flex items-center gap-1 transition-opacity group-hover:opacity-100 focus-within:opacity-100 ${
|
|
786
|
+
className: `ml-auto flex items-center gap-1 transition-opacity group-hover:opacity-100 focus-within:opacity-100 ${F === n.id ? "opacity-100" : "opacity-0"}`,
|
|
790
787
|
children: [
|
|
791
788
|
/* @__PURE__ */ e(
|
|
792
789
|
"button",
|
|
@@ -795,11 +792,11 @@ function Mt({
|
|
|
795
792
|
title: "Make a task from this comment",
|
|
796
793
|
"aria-label": "Make a task from this comment",
|
|
797
794
|
className: "rounded p-1 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted",
|
|
798
|
-
onClick: () =>
|
|
799
|
-
children: /* @__PURE__ */ e(
|
|
795
|
+
onClick: () => qe.mutate(n),
|
|
796
|
+
children: /* @__PURE__ */ e(Pe, { className: "h-3 w-3" })
|
|
800
797
|
}
|
|
801
798
|
),
|
|
802
|
-
x && (
|
|
799
|
+
x && (F === n.id ? /* @__PURE__ */ s(V, { children: [
|
|
803
800
|
/* @__PURE__ */ e(
|
|
804
801
|
"button",
|
|
805
802
|
{
|
|
@@ -809,7 +806,7 @@ function Mt({
|
|
|
809
806
|
"data-comment-delete-confirm": n.id,
|
|
810
807
|
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",
|
|
811
808
|
onClick: () => ae.mutate(n.id, {
|
|
812
|
-
onSettled: () =>
|
|
809
|
+
onSettled: () => Q(null)
|
|
813
810
|
}),
|
|
814
811
|
children: ae.isPending ? "Deletingβ¦" : "Delete comment?"
|
|
815
812
|
}
|
|
@@ -819,11 +816,11 @@ function Mt({
|
|
|
819
816
|
{
|
|
820
817
|
type: "button",
|
|
821
818
|
className: "rounded px-1.5 py-px text-[10.5px] font-medium text-slate-500 transition-colors hover:bg-slate-100 dark:hover:bg-muted",
|
|
822
|
-
onClick: () =>
|
|
819
|
+
onClick: () => Q(null),
|
|
823
820
|
children: "Keep"
|
|
824
821
|
}
|
|
825
822
|
)
|
|
826
|
-
] }) : /* @__PURE__ */ s(
|
|
823
|
+
] }) : /* @__PURE__ */ s(V, { children: [
|
|
827
824
|
/* @__PURE__ */ e(
|
|
828
825
|
"button",
|
|
829
826
|
{
|
|
@@ -832,9 +829,9 @@ function Mt({
|
|
|
832
829
|
"aria-label": "Edit comment",
|
|
833
830
|
className: "rounded p-1 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-700",
|
|
834
831
|
onClick: () => {
|
|
835
|
-
|
|
832
|
+
A(n.id), l(n.text);
|
|
836
833
|
},
|
|
837
|
-
children: /* @__PURE__ */ e(
|
|
834
|
+
children: /* @__PURE__ */ e(Fe, { className: "h-3 w-3" })
|
|
838
835
|
}
|
|
839
836
|
),
|
|
840
837
|
/* @__PURE__ */ e(
|
|
@@ -844,8 +841,8 @@ function Mt({
|
|
|
844
841
|
title: "Delete comment",
|
|
845
842
|
"aria-label": "Delete comment",
|
|
846
843
|
className: "rounded p-1 text-slate-400 transition-colors hover:bg-red-50 hover:text-red-500",
|
|
847
|
-
onClick: () =>
|
|
848
|
-
children: /* @__PURE__ */ e(
|
|
844
|
+
onClick: () => Q(n.id),
|
|
845
|
+
children: /* @__PURE__ */ e(Re, { className: "h-3 w-3" })
|
|
849
846
|
}
|
|
850
847
|
)
|
|
851
848
|
] }))
|
|
@@ -857,37 +854,37 @@ function Mt({
|
|
|
857
854
|
/* @__PURE__ */ e(
|
|
858
855
|
re,
|
|
859
856
|
{
|
|
860
|
-
value:
|
|
861
|
-
onChange:
|
|
857
|
+
value: a,
|
|
858
|
+
onChange: l,
|
|
862
859
|
rows: 3,
|
|
863
860
|
className: "text-[13px]"
|
|
864
861
|
}
|
|
865
862
|
),
|
|
866
863
|
/* @__PURE__ */ s("div", { className: "flex items-center gap-1.5", children: [
|
|
867
864
|
/* @__PURE__ */ s(
|
|
868
|
-
|
|
865
|
+
J,
|
|
869
866
|
{
|
|
870
867
|
size: "sm",
|
|
871
868
|
className: "h-7 gap-1.5",
|
|
872
|
-
disabled: !
|
|
873
|
-
onClick: () => pe.mutate({ id: n.id, text:
|
|
869
|
+
disabled: !a.trim() || pe.isPending,
|
|
870
|
+
onClick: () => pe.mutate({ id: n.id, text: a.trim() }),
|
|
874
871
|
children: [
|
|
875
|
-
/* @__PURE__ */ e(
|
|
872
|
+
/* @__PURE__ */ e(Me, { className: "h-3 w-3" }),
|
|
876
873
|
" Save"
|
|
877
874
|
]
|
|
878
875
|
}
|
|
879
876
|
),
|
|
880
877
|
/* @__PURE__ */ s(
|
|
881
|
-
|
|
878
|
+
J,
|
|
882
879
|
{
|
|
883
880
|
size: "sm",
|
|
884
881
|
variant: "outline",
|
|
885
882
|
className: "h-7 gap-1.5",
|
|
886
883
|
onClick: () => {
|
|
887
|
-
|
|
884
|
+
A(null), l("");
|
|
888
885
|
},
|
|
889
886
|
children: [
|
|
890
|
-
/* @__PURE__ */ e(
|
|
887
|
+
/* @__PURE__ */ e(Ie, { className: "h-3 w-3" }),
|
|
891
888
|
" Cancel"
|
|
892
889
|
]
|
|
893
890
|
}
|
|
@@ -944,7 +941,7 @@ function Mt({
|
|
|
944
941
|
);
|
|
945
942
|
}
|
|
946
943
|
export {
|
|
947
|
-
|
|
944
|
+
It as CommentPanel,
|
|
948
945
|
re as MentionTextarea,
|
|
949
946
|
dt as notePreviewText
|
|
950
947
|
};
|