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