@nivaro/react 0.3.16 → 0.3.18
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 +51 -1
- package/dist/index.js +243 -240
- package/dist/shared/components/CollectionBrowserView.js +439 -438
- package/dist/shared/components/ItemEditForm.js +3758 -3708
- package/dist/shared/components/ProfileView.js +38 -23
- package/dist/shared/components/RecordReadView.js +452 -430
- package/dist/shared/components/bulk/BulkActionButtons.js +113 -106
- package/dist/shared/components/chat/ChannelArchive.js +16 -17
- package/dist/shared/components/chat/ChatAnalyticsView.js +2 -2
- package/dist/shared/components/chat/ChatPanel.js +992 -930
- package/dist/shared/components/chat/Composer.js +307 -303
- package/dist/shared/components/chat/chat-core.js +8 -4
- package/dist/shared/components/chat/chat-drafts.js +60 -43
- package/dist/shared/components/item-edit/InlineTableField.js +159 -158
- package/dist/shared/components/item-edit/RecordLiveSync.js +169 -155
- package/dist/shared/components/item-edit/RelationCombobox.js +274 -247
- package/dist/shared/components/item-edit/RowHistorySheet.js +62 -62
- package/dist/shared/components/item-edit/picker-search.js +28 -0
- package/dist/shared/components/panels/RevisionsPanel.js +268 -260
- package/dist/shared/components/pipeline/PipelineEditorView.js +1672 -1568
- package/dist/shared/components/profile/BrowserPushCard.js +135 -89
- package/dist/shared/components/profile/push-failure.js +76 -0
- package/dist/shared/lib/display-prefs.js +90 -0
- package/dist/shared/lib/request-gate.js +140 -127
- package/dist/shared/lib/theme-accents.js +21 -16
- package/package.json +1 -1
|
@@ -1,38 +1,39 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useQuery as
|
|
3
|
-
import { Loader2 as
|
|
1
|
+
import { jsxs as f, Fragment as W, jsx as h } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as X, useQuery as Y } from "@tanstack/react-query";
|
|
3
|
+
import { Loader2 as Q } from "lucide-react";
|
|
4
4
|
import { useState as y } from "react";
|
|
5
|
-
import { toast as
|
|
6
|
-
import { useNivaroClient as
|
|
7
|
-
import { newBulkProgressId as
|
|
8
|
-
import { get as
|
|
9
|
-
import { userErrorMessage as
|
|
10
|
-
import { cn as
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
5
|
+
import { toast as R } from "sonner";
|
|
6
|
+
import { useNivaroClient as U } from "../../context.js";
|
|
7
|
+
import { newBulkProgressId as Z, startBulkProgress as D, endBulkProgress as ee } from "../../lib/bulk-progress.js";
|
|
8
|
+
import { get as te, post as j } from "../../lib/commands.js";
|
|
9
|
+
import { userErrorMessage as re } from "../../lib/safe-error.js";
|
|
10
|
+
import { cn as C } from "../../lib/utils.js";
|
|
11
|
+
import { invalidateRecordQueries as ne } from "../item-edit/RecordLiveSync.js";
|
|
12
|
+
import { Popover as oe, PopoverTrigger as se, PopoverContent as ie } from "../ui/popover.js";
|
|
13
|
+
import { PushBulkButtons as le } from "./PushBulkButtons.js";
|
|
14
|
+
function x(t) {
|
|
14
15
|
return t === !0 || t === 1 || t === "1" || t === "true" ? "true" : t === !1 || t === 0 || t === "0" || t === "false" ? "false" : String(t ?? "");
|
|
15
16
|
}
|
|
16
|
-
const
|
|
17
|
-
function
|
|
17
|
+
const H = (t) => t == null || t === "";
|
|
18
|
+
function Ne(t, i) {
|
|
18
19
|
for (const n of t ?? []) {
|
|
19
20
|
if (!n || typeof n.field != "string") continue;
|
|
20
21
|
if (!(n.field in i)) return null;
|
|
21
|
-
const s = i[n.field], o = n.value, c = () => String(o ?? "").split(",").map((
|
|
22
|
+
const s = i[n.field], o = n.value, c = () => String(o ?? "").split(",").map((k) => x(k.trim()));
|
|
22
23
|
if (!(() => {
|
|
23
24
|
switch (n.op) {
|
|
24
25
|
case "eq":
|
|
25
|
-
return
|
|
26
|
+
return x(s) === x(o);
|
|
26
27
|
case "neq":
|
|
27
|
-
return
|
|
28
|
+
return x(s) !== x(o);
|
|
28
29
|
case "null":
|
|
29
|
-
return
|
|
30
|
+
return H(s);
|
|
30
31
|
case "nnull":
|
|
31
|
-
return !
|
|
32
|
+
return !H(s);
|
|
32
33
|
case "in":
|
|
33
|
-
return c().includes(
|
|
34
|
+
return c().includes(x(s));
|
|
34
35
|
case "nin":
|
|
35
|
-
return !c().includes(
|
|
36
|
+
return !c().includes(x(s));
|
|
36
37
|
default:
|
|
37
38
|
return !1;
|
|
38
39
|
}
|
|
@@ -40,9 +41,9 @@ function we(t, i) {
|
|
|
40
41
|
}
|
|
41
42
|
return !0;
|
|
42
43
|
}
|
|
43
|
-
function
|
|
44
|
-
const i =
|
|
45
|
-
return
|
|
44
|
+
function z(t) {
|
|
45
|
+
const i = U(), n = [...new Set(t)].sort().join(",");
|
|
46
|
+
return Y({
|
|
46
47
|
queryKey: ["bulk-actions-available", n],
|
|
47
48
|
queryFn: async () => {
|
|
48
49
|
const s = {};
|
|
@@ -50,7 +51,7 @@ function G(t) {
|
|
|
50
51
|
n.split(",").map(async (o) => {
|
|
51
52
|
try {
|
|
52
53
|
const c = await i.request(
|
|
53
|
-
|
|
54
|
+
te("/bulk-actions/available", { collection: o })
|
|
54
55
|
);
|
|
55
56
|
s[o] = c.data ?? [];
|
|
56
57
|
} catch {
|
|
@@ -63,127 +64,133 @@ function G(t) {
|
|
|
63
64
|
staleTime: 6e4
|
|
64
65
|
});
|
|
65
66
|
}
|
|
66
|
-
function
|
|
67
|
+
function G(t, i, n) {
|
|
67
68
|
return t ? t.includes(n) || t.includes(`${i}:${n}`) : !0;
|
|
68
69
|
}
|
|
69
|
-
function
|
|
70
|
-
const { data: n } =
|
|
70
|
+
function _e(t, i) {
|
|
71
|
+
const { data: n } = z(t), s = !!n && Object.values(n).some((o) => o.some((c) => c.source === "builtin"));
|
|
71
72
|
return (o) => s ? t.some(
|
|
72
|
-
(c) => ((n == null ? void 0 : n[c]) ?? []).some((g) => g.source === "builtin" && g.key === o) &&
|
|
73
|
+
(c) => ((n == null ? void 0 : n[c]) ?? []).some((g) => g.source === "builtin" && g.key === o) && G(i, c, o)
|
|
73
74
|
) : !0;
|
|
74
75
|
}
|
|
75
|
-
function
|
|
76
|
+
function ae(t, i, n) {
|
|
76
77
|
const s = /* @__PURE__ */ new Map();
|
|
77
78
|
for (const o of i)
|
|
78
79
|
for (const c of (t == null ? void 0 : t[o]) ?? []) {
|
|
79
|
-
if (c.source === "builtin" || !
|
|
80
|
-
const g = `${c.source}:${c.key}`,
|
|
81
|
-
|
|
80
|
+
if (c.source === "builtin" || !G(n, o, c.key)) continue;
|
|
81
|
+
const g = `${c.source}:${c.key}`, k = s.get(g);
|
|
82
|
+
k ? k.collections.push(o) : s.set(g, { ...c, collections: [o] });
|
|
82
83
|
}
|
|
83
84
|
return [...s.values()];
|
|
84
85
|
}
|
|
85
|
-
function
|
|
86
|
+
function ce(t, i, n) {
|
|
86
87
|
const s = [`${i.succeeded} done`];
|
|
87
88
|
return i.skipped && s.push(`${i.skipped} skipped`), i.failed && s.push(`${i.failed} failed`), `${t}: ${s.join(" · ")}${n !== i.succeeded + i.skipped + i.failed ? ` of ${n}` : ""}`;
|
|
88
89
|
}
|
|
89
|
-
function
|
|
90
|
+
function Pe({
|
|
90
91
|
targets: t,
|
|
91
92
|
enabledKeys: i,
|
|
92
93
|
tone: n = "light",
|
|
93
94
|
disabled: s,
|
|
94
95
|
onDone: o
|
|
95
96
|
}) {
|
|
96
|
-
const c =
|
|
97
|
+
const c = U(), g = X(), k = [...new Set(t.map((e) => e.collection))], { data: K } = z(k), O = ae(K, k, i), [L, $] = y(null), [N, _] = y(""), [P, S] = y(null), [A, q] = y({}), [E, M] = y(!1), J = async (e) => {
|
|
97
98
|
const u = `${e.source}:${e.key}`;
|
|
98
99
|
if (e.source === "db") {
|
|
99
|
-
|
|
100
|
+
q((a) => ({ ...a, [u]: "loading" }));
|
|
100
101
|
try {
|
|
101
102
|
const a = { would_change: 0, skipped: 0, failed: 0, outcomes: [] };
|
|
102
|
-
for (const
|
|
103
|
-
const d = t.filter((r) => r.collection ===
|
|
103
|
+
for (const b of e.collections) {
|
|
104
|
+
const d = t.filter((r) => r.collection === b).map((r) => r.id);
|
|
104
105
|
if (d.length === 0) continue;
|
|
105
|
-
const
|
|
106
|
-
|
|
106
|
+
const p = await c.request(
|
|
107
|
+
j("/bulk-actions/preview", { collection: b, key: e.key, ids: d })
|
|
107
108
|
);
|
|
108
|
-
a.would_change +=
|
|
109
|
+
a.would_change += p.data.would_change, a.skipped += p.data.skipped, a.failed += p.data.failed, a.outcomes.push(...p.data.outcomes);
|
|
109
110
|
}
|
|
110
|
-
|
|
111
|
+
q((b) => ({ ...b, [u]: a }));
|
|
111
112
|
} catch {
|
|
112
|
-
|
|
113
|
+
q((a) => ({ ...a, [u]: null }));
|
|
113
114
|
}
|
|
114
115
|
}
|
|
115
|
-
}, T = /* @__PURE__ */
|
|
116
|
-
|
|
116
|
+
}, T = /* @__PURE__ */ h(
|
|
117
|
+
le,
|
|
117
118
|
{
|
|
118
119
|
targets: t,
|
|
119
120
|
enabledKeys: i,
|
|
120
121
|
tone: n,
|
|
121
122
|
disabled: s || !!P,
|
|
122
|
-
onDone: (e) => o == null ? void 0 : o({ ...e, action:
|
|
123
|
+
onDone: (e) => o == null ? void 0 : o({ ...e, action: de })
|
|
123
124
|
}
|
|
124
125
|
);
|
|
125
|
-
if (
|
|
126
|
+
if (O.length === 0) return T;
|
|
126
127
|
const F = async (e) => {
|
|
127
128
|
const u = `${e.source}:${e.key}`;
|
|
128
|
-
|
|
129
|
+
S(u);
|
|
129
130
|
const a = { succeeded: 0, failed: 0, skipped: 0, errors: [] };
|
|
130
|
-
let
|
|
131
|
+
let b = 0;
|
|
131
132
|
try {
|
|
132
133
|
for (const r of e.collections) {
|
|
133
|
-
const
|
|
134
|
-
if (
|
|
135
|
-
|
|
136
|
-
const w = { collection: r, ids:
|
|
137
|
-
l &&
|
|
134
|
+
const m = t.filter((B) => B.collection === r).map((B) => B.id);
|
|
135
|
+
if (m.length === 0) continue;
|
|
136
|
+
b += m.length;
|
|
137
|
+
const w = { collection: r, ids: m, reason: N.trim() || null }, l = e.source === "db" ? Z() : null;
|
|
138
|
+
l && D(l, m);
|
|
138
139
|
const v = (e.source === "db" ? await c.request(
|
|
139
|
-
|
|
140
|
-
).finally(() =>
|
|
141
|
-
|
|
140
|
+
j(`/bulk-actions/run?progress=${l}`, { ...w, key: e.key })
|
|
141
|
+
).finally(() => ee(l)) : await c.request(
|
|
142
|
+
j(`/bulk-actions/${e.key}/execute`, w)
|
|
142
143
|
)).data ?? {};
|
|
143
|
-
a.succeeded += v.succeeded ?? (e.source === "extension" ?
|
|
144
|
+
a.succeeded += v.succeeded ?? (e.source === "extension" ? m.length : 0), a.failed += v.failed ?? 0, a.skipped += v.skipped ?? 0, a.errors.push(...v.errors ?? []);
|
|
144
145
|
}
|
|
145
|
-
|
|
146
|
+
for (const r of e.collections)
|
|
147
|
+
ne(
|
|
148
|
+
g,
|
|
149
|
+
r,
|
|
150
|
+
t.filter((m) => m.collection === r).map((m) => m.id)
|
|
151
|
+
);
|
|
152
|
+
const d = ce(e.label, a, b), p = a.errors.slice(0, 3).map((r) => `#${r.item}: ${r.error}`).join(`
|
|
146
153
|
`);
|
|
147
|
-
a.failed > 0 ?
|
|
154
|
+
a.failed > 0 ? R.warning(d, { description: p || void 0, duration: 8e3 }) : R.success(d, { duration: 4e3 }), o == null || o({ ...a, action: e }), $(null), _("");
|
|
148
155
|
} catch (d) {
|
|
149
|
-
const
|
|
150
|
-
|
|
156
|
+
const p = d.response;
|
|
157
|
+
R.error((p == null ? void 0 : p.error) ?? re(d, `${e.label} failed`));
|
|
151
158
|
} finally {
|
|
152
|
-
|
|
159
|
+
S(null);
|
|
153
160
|
}
|
|
154
|
-
},
|
|
161
|
+
}, V = (e, u) => n === "dark" ? C(
|
|
155
162
|
"h-8 rounded-md px-3 text-[12.5px] font-medium transition-colors disabled:opacity-50",
|
|
156
163
|
e.variant === "danger" ? "border border-red-400/50 text-red-200 hover:bg-red-500/20 dark:border-red-500/40 dark:text-red-400 dark:hover:bg-red-500/10" : "border border-white/20 hover:bg-white/10 dark:border-border dark:hover:bg-muted",
|
|
157
164
|
u && (e.variant === "danger" ? "bg-red-500/20" : "bg-white/10")
|
|
158
|
-
) :
|
|
165
|
+
) : C(
|
|
159
166
|
"rounded-md px-2.5 py-1 text-[12px] font-medium transition-colors disabled:opacity-50",
|
|
160
167
|
e.variant === "danger" ? "text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-500/10" : "text-slate-600 hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-muted",
|
|
161
168
|
u && (e.variant === "danger" ? "bg-red-50 dark:bg-red-500/10" : "bg-slate-100 dark:bg-muted")
|
|
162
169
|
);
|
|
163
|
-
return /* @__PURE__ */
|
|
164
|
-
|
|
165
|
-
const u = `${e.source}:${e.key}`, a = L === u,
|
|
166
|
-
return /* @__PURE__ */
|
|
167
|
-
|
|
170
|
+
return /* @__PURE__ */ f(W, { children: [
|
|
171
|
+
O.map((e) => {
|
|
172
|
+
const u = `${e.source}:${e.key}`, a = L === u, b = P === u, d = t.filter((r) => e.collections.includes(r.collection)).length, p = d > 0 && (!e.require_reason || N.trim().length > 0) && !b;
|
|
173
|
+
return /* @__PURE__ */ f(
|
|
174
|
+
oe,
|
|
168
175
|
{
|
|
169
176
|
open: a,
|
|
170
177
|
onOpenChange: (r) => {
|
|
171
|
-
$(r ? u : null), r ? (M(!1),
|
|
178
|
+
$(r ? u : null), r ? (M(!1), J(e)) : _("");
|
|
172
179
|
},
|
|
173
180
|
children: [
|
|
174
|
-
/* @__PURE__ */
|
|
181
|
+
/* @__PURE__ */ h(se, { asChild: !0, children: /* @__PURE__ */ h(
|
|
175
182
|
"button",
|
|
176
183
|
{
|
|
177
184
|
type: "button",
|
|
178
185
|
disabled: s || !!P,
|
|
179
186
|
"data-bulk-action": e.key,
|
|
180
187
|
title: e.summary,
|
|
181
|
-
className:
|
|
182
|
-
children:
|
|
188
|
+
className: V(e, a),
|
|
189
|
+
children: b ? /* @__PURE__ */ h(Q, { className: "inline h-3.5 w-3.5 animate-spin" }) : e.label
|
|
183
190
|
}
|
|
184
191
|
) }),
|
|
185
|
-
/* @__PURE__ */
|
|
186
|
-
|
|
192
|
+
/* @__PURE__ */ f(
|
|
193
|
+
ie,
|
|
187
194
|
{
|
|
188
195
|
align: "center",
|
|
189
196
|
side: "top",
|
|
@@ -191,44 +198,44 @@ function ve({
|
|
|
191
198
|
className: "w-[320px] p-3",
|
|
192
199
|
"data-bulk-action-popover": e.key,
|
|
193
200
|
children: [
|
|
194
|
-
/* @__PURE__ */
|
|
201
|
+
/* @__PURE__ */ f("p", { className: "text-[13px] font-semibold text-slate-800 dark:text-slate-100", children: [
|
|
195
202
|
e.label,
|
|
196
|
-
/* @__PURE__ */
|
|
203
|
+
/* @__PURE__ */ f("span", { className: "ml-1.5 font-normal text-slate-500 dark:text-slate-400", children: [
|
|
197
204
|
"· ",
|
|
198
205
|
d,
|
|
199
206
|
" record",
|
|
200
207
|
d === 1 ? "" : "s"
|
|
201
208
|
] })
|
|
202
209
|
] }),
|
|
203
|
-
/* @__PURE__ */
|
|
210
|
+
/* @__PURE__ */ h("p", { className: "mt-1 text-[12px] leading-snug text-slate-600 dark:text-slate-400", children: e.confirm_text ?? e.summary }),
|
|
204
211
|
e.source === "db" && (() => {
|
|
205
212
|
const r = A[u];
|
|
206
213
|
if (r === "loading")
|
|
207
|
-
return /* @__PURE__ */
|
|
214
|
+
return /* @__PURE__ */ h("p", { className: "mt-2 text-[11.5px] text-slate-400", "data-bulk-preview": "loading", children: "Checking what would change…" });
|
|
208
215
|
if (!r) return null;
|
|
209
|
-
const
|
|
210
|
-
for (const l of
|
|
216
|
+
const m = r.outcomes.filter((l) => l.outcome !== "change"), w = /* @__PURE__ */ new Map();
|
|
217
|
+
for (const l of m)
|
|
211
218
|
w.set(
|
|
212
219
|
l.reason ?? l.outcome,
|
|
213
220
|
(w.get(l.reason ?? l.outcome) ?? 0) + 1
|
|
214
221
|
);
|
|
215
|
-
return /* @__PURE__ */
|
|
222
|
+
return /* @__PURE__ */ f(
|
|
216
223
|
"div",
|
|
217
224
|
{
|
|
218
225
|
className: "mt-2 rounded-md border border-slate-200 bg-slate-50 px-2 py-1.5 text-[11.5px] dark:border-border dark:bg-muted/40",
|
|
219
226
|
"data-bulk-preview": r.would_change,
|
|
220
227
|
children: [
|
|
221
|
-
/* @__PURE__ */
|
|
228
|
+
/* @__PURE__ */ f("p", { className: "font-medium text-slate-700 dark:text-slate-200", children: [
|
|
222
229
|
r.would_change,
|
|
223
230
|
" of ",
|
|
224
231
|
d,
|
|
225
232
|
" would change",
|
|
226
|
-
|
|
233
|
+
m.length > 0 && /* @__PURE__ */ f("span", { className: "font-normal text-slate-500", children: [
|
|
227
234
|
" · ",
|
|
228
235
|
[...w.entries()].map(([l, I]) => `${I} ${l}`).join(" · ")
|
|
229
236
|
] })
|
|
230
237
|
] }),
|
|
231
|
-
|
|
238
|
+
m.length > 0 && /* @__PURE__ */ f(
|
|
232
239
|
"button",
|
|
233
240
|
{
|
|
234
241
|
type: "button",
|
|
@@ -241,7 +248,7 @@ function ve({
|
|
|
241
248
|
]
|
|
242
249
|
}
|
|
243
250
|
),
|
|
244
|
-
E && /* @__PURE__ */
|
|
251
|
+
E && /* @__PURE__ */ h("ul", { className: "mt-1 max-h-32 space-y-0.5 overflow-auto font-mono text-[10.5px] text-slate-600 dark:text-slate-300", children: m.slice(0, 50).map((l) => /* @__PURE__ */ f("li", { "data-bulk-preview-row": l.item, children: [
|
|
245
252
|
"#",
|
|
246
253
|
l.item,
|
|
247
254
|
" — ",
|
|
@@ -251,19 +258,19 @@ function ve({
|
|
|
251
258
|
}
|
|
252
259
|
);
|
|
253
260
|
})(),
|
|
254
|
-
e.require_reason && /* @__PURE__ */
|
|
255
|
-
/* @__PURE__ */
|
|
261
|
+
e.require_reason && /* @__PURE__ */ f("label", { className: "mt-2.5 block", children: [
|
|
262
|
+
/* @__PURE__ */ f("span", { className: "text-[11px] font-medium text-slate-600 dark:text-slate-400", children: [
|
|
256
263
|
"Reason ",
|
|
257
|
-
/* @__PURE__ */
|
|
264
|
+
/* @__PURE__ */ h("span", { className: "text-destructive", children: "*" })
|
|
258
265
|
] }),
|
|
259
|
-
/* @__PURE__ */
|
|
266
|
+
/* @__PURE__ */ h(
|
|
260
267
|
"textarea",
|
|
261
268
|
{
|
|
262
269
|
autoFocus: !0,
|
|
263
270
|
value: N,
|
|
264
271
|
onChange: (r) => _(r.target.value),
|
|
265
272
|
onKeyDown: (r) => {
|
|
266
|
-
r.key === "Enter" && (r.metaKey || r.ctrlKey) &&
|
|
273
|
+
r.key === "Enter" && (r.metaKey || r.ctrlKey) && p && F(e);
|
|
267
274
|
},
|
|
268
275
|
rows: 2,
|
|
269
276
|
placeholder: "Recorded on every record’s history",
|
|
@@ -271,8 +278,8 @@ function ve({
|
|
|
271
278
|
}
|
|
272
279
|
)
|
|
273
280
|
] }),
|
|
274
|
-
/* @__PURE__ */
|
|
275
|
-
/* @__PURE__ */
|
|
281
|
+
/* @__PURE__ */ f("div", { className: "mt-3 flex items-center justify-end gap-2", children: [
|
|
282
|
+
/* @__PURE__ */ h(
|
|
276
283
|
"button",
|
|
277
284
|
{
|
|
278
285
|
type: "button",
|
|
@@ -281,18 +288,18 @@ function ve({
|
|
|
281
288
|
children: "Close"
|
|
282
289
|
}
|
|
283
290
|
),
|
|
284
|
-
/* @__PURE__ */
|
|
291
|
+
/* @__PURE__ */ h(
|
|
285
292
|
"button",
|
|
286
293
|
{
|
|
287
294
|
type: "button",
|
|
288
295
|
onClick: () => void F(e),
|
|
289
|
-
disabled: !
|
|
296
|
+
disabled: !p,
|
|
290
297
|
"data-bulk-action-run": !0,
|
|
291
|
-
className:
|
|
298
|
+
className: C(
|
|
292
299
|
"h-8 rounded-md px-3 text-[12.5px] font-semibold disabled:opacity-40",
|
|
293
300
|
e.variant === "danger" ? "bg-red-600 text-white hover:bg-red-700" : "bg-nvr-cyan text-[#172940] hover:bg-nvr-cyan-dark"
|
|
294
301
|
),
|
|
295
|
-
children:
|
|
302
|
+
children: b ? /* @__PURE__ */ h(Q, { className: "h-3.5 w-3.5 animate-spin" }) : (() => {
|
|
296
303
|
const r = A[u];
|
|
297
304
|
return r && r !== "loading" && r.would_change !== d ? `${e.label} · ${r.would_change} of ${d}` : `${e.label} ${d}`;
|
|
298
305
|
})()
|
|
@@ -310,7 +317,7 @@ function ve({
|
|
|
310
317
|
T
|
|
311
318
|
] });
|
|
312
319
|
}
|
|
313
|
-
const
|
|
320
|
+
const de = {
|
|
314
321
|
key: "push",
|
|
315
322
|
source: "builtin",
|
|
316
323
|
collection: null,
|
|
@@ -323,10 +330,10 @@ const le = {
|
|
|
323
330
|
summary: "Integration push"
|
|
324
331
|
};
|
|
325
332
|
export {
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
333
|
+
Pe as BulkActionButtons,
|
|
334
|
+
G as bulkActionEnabled,
|
|
335
|
+
Ne as guardMatches,
|
|
336
|
+
ae as mergeBulkActions,
|
|
337
|
+
z as useAvailableBulkActions,
|
|
338
|
+
_e as useBuiltinGate
|
|
332
339
|
};
|
|
@@ -2,7 +2,7 @@ import { jsxs as n, jsx as e } from "react/jsx-runtime";
|
|
|
2
2
|
import { useQueryClient as C, useQuery as f, useMutation as v } from "@tanstack/react-query";
|
|
3
3
|
import { History as W, Archive as H } from "lucide-react";
|
|
4
4
|
import { useState as k } from "react";
|
|
5
|
-
import { toast as
|
|
5
|
+
import { toast as m } from "sonner";
|
|
6
6
|
import { useNivaroClient as g } from "../../context.js";
|
|
7
7
|
import { get as N, put as M, post as q } from "../../lib/commands.js";
|
|
8
8
|
import { cn as w, formatRelative as $ } from "../../lib/utils.js";
|
|
@@ -19,9 +19,9 @@ function Y({
|
|
|
19
19
|
const d = g(), o = C(), r = v({
|
|
20
20
|
mutationFn: (c) => d.request(q(`/chat/channels/${s}/archive-suggestion`, { action: c })),
|
|
21
21
|
onSuccess: (c, l) => {
|
|
22
|
-
|
|
22
|
+
m.success(l === "archive" ? "Channel archived" : "Channel kept open"), o.invalidateQueries({ queryKey: ["nvr-chat-rooms"] }), o.invalidateQueries({ queryKey: ["nvr-chat-directory"] });
|
|
23
23
|
},
|
|
24
|
-
onError: (c) =>
|
|
24
|
+
onError: (c) => m.error(b(c, "Could not save your answer"))
|
|
25
25
|
});
|
|
26
26
|
return /* @__PURE__ */ n(
|
|
27
27
|
"div",
|
|
@@ -33,8 +33,7 @@ function Y({
|
|
|
33
33
|
/* @__PURE__ */ n("p", { className: "min-w-0 flex-1 text-[12px] text-slate-700 dark:text-slate-200", children: [
|
|
34
34
|
"#",
|
|
35
35
|
i,
|
|
36
|
-
" has been quiet. Archive it
|
|
37
|
-
" ",
|
|
36
|
+
" has been quiet. Archive it for everyone (it closes for all members), or keep it open. Suggested ",
|
|
38
37
|
$(t),
|
|
39
38
|
"."
|
|
40
39
|
] }),
|
|
@@ -47,7 +46,7 @@ function Y({
|
|
|
47
46
|
onClick: () => r.mutate("archive"),
|
|
48
47
|
className: "h-7 rounded-md bg-nvr-cyan px-2.5 text-[12px] font-medium text-white disabled:opacity-50",
|
|
49
48
|
"data-chat-archive-accept": !0,
|
|
50
|
-
children: "Archive"
|
|
49
|
+
children: "Archive for everyone"
|
|
51
50
|
}
|
|
52
51
|
),
|
|
53
52
|
/* @__PURE__ */ e(
|
|
@@ -155,7 +154,7 @@ function F({ rows: s, empty: i }) {
|
|
|
155
154
|
const t = g(), d = C(), o = v({
|
|
156
155
|
mutationFn: (r) => t.request(q(`/chat/channels/${r}/archive-suggestion`, { action: "keep" })),
|
|
157
156
|
onSuccess: () => void d.invalidateQueries({ queryKey: ["nvr-chat-archive-overview"] }),
|
|
158
|
-
onError: (r) =>
|
|
157
|
+
onError: (r) => m.error(b(r, "Could not keep that channel open"))
|
|
159
158
|
});
|
|
160
159
|
return s.length === 0 ? /* @__PURE__ */ e("p", { className: "py-2 text-[12px] text-slate-500 dark:text-slate-400", children: i }) : /* @__PURE__ */ e("ul", { className: "divide-y divide-slate-100 dark:divide-border", children: s.map((r) => /* @__PURE__ */ n("li", { className: "flex items-baseline gap-3 py-1.5 text-[12px]", children: [
|
|
161
160
|
/* @__PURE__ */ n("span", { className: "min-w-0 flex-1 truncate font-medium text-slate-800 dark:text-slate-100", children: [
|
|
@@ -187,23 +186,23 @@ function ee() {
|
|
|
187
186
|
}, _ = v({
|
|
188
187
|
mutationFn: (a) => s.request(M("/chat/admin/archive-settings", { idle_days: a })).then((D) => D.data),
|
|
189
188
|
onSuccess: (a) => {
|
|
190
|
-
S(a), o(null),
|
|
189
|
+
S(a), o(null), m.success("Saved");
|
|
191
190
|
},
|
|
192
|
-
onError: (a) =>
|
|
191
|
+
onError: (a) => m.error(b(a, "Could not save"))
|
|
193
192
|
}), y = v({
|
|
194
193
|
mutationFn: () => s.request(
|
|
195
194
|
q("/chat/admin/archive-suggest-now")
|
|
196
195
|
).then((a) => a.data),
|
|
197
196
|
onSuccess: (a) => {
|
|
198
|
-
S(a.overview),
|
|
197
|
+
S(a.overview), m.success(
|
|
199
198
|
a.suggested === 0 ? "No quiet channels found" : `${a.suggested} ${a.suggested === 1 ? "suggestion" : "suggestions"} sent`
|
|
200
199
|
);
|
|
201
200
|
},
|
|
202
|
-
onError: (a) =>
|
|
203
|
-
}), [
|
|
204
|
-
queryKey: ["nvr-chat-membership-history-all",
|
|
201
|
+
onError: (a) => m.error(b(a, "Could not run the check"))
|
|
202
|
+
}), [u, L] = k(30), x = f({
|
|
203
|
+
queryKey: ["nvr-chat-membership-history-all", u],
|
|
205
204
|
queryFn: () => s.request(
|
|
206
|
-
N("/chat/admin/membership-history", { days:
|
|
205
|
+
N("/chat/admin/membership-history", { days: u })
|
|
207
206
|
).then((a) => a.data ?? []),
|
|
208
207
|
staleTime: 3e4
|
|
209
208
|
});
|
|
@@ -298,10 +297,10 @@ function ee() {
|
|
|
298
297
|
{
|
|
299
298
|
type: "button",
|
|
300
299
|
onClick: () => L(a),
|
|
301
|
-
"aria-pressed":
|
|
300
|
+
"aria-pressed": u === a,
|
|
302
301
|
className: w(
|
|
303
302
|
"h-6 rounded-md px-2 text-[11.5px] font-medium",
|
|
304
|
-
|
|
303
|
+
u === a ? "bg-slate-100 text-slate-900 dark:bg-muted dark:text-slate-50" : "text-slate-500 hover:text-slate-800 dark:text-slate-400 dark:hover:text-slate-100"
|
|
305
304
|
),
|
|
306
305
|
children: [
|
|
307
306
|
a,
|
|
@@ -312,7 +311,7 @@ function ee() {
|
|
|
312
311
|
)) }),
|
|
313
312
|
x.isLoading ? /* @__PURE__ */ e(p, { className: "h-16 w-full" }) : x.isError ? /* @__PURE__ */ e("p", { className: "text-[12px] text-slate-500 dark:text-slate-400", children: "Could not load membership changes." }) : (x.data ?? []).length === 0 ? /* @__PURE__ */ n("p", { className: "py-2 text-[12px] text-slate-500 dark:text-slate-400", children: [
|
|
314
313
|
"No joins or leaves in the last ",
|
|
315
|
-
|
|
314
|
+
u,
|
|
316
315
|
" days."
|
|
317
316
|
] }) : /* @__PURE__ */ e("div", { className: "max-h-[420px] overflow-y-auto", children: /* @__PURE__ */ e(T, { events: x.data ?? [], showChannel: !0 }) })
|
|
318
317
|
] })
|
|
@@ -789,7 +789,7 @@ function we({
|
|
|
789
789
|
/* @__PURE__ */ t(
|
|
790
790
|
"a",
|
|
791
791
|
{
|
|
792
|
-
href: `${r}/files/${n.id}?download=1`,
|
|
792
|
+
href: `${r}/files/${n.id}?download=1&chat_message=${a.message.id}`,
|
|
793
793
|
className: "inline-flex items-center gap-1 hover:underline",
|
|
794
794
|
target: "_blank",
|
|
795
795
|
rel: "noreferrer",
|
|
@@ -864,7 +864,7 @@ function we({
|
|
|
864
864
|
/* @__PURE__ */ t(
|
|
865
865
|
"a",
|
|
866
866
|
{
|
|
867
|
-
href: `${r}/files/${x.id}?download=1`,
|
|
867
|
+
href: `${r}/files/${x.id}?download=1&chat_message=${a.message.id}`,
|
|
868
868
|
className: "inline-flex items-center gap-1 hover:underline",
|
|
869
869
|
target: "_blank",
|
|
870
870
|
rel: "noreferrer",
|