@openrails/contentkit-ui 0.82.0 → 0.85.1
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/README.md +11 -3
- package/dist/client/beacons.d.ts +8 -5
- package/dist/client/beacons.js +15 -7
- package/dist/client/beacons.js.map +1 -1
- package/dist/client/content/moderation.d.ts +14 -2
- package/dist/client/content/moderation.js +34 -0
- package/dist/client/content/moderation.js.map +1 -1
- package/dist/client/content/types.d.ts +13 -0
- package/dist/client/content/types.js.map +1 -1
- package/dist/client/discovery.d.ts +7 -1
- package/dist/client/discovery.js.map +1 -1
- package/dist/client/generated/error-codes.d.ts +1 -1
- package/dist/client/generated/error-codes.js +8 -0
- package/dist/client/generated/error-codes.js.map +1 -1
- package/dist/client/generated/routes.d.ts +90 -12
- package/dist/client/generated/routes.js +118 -1
- package/dist/client/generated/routes.js.map +1 -1
- package/dist/client/generated/wire.d.ts +74 -0
- package/dist/client/generated/wire.js.map +1 -1
- package/dist/client/index.d.ts +2 -1
- package/dist/client/reader-meta.d.ts +27 -0
- package/dist/client/reader-meta.js +99 -0
- package/dist/client/reader-meta.js.map +1 -0
- package/dist/client/versions.d.ts +1 -1
- package/dist/client/versions.js +7 -2
- package/dist/client/versions.js.map +1 -1
- package/dist/client.js +2 -1
- package/dist/components/admin/reader-manifest.d.ts +18 -0
- package/dist/components/admin/reader-manifest.js +490 -0
- package/dist/components/admin/reader-manifest.js.map +1 -0
- package/dist/components/content/card.js +1 -1
- package/dist/components/content/card.js.map +1 -1
- package/dist/components/content/editors.d.ts +2 -1
- package/dist/components/content/editors.js +291 -256
- package/dist/components/content/editors.js.map +1 -1
- package/dist/components/groups/banner.d.ts +1 -1
- package/dist/components/groups/banner.js +1 -1
- package/dist/components/groups/banner.js.map +1 -1
- package/dist/components/groups/editor.js +3 -3
- package/dist/components/groups/editor.js.map +1 -1
- package/dist/components/groups/parts.d.ts +2 -2
- package/dist/components/groups/parts.js +71 -72
- package/dist/components/groups/parts.js.map +1 -1
- package/dist/components/social/comments.js +59 -45
- package/dist/components/social/comments.js.map +1 -1
- package/dist/components/social/index.d.ts +1 -0
- package/dist/components/social/moderation.d.ts +5 -4
- package/dist/components/social/moderation.js +143 -130
- package/dist/components/social/moderation.js.map +1 -1
- package/dist/components/social/parts.js +22 -14
- package/dist/components/social/parts.js.map +1 -1
- package/dist/components/social/rules.d.ts +23 -0
- package/dist/components/social/rules.js +261 -0
- package/dist/components/social/rules.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +26 -24
- package/dist/locales/admin/de.js +78 -0
- package/dist/locales/admin/de.js.map +1 -1
- package/dist/locales/admin/en.d.ts +78 -0
- package/dist/locales/admin/en.js +78 -0
- package/dist/locales/admin/en.js.map +1 -1
- package/dist/locales/admin/es.js +78 -0
- package/dist/locales/admin/es.js.map +1 -1
- package/dist/locales/admin/ja.js +78 -0
- package/dist/locales/admin/ja.js.map +1 -1
- package/dist/locales/admin/ko.js +78 -0
- package/dist/locales/admin/ko.js.map +1 -1
- package/dist/locales/admin/zh.js +78 -0
- package/dist/locales/admin/zh.js.map +1 -1
- package/dist/locales/de.js +3 -1
- package/dist/locales/de.js.map +1 -1
- package/dist/locales/discovery/de.js +2 -0
- package/dist/locales/discovery/de.js.map +1 -1
- package/dist/locales/discovery/en.d.ts +2 -0
- package/dist/locales/discovery/en.js +2 -0
- package/dist/locales/discovery/en.js.map +1 -1
- package/dist/locales/discovery/es.js +2 -0
- package/dist/locales/discovery/es.js.map +1 -1
- package/dist/locales/discovery/ja.js +2 -0
- package/dist/locales/discovery/ja.js.map +1 -1
- package/dist/locales/discovery/ko.js +2 -0
- package/dist/locales/discovery/ko.js.map +1 -1
- package/dist/locales/discovery/zh.js +2 -0
- package/dist/locales/discovery/zh.js.map +1 -1
- package/dist/locales/en.d.ts +85 -0
- package/dist/locales/en.js +3 -1
- package/dist/locales/en.js.map +1 -1
- package/dist/locales/es.js +3 -1
- package/dist/locales/es.js.map +1 -1
- package/dist/locales/ja.js +3 -1
- package/dist/locales/ja.js.map +1 -1
- package/dist/locales/ko.js +3 -1
- package/dist/locales/ko.js.map +1 -1
- package/dist/locales/social/de.js +3 -0
- package/dist/locales/social/de.js.map +1 -1
- package/dist/locales/social/en.d.ts +3 -0
- package/dist/locales/social/en.js +3 -0
- package/dist/locales/social/en.js.map +1 -1
- package/dist/locales/social/es.js +3 -0
- package/dist/locales/social/es.js.map +1 -1
- package/dist/locales/social/ja.js +3 -0
- package/dist/locales/social/ja.js.map +1 -1
- package/dist/locales/social/ko.js +3 -0
- package/dist/locales/social/ko.js.map +1 -1
- package/dist/locales/social/zh.js +3 -0
- package/dist/locales/social/zh.js.map +1 -1
- package/dist/locales/zh.js +3 -1
- package/dist/locales/zh.js.map +1 -1
- package/dist/react/admin.d.ts +1 -1
- package/dist/react/admin.js +2 -0
- package/dist/react/admin.js.map +1 -1
- package/dist/react/comments.d.ts +29 -1
- package/dist/react/comments.js +30 -2
- package/dist/react/comments.js.map +1 -1
- package/dist/react/context.d.ts +1 -1
- package/dist/react/context.js.map +1 -1
- package/dist/react/discovery.js +1 -1
- package/dist/react/discovery.js.map +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react/resources.js +6 -0
- package/dist/react/resources.js.map +1 -1
- package/dist/react.js +14 -14
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -11,74 +11,79 @@ import { Select as f, SelectContent as p, SelectItem as m, SelectTrigger as h, S
|
|
|
11
11
|
import { Skeleton as _ } from "../../ui/skeleton.js";
|
|
12
12
|
import { ErrorLine as v, RelativeTime as y, UserAvatar as b, UserName as x, contentError as S } from "./parts.js";
|
|
13
13
|
import { AdminRoot as C, NoAccess as w, Pager as T, Rows as E, pageOf as D } from "../admin/shell.js";
|
|
14
|
-
import { CommentBanDialog as
|
|
15
|
-
import { useAdminLocation as
|
|
16
|
-
import { Tabs as
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
14
|
+
import { CommentBanDialog as O, CommentBans as k } from "./bans.js";
|
|
15
|
+
import { useAdminLocation as A, useFlowClient as j, useStaffAccess as M } from "../../react/admin.js";
|
|
16
|
+
import { Tabs as N, TabsContent as P, TabsList as F, TabsTrigger as I } from "../../ui/tabs.js";
|
|
17
|
+
import { BannedWords as L, IPBans as R } from "./rules.js";
|
|
18
|
+
import { useEffect as z, useId as ee, useMemo as te, useState as B } from "react";
|
|
19
|
+
import { Fragment as V, jsx as H, jsxs as U } from "react/jsx-runtime";
|
|
20
|
+
import { cn as W } from "cn";
|
|
20
21
|
//#region src/components/social/moderation.tsx
|
|
21
|
-
var
|
|
22
|
+
var G = [
|
|
22
23
|
"comments",
|
|
23
24
|
"queue",
|
|
24
|
-
"bans"
|
|
25
|
+
"bans",
|
|
26
|
+
"words",
|
|
27
|
+
"ips"
|
|
25
28
|
];
|
|
26
|
-
function
|
|
27
|
-
return
|
|
29
|
+
function K(e = {}) {
|
|
30
|
+
return M(G, e);
|
|
28
31
|
}
|
|
29
|
-
function
|
|
30
|
-
let u =
|
|
32
|
+
function q({ client: e, baseUrl: t, auth: n, guard: r, appearance: i, className: a, language: o, messages: s, sections: c = G, ...l }) {
|
|
33
|
+
let u = j({
|
|
31
34
|
client: e,
|
|
32
35
|
baseUrl: t,
|
|
33
36
|
auth: n
|
|
34
37
|
});
|
|
35
|
-
return /* @__PURE__ */
|
|
38
|
+
return /* @__PURE__ */ H(C, {
|
|
36
39
|
flow: "comment-moderation",
|
|
37
40
|
appearance: i,
|
|
38
41
|
className: a,
|
|
39
42
|
language: o,
|
|
40
43
|
messages: s,
|
|
41
44
|
guard: r,
|
|
42
|
-
children: /* @__PURE__ */
|
|
45
|
+
children: /* @__PURE__ */ H(J, {
|
|
43
46
|
...l,
|
|
44
47
|
client: u,
|
|
45
48
|
sections: c
|
|
46
49
|
})
|
|
47
50
|
});
|
|
48
51
|
}
|
|
49
|
-
function
|
|
50
|
-
let { t: a } = t(), o =
|
|
52
|
+
function J({ sections: e, basePath: n, navigation: r, ...i }) {
|
|
53
|
+
let { t: a } = t(), o = A(n, r), s = K({ client: i.client }), c = e.filter((e) => s.allowed[e]), l = {
|
|
51
54
|
comments: a("moderation.all"),
|
|
52
55
|
queue: a("moderation.queue"),
|
|
53
|
-
bans: a("moderation.bans")
|
|
54
|
-
|
|
56
|
+
bans: a("moderation.bans"),
|
|
57
|
+
words: a("moderationRules.words"),
|
|
58
|
+
ips: a("moderationRules.ips")
|
|
59
|
+
}, u = /* @__PURE__ */ H("h2", {
|
|
55
60
|
className: "text-base font-semibold",
|
|
56
61
|
children: a("moderation.title")
|
|
57
62
|
});
|
|
58
|
-
if (s.loading) return /* @__PURE__ */
|
|
59
|
-
if (!c.length) return /* @__PURE__ */
|
|
63
|
+
if (s.loading) return /* @__PURE__ */ U(V, { children: [u, /* @__PURE__ */ H(E, {})] });
|
|
64
|
+
if (!c.length) return /* @__PURE__ */ U(V, { children: [u, /* @__PURE__ */ H(w, { children: a("moderation.noAccess") })] });
|
|
60
65
|
let d = (t) => t === e[0] ? "" : t, f = o.view || e[0], p = c.includes(f) ? f : c[0], m = d(p);
|
|
61
|
-
return /* @__PURE__ */
|
|
66
|
+
return /* @__PURE__ */ U(V, { children: [u, /* @__PURE__ */ U(N, {
|
|
62
67
|
value: p,
|
|
63
68
|
onValueChange: (e) => o.go(d(e)),
|
|
64
|
-
children: [c.length > 1 && /* @__PURE__ */
|
|
69
|
+
children: [c.length > 1 && /* @__PURE__ */ H(F, { children: c.map((e) => /* @__PURE__ */ H(I, {
|
|
65
70
|
value: e,
|
|
66
71
|
children: l[e]
|
|
67
|
-
}, e)) }), /* @__PURE__ */
|
|
72
|
+
}, e)) }), /* @__PURE__ */ U(P, {
|
|
68
73
|
value: p,
|
|
69
74
|
className: "pt-3",
|
|
70
75
|
children: [
|
|
71
|
-
p === "comments" && /* @__PURE__ */
|
|
76
|
+
p === "comments" && /* @__PURE__ */ H(X, {
|
|
72
77
|
...i,
|
|
73
78
|
loc: o,
|
|
74
79
|
view: m
|
|
75
80
|
}),
|
|
76
|
-
p === "queue" && /* @__PURE__ */
|
|
81
|
+
p === "queue" && /* @__PURE__ */ H(Z, {
|
|
77
82
|
...i,
|
|
78
83
|
loc: o,
|
|
79
84
|
view: m
|
|
80
85
|
}),
|
|
81
|
-
p === "bans" && /* @__PURE__ */
|
|
86
|
+
p === "bans" && /* @__PURE__ */ H(k, {
|
|
82
87
|
scope: "global",
|
|
83
88
|
pageSize: i.pageSize,
|
|
84
89
|
page: D(o.query),
|
|
@@ -86,72 +91,80 @@ function K({ sections: e, basePath: n, navigation: r, ...i }) {
|
|
|
86
91
|
userHref: i.userHref,
|
|
87
92
|
client: i.client,
|
|
88
93
|
onError: i.onError
|
|
94
|
+
}),
|
|
95
|
+
p === "words" && /* @__PURE__ */ H(L, {
|
|
96
|
+
client: i.client,
|
|
97
|
+
onError: i.onError
|
|
98
|
+
}),
|
|
99
|
+
p === "ips" && /* @__PURE__ */ H(R, {
|
|
100
|
+
client: i.client,
|
|
101
|
+
onError: i.onError
|
|
89
102
|
})
|
|
90
103
|
]
|
|
91
104
|
})]
|
|
92
105
|
})] });
|
|
93
106
|
}
|
|
94
|
-
function
|
|
107
|
+
function Y(e) {
|
|
95
108
|
return e.deleted ? "deleted" : e.moderation === "held" ? "held" : e.moderation === "rejected" ? "rejected" : "published";
|
|
96
109
|
}
|
|
97
|
-
function
|
|
98
|
-
let { t: w } = t(), E =
|
|
110
|
+
function X({ loc: c, view: _, client: S, ...C }) {
|
|
111
|
+
let { t: w } = t(), E = ee(), k = te(() => (C.contentKinds ?? []).map((e) => typeof e == "string" ? {
|
|
99
112
|
value: e,
|
|
100
113
|
label: e
|
|
101
|
-
} : e), [C.contentKinds]),
|
|
102
|
-
kind:
|
|
103
|
-
author:
|
|
114
|
+
} : e), [C.contentKinds]), A = c.query.get("kind") ?? "", j = c.query.get("author") ?? "", M = D(c.query), N = C.pageSize ?? 25, P = (e) => c.go(_, {
|
|
115
|
+
kind: A,
|
|
116
|
+
author: j,
|
|
104
117
|
...e
|
|
105
|
-
}), [
|
|
106
|
-
|
|
107
|
-
let { store:
|
|
118
|
+
}), [F, I] = B(j);
|
|
119
|
+
z(() => I(j), [j]);
|
|
120
|
+
let { store: L, scope: R } = o(S), V = s(L, a("admin-comments-page", R, A, j, N), { type: "admin-comments" }, M, N, (e, t) => S.comments.adminList({
|
|
108
121
|
...e,
|
|
109
|
-
contentKind:
|
|
110
|
-
author:
|
|
111
|
-
}, t)), G = n(C.onError), K = r(), [
|
|
112
|
-
|
|
122
|
+
contentKind: A || void 0,
|
|
123
|
+
author: j || void 0
|
|
124
|
+
}, t)), G = n(C.onError), K = r(), [q, J] = B(null), [X, Z] = B(null), Q = (t, n) => {
|
|
125
|
+
J(null), K(n).catch((n) => {
|
|
113
126
|
let r = e(n);
|
|
114
|
-
|
|
127
|
+
J(r), G(r, t);
|
|
115
128
|
});
|
|
116
|
-
}, ne =
|
|
117
|
-
return /* @__PURE__ */
|
|
129
|
+
}, ne = j ? V.items.find((e) => e.user_id === j)?.author?.username ?? j : "";
|
|
130
|
+
return /* @__PURE__ */ U("div", {
|
|
118
131
|
className: "grid gap-3",
|
|
119
132
|
children: [
|
|
120
|
-
/* @__PURE__ */
|
|
133
|
+
/* @__PURE__ */ U("div", {
|
|
121
134
|
className: "flex flex-wrap items-end gap-2",
|
|
122
|
-
children: [
|
|
123
|
-
value:
|
|
124
|
-
onValueChange: (e) =>
|
|
125
|
-
children: [/* @__PURE__ */
|
|
135
|
+
children: [k.length > 0 && /* @__PURE__ */ U(f, {
|
|
136
|
+
value: A,
|
|
137
|
+
onValueChange: (e) => P({ kind: String(e ?? "") }),
|
|
138
|
+
children: [/* @__PURE__ */ H(h, {
|
|
126
139
|
size: "sm",
|
|
127
140
|
"aria-label": w("moderation.kind"),
|
|
128
|
-
children: /* @__PURE__ */
|
|
129
|
-
}), /* @__PURE__ */
|
|
141
|
+
children: /* @__PURE__ */ H(g, { children: (e) => e ? k.find((t) => t.value === e)?.label ?? e : w("moderation.allKinds") })
|
|
142
|
+
}), /* @__PURE__ */ U(p, { children: [/* @__PURE__ */ H(m, {
|
|
130
143
|
value: "",
|
|
131
144
|
children: w("moderation.allKinds")
|
|
132
|
-
}),
|
|
145
|
+
}), k.map((e) => /* @__PURE__ */ H(m, {
|
|
133
146
|
value: e.value,
|
|
134
147
|
children: e.label
|
|
135
148
|
}, e.value))] })]
|
|
136
|
-
}), /* @__PURE__ */
|
|
149
|
+
}), /* @__PURE__ */ U("form", {
|
|
137
150
|
className: "flex min-w-56 flex-1 items-end gap-2",
|
|
138
151
|
onSubmit: (e) => {
|
|
139
|
-
e.preventDefault(),
|
|
152
|
+
e.preventDefault(), P({ author: F.trim() });
|
|
140
153
|
},
|
|
141
|
-
children: [/* @__PURE__ */
|
|
154
|
+
children: [/* @__PURE__ */ U("div", {
|
|
142
155
|
className: "grid flex-1 gap-1",
|
|
143
|
-
children: [/* @__PURE__ */
|
|
156
|
+
children: [/* @__PURE__ */ H(d, {
|
|
144
157
|
htmlFor: `${E}-author`,
|
|
145
158
|
className: "sr-only",
|
|
146
159
|
children: w("moderation.author")
|
|
147
|
-
}), /* @__PURE__ */
|
|
160
|
+
}), /* @__PURE__ */ H(u, {
|
|
148
161
|
id: `${E}-author`,
|
|
149
162
|
className: "h-8",
|
|
150
|
-
value:
|
|
163
|
+
value: F,
|
|
151
164
|
placeholder: w("moderation.authorPlaceholder"),
|
|
152
|
-
onChange: (e) =>
|
|
165
|
+
onChange: (e) => I(e.target.value)
|
|
153
166
|
})]
|
|
154
|
-
}), /* @__PURE__ */
|
|
167
|
+
}), /* @__PURE__ */ H(i, {
|
|
155
168
|
type: "submit",
|
|
156
169
|
size: "sm",
|
|
157
170
|
variant: "outline",
|
|
@@ -159,64 +172,64 @@ function J({ loc: c, view: _, client: S, ...C }) {
|
|
|
159
172
|
})]
|
|
160
173
|
})]
|
|
161
174
|
}),
|
|
162
|
-
|
|
175
|
+
j && /* @__PURE__ */ U("div", {
|
|
163
176
|
className: "flex flex-wrap items-center gap-2",
|
|
164
177
|
"data-ckui": "author-filter",
|
|
165
|
-
children: [/* @__PURE__ */
|
|
178
|
+
children: [/* @__PURE__ */ H("span", { children: w("moderation.byAuthor", { name: ne }) }), /* @__PURE__ */ H(i, {
|
|
166
179
|
size: "sm",
|
|
167
180
|
variant: "ghost",
|
|
168
|
-
onClick: () =>
|
|
181
|
+
onClick: () => P({ author: "" }),
|
|
169
182
|
children: w("moderation.clearAuthor")
|
|
170
183
|
})]
|
|
171
184
|
}),
|
|
172
|
-
/* @__PURE__ */
|
|
173
|
-
/* @__PURE__ */
|
|
174
|
-
loading:
|
|
175
|
-
error:
|
|
185
|
+
/* @__PURE__ */ H(v, { error: q }),
|
|
186
|
+
/* @__PURE__ */ H($, {
|
|
187
|
+
loading: V.loading,
|
|
188
|
+
error: V.error,
|
|
176
189
|
empty: w("moderation.empty"),
|
|
177
|
-
count:
|
|
178
|
-
reload:
|
|
179
|
-
children:
|
|
180
|
-
let t = e.author?.username ?? e.anon_name ?? e.user_id ?? w("comments.anonymous"), n =
|
|
190
|
+
count: V.items.length,
|
|
191
|
+
reload: V.reload,
|
|
192
|
+
children: V.items.map((e) => {
|
|
193
|
+
let t = e.author?.username ?? e.anon_name ?? e.user_id ?? w("comments.anonymous"), n = Y(e), r = C.itemHref?.({
|
|
181
194
|
kind: e.content_kind,
|
|
182
195
|
id: e.content_id
|
|
183
196
|
});
|
|
184
|
-
return /* @__PURE__ */
|
|
197
|
+
return /* @__PURE__ */ U("li", {
|
|
185
198
|
className: "grid gap-2 p-3",
|
|
186
199
|
"data-ckui": "admin-comment",
|
|
187
200
|
"data-status": n,
|
|
188
201
|
children: [
|
|
189
|
-
/* @__PURE__ */
|
|
202
|
+
/* @__PURE__ */ U("div", {
|
|
190
203
|
className: "flex flex-wrap items-center gap-x-2 gap-y-1",
|
|
191
204
|
children: [
|
|
192
|
-
/* @__PURE__ */
|
|
205
|
+
/* @__PURE__ */ H(b, {
|
|
193
206
|
user: e.author,
|
|
194
207
|
name: t,
|
|
195
208
|
size: "sm"
|
|
196
209
|
}),
|
|
197
|
-
/* @__PURE__ */
|
|
210
|
+
/* @__PURE__ */ H(x, {
|
|
198
211
|
user: e.author,
|
|
199
212
|
name: t,
|
|
200
213
|
href: C.userHref
|
|
201
214
|
}),
|
|
202
|
-
/* @__PURE__ */
|
|
215
|
+
/* @__PURE__ */ H(y, {
|
|
203
216
|
at: e.created_at,
|
|
204
217
|
className: "text-xs text-muted-foreground"
|
|
205
218
|
}),
|
|
206
|
-
/* @__PURE__ */
|
|
219
|
+
/* @__PURE__ */ H(l, {
|
|
207
220
|
variant: n === "published" ? "outline" : n === "held" ? "secondary" : "destructive",
|
|
208
221
|
children: w(`moderation.${n}`)
|
|
209
222
|
}),
|
|
210
|
-
e.reply_to_id && /* @__PURE__ */
|
|
223
|
+
e.reply_to_id && /* @__PURE__ */ H(l, {
|
|
211
224
|
variant: "outline",
|
|
212
225
|
children: w("moderation.reply")
|
|
213
226
|
}),
|
|
214
|
-
/* @__PURE__ */
|
|
227
|
+
/* @__PURE__ */ U("span", {
|
|
215
228
|
className: "text-xs text-muted-foreground",
|
|
216
229
|
children: [
|
|
217
230
|
w("moderation.on"),
|
|
218
231
|
" ",
|
|
219
|
-
r ? /* @__PURE__ */
|
|
232
|
+
r ? /* @__PURE__ */ U("a", {
|
|
220
233
|
className: "hover:underline",
|
|
221
234
|
href: r,
|
|
222
235
|
children: [
|
|
@@ -229,38 +242,38 @@ function J({ loc: c, view: _, client: S, ...C }) {
|
|
|
229
242
|
})
|
|
230
243
|
]
|
|
231
244
|
}),
|
|
232
|
-
/* @__PURE__ */
|
|
233
|
-
className:
|
|
245
|
+
/* @__PURE__ */ H("p", {
|
|
246
|
+
className: W("line-clamp-4 break-words whitespace-pre-wrap", e.deleted && "text-muted-foreground line-through"),
|
|
234
247
|
children: e.body
|
|
235
248
|
}),
|
|
236
|
-
e.moderation_reason && /* @__PURE__ */
|
|
249
|
+
e.moderation_reason && /* @__PURE__ */ H("p", {
|
|
237
250
|
className: "text-xs text-muted-foreground",
|
|
238
251
|
children: w("moderation.heldBecause", { reason: e.moderation_reason })
|
|
239
252
|
}),
|
|
240
|
-
/* @__PURE__ */
|
|
253
|
+
/* @__PURE__ */ U("div", {
|
|
241
254
|
className: "flex flex-wrap gap-2",
|
|
242
255
|
children: [
|
|
243
|
-
e.deleted ? /* @__PURE__ */
|
|
256
|
+
e.deleted ? /* @__PURE__ */ H(i, {
|
|
244
257
|
size: "sm",
|
|
245
258
|
variant: "outline",
|
|
246
|
-
onClick: () =>
|
|
259
|
+
onClick: () => Q("comment.restore", () => S.comments.restore(e.id)),
|
|
247
260
|
children: w("moderation.restore")
|
|
248
|
-
}) : /* @__PURE__ */
|
|
261
|
+
}) : /* @__PURE__ */ H(i, {
|
|
249
262
|
size: "sm",
|
|
250
263
|
variant: "destructive",
|
|
251
|
-
onClick: () =>
|
|
264
|
+
onClick: () => Q("comment.delete", () => S.comments.delete(e.id)),
|
|
252
265
|
children: w("moderation.delete")
|
|
253
266
|
}),
|
|
254
|
-
e.user_id && e.user_id !==
|
|
267
|
+
e.user_id && e.user_id !== j && /* @__PURE__ */ H(i, {
|
|
255
268
|
size: "sm",
|
|
256
269
|
variant: "ghost",
|
|
257
|
-
onClick: () =>
|
|
270
|
+
onClick: () => P({ author: e.user_id }),
|
|
258
271
|
children: w("moderation.theirComments")
|
|
259
272
|
}),
|
|
260
|
-
e.user_id && /* @__PURE__ */
|
|
273
|
+
e.user_id && /* @__PURE__ */ H(i, {
|
|
261
274
|
size: "sm",
|
|
262
275
|
variant: "ghost",
|
|
263
|
-
onClick: () =>
|
|
276
|
+
onClick: () => Z({
|
|
264
277
|
id: e.user_id,
|
|
265
278
|
name: t
|
|
266
279
|
}),
|
|
@@ -272,19 +285,19 @@ function J({ loc: c, view: _, client: S, ...C }) {
|
|
|
272
285
|
}, e.id);
|
|
273
286
|
})
|
|
274
287
|
}),
|
|
275
|
-
/* @__PURE__ */
|
|
276
|
-
page:
|
|
277
|
-
hasNext:
|
|
278
|
-
disabled:
|
|
288
|
+
/* @__PURE__ */ H(T, {
|
|
289
|
+
page: M,
|
|
290
|
+
hasNext: V.hasNext,
|
|
291
|
+
disabled: V.loading,
|
|
279
292
|
onPage: (e) => c.go(_, {
|
|
280
|
-
kind:
|
|
281
|
-
author:
|
|
293
|
+
kind: A,
|
|
294
|
+
author: j,
|
|
282
295
|
page: e > 1 ? e : void 0
|
|
283
296
|
})
|
|
284
297
|
}),
|
|
285
|
-
X && /* @__PURE__ */
|
|
298
|
+
X && /* @__PURE__ */ H(O, {
|
|
286
299
|
open: !0,
|
|
287
|
-
onOpenChange: (e) => !e &&
|
|
300
|
+
onOpenChange: (e) => !e && Z(null),
|
|
288
301
|
user: X,
|
|
289
302
|
scopes: ["global"],
|
|
290
303
|
client: S,
|
|
@@ -293,20 +306,20 @@ function J({ loc: c, view: _, client: S, ...C }) {
|
|
|
293
306
|
]
|
|
294
307
|
});
|
|
295
308
|
}
|
|
296
|
-
function
|
|
309
|
+
function Z({ loc: e, view: n, ...r }) {
|
|
297
310
|
let { t: a } = t(), o = e.query.get("kind") === "content" ? "content" : "comment", s = c({
|
|
298
311
|
kind: o,
|
|
299
312
|
pageSize: r.pageSize,
|
|
300
313
|
client: r.client
|
|
301
314
|
});
|
|
302
|
-
return /* @__PURE__ */
|
|
315
|
+
return /* @__PURE__ */ U("div", {
|
|
303
316
|
className: "grid gap-3",
|
|
304
317
|
children: [
|
|
305
|
-
/* @__PURE__ */
|
|
318
|
+
/* @__PURE__ */ H("div", {
|
|
306
319
|
className: "flex gap-2",
|
|
307
320
|
role: "group",
|
|
308
321
|
"aria-label": a("moderation.queue"),
|
|
309
|
-
children: ["comment", "content"].map((t) => /* @__PURE__ */
|
|
322
|
+
children: ["comment", "content"].map((t) => /* @__PURE__ */ H(i, {
|
|
310
323
|
size: "sm",
|
|
311
324
|
variant: o === t ? "default" : "outline",
|
|
312
325
|
"aria-pressed": o === t,
|
|
@@ -314,13 +327,13 @@ function Y({ loc: e, view: n, ...r }) {
|
|
|
314
327
|
children: a(t === "content" ? "moderation.queueContent" : "moderation.queueComments")
|
|
315
328
|
}, t))
|
|
316
329
|
}),
|
|
317
|
-
/* @__PURE__ */
|
|
330
|
+
/* @__PURE__ */ H($, {
|
|
318
331
|
loading: s.loading,
|
|
319
332
|
error: s.error,
|
|
320
333
|
empty: a("moderation.queueEmpty"),
|
|
321
334
|
count: s.items.length,
|
|
322
335
|
reload: s.reload,
|
|
323
|
-
children: s.items.map((e) => /* @__PURE__ */
|
|
336
|
+
children: s.items.map((e) => /* @__PURE__ */ H(Q, {
|
|
324
337
|
item: e,
|
|
325
338
|
itemHref: r.itemHref,
|
|
326
339
|
userHref: r.userHref,
|
|
@@ -329,7 +342,7 @@ function Y({ loc: e, view: n, ...r }) {
|
|
|
329
342
|
onError: r.onError
|
|
330
343
|
}, e.id))
|
|
331
344
|
}),
|
|
332
|
-
s.hasMore && /* @__PURE__ */
|
|
345
|
+
s.hasMore && /* @__PURE__ */ H(i, {
|
|
333
346
|
variant: "outline",
|
|
334
347
|
className: "justify-self-center",
|
|
335
348
|
disabled: s.loadingMore,
|
|
@@ -339,8 +352,8 @@ function Y({ loc: e, view: n, ...r }) {
|
|
|
339
352
|
]
|
|
340
353
|
});
|
|
341
354
|
}
|
|
342
|
-
function
|
|
343
|
-
let o = t(), { t: s } = o, c = n(a.onError), l = r(), { item: d } = a, [f, p] =
|
|
355
|
+
function Q(a) {
|
|
356
|
+
let o = t(), { t: s } = o, c = n(a.onError), l = r(), { item: d } = a, [f, p] = B(!1), [m, h] = B(""), [g, _] = B(!1), [C, w] = B(null), T = d.author?.username ?? d.anon_name ?? d.author_id ?? s("comments.anonymous"), E = a.itemHref?.({
|
|
344
357
|
kind: d.ref.content_kind,
|
|
345
358
|
id: d.ref.content_id
|
|
346
359
|
}), D = async (t) => {
|
|
@@ -354,28 +367,28 @@ function X(a) {
|
|
|
354
367
|
_(!1);
|
|
355
368
|
}
|
|
356
369
|
};
|
|
357
|
-
return /* @__PURE__ */
|
|
370
|
+
return /* @__PURE__ */ U("li", {
|
|
358
371
|
className: "grid gap-2 p-3",
|
|
359
372
|
"data-ckui": "held-item",
|
|
360
373
|
children: [
|
|
361
|
-
/* @__PURE__ */
|
|
374
|
+
/* @__PURE__ */ U("div", {
|
|
362
375
|
className: "flex flex-wrap items-center gap-x-2 gap-y-1",
|
|
363
376
|
children: [
|
|
364
|
-
/* @__PURE__ */
|
|
377
|
+
/* @__PURE__ */ H(b, {
|
|
365
378
|
user: d.author,
|
|
366
379
|
name: T,
|
|
367
380
|
size: "sm"
|
|
368
381
|
}),
|
|
369
|
-
/* @__PURE__ */
|
|
382
|
+
/* @__PURE__ */ H(x, {
|
|
370
383
|
user: d.author,
|
|
371
384
|
name: T,
|
|
372
385
|
href: a.userHref
|
|
373
386
|
}),
|
|
374
|
-
/* @__PURE__ */
|
|
387
|
+
/* @__PURE__ */ H(y, {
|
|
375
388
|
at: d.held_at,
|
|
376
389
|
className: "text-xs text-muted-foreground"
|
|
377
390
|
}),
|
|
378
|
-
E && /* @__PURE__ */
|
|
391
|
+
E && /* @__PURE__ */ U("a", {
|
|
379
392
|
className: "text-xs text-muted-foreground hover:underline",
|
|
380
393
|
href: E,
|
|
381
394
|
children: [
|
|
@@ -388,19 +401,19 @@ function X(a) {
|
|
|
388
401
|
})
|
|
389
402
|
]
|
|
390
403
|
}),
|
|
391
|
-
d.title && /* @__PURE__ */
|
|
404
|
+
d.title && /* @__PURE__ */ H("p", {
|
|
392
405
|
className: "font-medium",
|
|
393
406
|
children: d.title
|
|
394
407
|
}),
|
|
395
|
-
/* @__PURE__ */
|
|
408
|
+
/* @__PURE__ */ H("p", {
|
|
396
409
|
className: "line-clamp-6 break-words whitespace-pre-wrap",
|
|
397
410
|
children: d.body
|
|
398
411
|
}),
|
|
399
|
-
(d.reason || d.error) && /* @__PURE__ */
|
|
412
|
+
(d.reason || d.error) && /* @__PURE__ */ H("p", {
|
|
400
413
|
className: "text-xs text-muted-foreground",
|
|
401
414
|
children: s("moderation.heldBecause", { reason: d.reason || d.error || "" })
|
|
402
415
|
}),
|
|
403
|
-
f && /* @__PURE__ */
|
|
416
|
+
f && /* @__PURE__ */ H(u, {
|
|
404
417
|
value: m,
|
|
405
418
|
maxLength: 500,
|
|
406
419
|
placeholder: s("moderation.rejectReason"),
|
|
@@ -408,23 +421,23 @@ function X(a) {
|
|
|
408
421
|
onChange: (e) => h(e.target.value),
|
|
409
422
|
autoFocus: !0
|
|
410
423
|
}),
|
|
411
|
-
/* @__PURE__ */
|
|
424
|
+
/* @__PURE__ */ U("div", {
|
|
412
425
|
className: "flex flex-wrap gap-2",
|
|
413
426
|
children: [
|
|
414
|
-
/* @__PURE__ */
|
|
427
|
+
/* @__PURE__ */ H(i, {
|
|
415
428
|
size: "sm",
|
|
416
429
|
disabled: g,
|
|
417
430
|
onClick: () => void D("approve"),
|
|
418
431
|
children: s("moderation.approve")
|
|
419
432
|
}),
|
|
420
|
-
/* @__PURE__ */
|
|
433
|
+
/* @__PURE__ */ H(i, {
|
|
421
434
|
size: "sm",
|
|
422
435
|
variant: "destructive",
|
|
423
436
|
disabled: g,
|
|
424
437
|
onClick: () => f ? void D("reject") : p(!0),
|
|
425
438
|
children: s("moderation.reject")
|
|
426
439
|
}),
|
|
427
|
-
f && /* @__PURE__ */
|
|
440
|
+
f && /* @__PURE__ */ H(i, {
|
|
428
441
|
size: "sm",
|
|
429
442
|
variant: "ghost",
|
|
430
443
|
onClick: () => p(!1),
|
|
@@ -432,33 +445,33 @@ function X(a) {
|
|
|
432
445
|
})
|
|
433
446
|
]
|
|
434
447
|
}),
|
|
435
|
-
C && /* @__PURE__ */
|
|
448
|
+
C && /* @__PURE__ */ H(v, { children: C })
|
|
436
449
|
]
|
|
437
450
|
});
|
|
438
451
|
}
|
|
439
|
-
function
|
|
452
|
+
function $(e) {
|
|
440
453
|
let n = t(), { t: r } = n;
|
|
441
|
-
return e.loading && !e.count ? /* @__PURE__ */
|
|
454
|
+
return e.loading && !e.count ? /* @__PURE__ */ U("div", {
|
|
442
455
|
className: "grid gap-3",
|
|
443
456
|
"aria-busy": !0,
|
|
444
|
-
children: [/* @__PURE__ */
|
|
445
|
-
}) : e.error && !e.count ? /* @__PURE__ */
|
|
457
|
+
children: [/* @__PURE__ */ H(_, { className: "h-16 w-full" }), /* @__PURE__ */ H(_, { className: "h-16 w-full" })]
|
|
458
|
+
}) : e.error && !e.count ? /* @__PURE__ */ U("div", {
|
|
446
459
|
className: "grid justify-items-start gap-2",
|
|
447
|
-
children: [/* @__PURE__ */
|
|
460
|
+
children: [/* @__PURE__ */ H(v, { children: e.error.code === "forbidden" || e.error.code === "unauthorized" ? S(n, e.error) : r("moderation.loadFailed") }), /* @__PURE__ */ H(i, {
|
|
448
461
|
size: "sm",
|
|
449
462
|
variant: "outline",
|
|
450
463
|
onClick: e.reload,
|
|
451
464
|
children: r("common.retry")
|
|
452
465
|
})]
|
|
453
|
-
}) : e.count ? /* @__PURE__ */
|
|
466
|
+
}) : e.count ? /* @__PURE__ */ H("ul", {
|
|
454
467
|
className: "grid divide-y divide-border rounded-lg border border-border",
|
|
455
468
|
children: e.children
|
|
456
|
-
}) : /* @__PURE__ */
|
|
469
|
+
}) : /* @__PURE__ */ H("p", {
|
|
457
470
|
className: "text-muted-foreground",
|
|
458
471
|
children: e.empty
|
|
459
472
|
});
|
|
460
473
|
}
|
|
461
474
|
//#endregion
|
|
462
|
-
export {
|
|
475
|
+
export { q as CommentModeration, K as useCommentModerationAccess };
|
|
463
476
|
|
|
464
477
|
//# sourceMappingURL=moderation.js.map
|