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