@openrails/contentkit-ui 0.104.0 → 0.105.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/dist/client/generated/wire.d.ts +2 -0
- package/dist/client/generated/wire.js.map +1 -1
- package/dist/components/admin/content-manager.js +344 -344
- package/dist/components/admin/content-manager.js.map +1 -1
- package/dist/components/admin/reader-content-editor.js +179 -175
- package/dist/components/admin/reader-content-editor.js.map +1 -1
- package/dist/components/content/editors.d.ts +4 -0
- package/dist/components/content/editors.js +101 -89
- package/dist/components/content/editors.js.map +1 -1
- package/dist/locales/content/de.js +1 -0
- package/dist/locales/content/de.js.map +1 -1
- package/dist/locales/content/en.d.ts +1 -0
- package/dist/locales/content/en.js +1 -0
- package/dist/locales/content/en.js.map +1 -1
- package/dist/locales/content/es.js +1 -0
- package/dist/locales/content/es.js.map +1 -1
- package/dist/locales/content/ja.js +1 -0
- package/dist/locales/content/ja.js.map +1 -1
- package/dist/locales/content/ko.js +1 -0
- package/dist/locales/content/ko.js.map +1 -1
- package/dist/locales/content/zh.js +1 -0
- package/dist/locales/content/zh.js.map +1 -1
- package/dist/locales/en.d.ts +1 -0
- package/package.json +1 -1
|
@@ -18,84 +18,84 @@ import { imageRefs as _e } from "../../client/contents.js";
|
|
|
18
18
|
import { useAdminLocation as y, useFlowClient as b, useStaffAccess as x } from "../../react/admin.js";
|
|
19
19
|
import { labelOf as S } from "../groups/parts.js";
|
|
20
20
|
import { useContent as ve } from "../../react/contents.js";
|
|
21
|
-
import { ContentSections as C } from "../content/editors.js";
|
|
22
|
-
import { createDraft as
|
|
21
|
+
import { ContentSections as C, allowsIndividualSales as w } from "../content/editors.js";
|
|
22
|
+
import { createDraft as T, uploadTarget as ye } from "./bulk-drafts.js";
|
|
23
23
|
import { ReaderContentEditor as E } from "./reader-content-editor.js";
|
|
24
|
-
import { UploadQueueBody as
|
|
25
|
-
import { useEffect as
|
|
26
|
-
import { Fragment as
|
|
27
|
-
import { Image01Icon as
|
|
28
|
-
import { HugeiconsIcon as
|
|
24
|
+
import { UploadQueueBody as be } from "./upload-queue.js";
|
|
25
|
+
import { useEffect as D, useId as xe, useMemo as O, useRef as k, useState as A } from "react";
|
|
26
|
+
import { Fragment as Se, jsx as j, jsxs as M } from "react/jsx-runtime";
|
|
27
|
+
import { Image01Icon as N } from "@hugeicons/core-free-icons";
|
|
28
|
+
import { HugeiconsIcon as P } from "@hugeicons/react";
|
|
29
29
|
//#region src/components/admin/content-manager.tsx
|
|
30
|
-
function
|
|
30
|
+
function F(e = {}) {
|
|
31
31
|
return x(["contents"], e);
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function Ce(e) {
|
|
34
34
|
return e.moderation === "rejected" ? "rejected" : e.moderation === "held" ? "held" : e.state === "draft" ? "draft" : e.live ? "published" : "scheduled";
|
|
35
35
|
}
|
|
36
|
-
var
|
|
36
|
+
var we = (e) => (e ?? []).map((e) => typeof e == "string" ? {
|
|
37
37
|
value: e,
|
|
38
38
|
label: e
|
|
39
|
-
} : e),
|
|
39
|
+
} : e), Te = {
|
|
40
40
|
published: "default",
|
|
41
41
|
scheduled: "secondary",
|
|
42
42
|
draft: "outline",
|
|
43
43
|
held: "secondary",
|
|
44
44
|
rejected: "destructive"
|
|
45
|
-
},
|
|
45
|
+
}, I = [
|
|
46
46
|
"draft",
|
|
47
47
|
"scheduled",
|
|
48
48
|
"published"
|
|
49
49
|
];
|
|
50
|
-
function
|
|
50
|
+
function L({ client: e, baseUrl: t, auth: n, guard: r, appearance: i, className: a, language: o, messages: s, ...c }) {
|
|
51
51
|
let l = b({
|
|
52
52
|
client: e,
|
|
53
53
|
baseUrl: t,
|
|
54
54
|
auth: n
|
|
55
55
|
});
|
|
56
|
-
return /* @__PURE__ */
|
|
56
|
+
return /* @__PURE__ */ j(g, {
|
|
57
57
|
flow: "content-manager",
|
|
58
58
|
appearance: i,
|
|
59
59
|
className: a,
|
|
60
60
|
language: o,
|
|
61
61
|
messages: s,
|
|
62
62
|
guard: r,
|
|
63
|
-
children: /* @__PURE__ */
|
|
63
|
+
children: /* @__PURE__ */ j(R, {
|
|
64
64
|
...c,
|
|
65
65
|
client: l
|
|
66
66
|
})
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
|
-
function
|
|
70
|
-
let { t: i } = t(), a = y(e, n), o =
|
|
69
|
+
function R({ basePath: e, navigation: n, ...r }) {
|
|
70
|
+
let { t: i } = t(), a = y(e, n), o = F({ client: r.client }), s = k(/* @__PURE__ */ new Map()).current, c = (e, t = !1) => {
|
|
71
71
|
s.set(e.code, e.id), a.go(e.code, void 0, t ? { replace: !0 } : void 0);
|
|
72
|
-
}, l =
|
|
73
|
-
return o.loading ? /* @__PURE__ */
|
|
72
|
+
}, l = z(r.client, r.kind, a.view && a.view !== "new" ? a.view : null, s), u = V(r.client, a.view === "new" ? a.query.get("with") ?? "" : "");
|
|
73
|
+
return o.loading ? /* @__PURE__ */ j(v, {}) : o.allowed.contents ? a.view ? a.view !== "new" && !l.id ? l.error ? /* @__PURE__ */ j(fe, {
|
|
74
74
|
error: l.error,
|
|
75
75
|
message: i("contentManager.loadFailed"),
|
|
76
76
|
retry: l.retry
|
|
77
|
-
}) : l.missing ? /* @__PURE__ */
|
|
77
|
+
}) : l.missing ? /* @__PURE__ */ j(_, { children: i("contentManager.notFound") }) : /* @__PURE__ */ j(v, {}) : /* @__PURE__ */ M(Se, { children: [/* @__PURE__ */ j(d, {
|
|
78
78
|
variant: "ghost",
|
|
79
79
|
size: "sm",
|
|
80
80
|
className: "justify-self-start",
|
|
81
81
|
onClick: () => a.go(""),
|
|
82
82
|
children: i("contentManager.back")
|
|
83
|
-
}), /* @__PURE__ */
|
|
83
|
+
}), /* @__PURE__ */ j(J, {
|
|
84
84
|
management: !0,
|
|
85
85
|
...r,
|
|
86
86
|
id: a.view === "new" ? null : l.id,
|
|
87
87
|
entities: u,
|
|
88
88
|
onCreated: (e) => c(e, !0),
|
|
89
89
|
onDeleted: () => a.go("", void 0, { replace: !0 })
|
|
90
|
-
})] }) : /* @__PURE__ */
|
|
90
|
+
})] }) : /* @__PURE__ */ j(K, {
|
|
91
91
|
...r,
|
|
92
92
|
loc: a,
|
|
93
93
|
open: c
|
|
94
|
-
}) : /* @__PURE__ */
|
|
94
|
+
}) : /* @__PURE__ */ j(_, { children: i("contentManager.noAccess") });
|
|
95
95
|
}
|
|
96
|
-
function
|
|
97
|
-
let [a, o] =
|
|
98
|
-
|
|
96
|
+
function z(t, n, r, i) {
|
|
97
|
+
let [a, o] = A(null), [s, c] = A(0), l = r ? i.get(r) : void 0;
|
|
98
|
+
D(() => {
|
|
99
99
|
if (!r || l) return;
|
|
100
100
|
let a = new AbortController();
|
|
101
101
|
return t.contents.manage({
|
|
@@ -140,17 +140,17 @@ function B(t, n, r, i) {
|
|
|
140
140
|
retry: u
|
|
141
141
|
};
|
|
142
142
|
}
|
|
143
|
-
var
|
|
143
|
+
var B = (e) => ({
|
|
144
144
|
...e,
|
|
145
145
|
count: 0
|
|
146
146
|
});
|
|
147
|
-
function
|
|
148
|
-
let [n, r] =
|
|
149
|
-
return
|
|
147
|
+
function V(e, t) {
|
|
148
|
+
let [n, r] = A(null);
|
|
149
|
+
return D(() => {
|
|
150
150
|
if (!t) return;
|
|
151
151
|
let n = new AbortController(), i = async (t) => {
|
|
152
152
|
let r = await e.codes.resolve(t, { signal: n.signal }), i = await e.entities.getForManagement(r.content_id, void 0, n.signal);
|
|
153
|
-
return i.scope ? [
|
|
153
|
+
return i.scope ? [B(i), i.scope] : [B(i)];
|
|
154
154
|
};
|
|
155
155
|
return Promise.all(t.split(",").filter(Boolean).map((e) => i(e).catch(() => []))).then((e) => {
|
|
156
156
|
n.signal.aborted || r({
|
|
@@ -160,12 +160,12 @@ function H(e, t) {
|
|
|
160
160
|
}), () => n.abort();
|
|
161
161
|
}, [e, t]), t && n?.codes === t ? n.entities : void 0;
|
|
162
162
|
}
|
|
163
|
-
var
|
|
163
|
+
var H = [
|
|
164
164
|
20,
|
|
165
165
|
50,
|
|
166
166
|
100
|
|
167
167
|
], U = 4;
|
|
168
|
-
function
|
|
168
|
+
function Ee(e, t, n) {
|
|
169
169
|
switch (t.level) {
|
|
170
170
|
case "public": return e("contentManager.free");
|
|
171
171
|
case "tier": return (t.tiers ?? []).map((e) => S(n, e)).join(", ") || e("contentManager.premium");
|
|
@@ -174,7 +174,7 @@ function W(e, t, n) {
|
|
|
174
174
|
case "group_ppv": return e("contentManager.membersPpv");
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
|
-
var
|
|
177
|
+
var W = (e) => e ? e.startsWith("tier:") ? {
|
|
178
178
|
access: "tier",
|
|
179
179
|
tier: e.slice(5)
|
|
180
180
|
} : { access: e } : {};
|
|
@@ -192,26 +192,26 @@ async function G(e, t) {
|
|
|
192
192
|
})), n;
|
|
193
193
|
}
|
|
194
194
|
function K({ loc: n, open: l, client: u, kind: h, languages: oe, contentHref: le, labels: g, pageSize: _ = 20, selectable: ge = !0, onError: _e }) {
|
|
195
|
-
let y = t(), { t: b } = y, x =
|
|
195
|
+
let y = t(), { t: b } = y, x = xe(), ve = we(oe)[0]?.value, C = n.query.get("q") ?? "", E = I.find((e) => e === n.query.get("status")) ?? "", O = n.query.get("access") ?? "", N = n.query.get("deleted") === "1", P = me(n.query), F = Number(n.query.get("size")), L = H.find((e) => e === F) ?? _, R = {
|
|
196
196
|
q: C,
|
|
197
197
|
status: E,
|
|
198
|
-
access:
|
|
199
|
-
deleted:
|
|
200
|
-
size:
|
|
201
|
-
},
|
|
202
|
-
...
|
|
198
|
+
access: O || void 0,
|
|
199
|
+
deleted: N ? "1" : void 0,
|
|
200
|
+
size: L === _ ? void 0 : L
|
|
201
|
+
}, z = (e) => n.go("", {
|
|
202
|
+
...R,
|
|
203
203
|
...e
|
|
204
|
-
}),
|
|
205
|
-
|
|
206
|
-
if (
|
|
207
|
-
let e = setTimeout(() =>
|
|
204
|
+
}), B = !!(C || E || O), [V, U] = A(C);
|
|
205
|
+
D(() => U(C), [C]), D(() => {
|
|
206
|
+
if (V.trim() === C) return;
|
|
207
|
+
let e = setTimeout(() => z({ q: V.trim() }), 300);
|
|
208
208
|
return () => clearTimeout(e);
|
|
209
|
-
}, [
|
|
210
|
-
let { kinds: K } = c({ client: u }),
|
|
211
|
-
let { content: t, ref: n } = await
|
|
212
|
-
return
|
|
213
|
-
},
|
|
214
|
-
let t =
|
|
209
|
+
}, [V]);
|
|
210
|
+
let { kinds: K } = c({ client: u }), q = K?.tiers ?? [], J = K?.kinds[h]?.presentation, ke = J === "reader" || J === "player", [Ae, je] = A(!1), Me = k(/* @__PURE__ */ new Map()).current, Ne = r(_e), Pe = async (e) => {
|
|
211
|
+
let { content: t, ref: n } = await T(u, h, ve ?? K?.languages[0] ?? "en", e, b("readerEditor.untitled"));
|
|
212
|
+
return Me.set(t.id, t), n;
|
|
213
|
+
}, Fe = (e) => {
|
|
214
|
+
let t = Me.get(e.id);
|
|
215
215
|
if (t) return l(t);
|
|
216
216
|
u.contents.manage({
|
|
217
217
|
kind: h,
|
|
@@ -219,60 +219,60 @@ function K({ loc: n, open: l, client: u, kind: h, languages: oe, contentHref: le
|
|
|
219
219
|
limit: 1
|
|
220
220
|
}).then(([e]) => {
|
|
221
221
|
e && l(e);
|
|
222
|
-
}, (e) =>
|
|
223
|
-
}, { store:
|
|
222
|
+
}, (e) => Ne(e, "upload"));
|
|
223
|
+
}, { store: Ie, scope: Le } = a(u), Re = N ? "deleted" : E || void 0, ze = {
|
|
224
224
|
type: "contents",
|
|
225
|
-
scope:
|
|
226
|
-
},
|
|
225
|
+
scope: N ? "deleted" : void 0
|
|
226
|
+
}, Be = {
|
|
227
227
|
q: C || void 0,
|
|
228
|
-
state:
|
|
229
|
-
...
|
|
230
|
-
},
|
|
228
|
+
state: Re,
|
|
229
|
+
...W(O)
|
|
230
|
+
}, Y = o(Ie, i("contents-page", Le, h, C, Re, O, ve, L), ze, P, L, (e, t) => u.contents.manage({
|
|
231
231
|
...e,
|
|
232
|
-
...
|
|
232
|
+
...Be,
|
|
233
233
|
kind: h,
|
|
234
234
|
language: ve
|
|
235
|
-
}, t)),
|
|
236
|
-
...
|
|
235
|
+
}, t)), Ve = s(Ie, i("contents-count", Le, h, C, Re, O), ze, (e) => u.contents.manageCount({
|
|
236
|
+
...Be,
|
|
237
237
|
kind: h
|
|
238
|
-
}, e)),
|
|
239
|
-
|
|
238
|
+
}, e)), X = Y.items, He = Ve.data?.total, Ue = Y.loading, Z = de("content.save", _e), { confirm: We, dialog: Ge } = he(), [Ke, qe] = A(/* @__PURE__ */ new Set());
|
|
239
|
+
D(() => qe(/* @__PURE__ */ new Set()), [
|
|
240
240
|
h,
|
|
241
241
|
C,
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
242
|
+
Re,
|
|
243
|
+
O,
|
|
244
|
+
P,
|
|
245
|
+
L
|
|
246
246
|
]);
|
|
247
|
-
let [
|
|
247
|
+
let [Je, Ye] = A(/* @__PURE__ */ new Set()), [Xe, Ze] = A({}), [Q, Qe] = A({ pending: !1 }), $e = q[0], et = (e) => !!$e && (e.access.level === "public" || e.access.level === "tier"), tt = (e, t) => t ? {
|
|
248
248
|
level: "tier",
|
|
249
|
-
tiers: [
|
|
250
|
-
} : { level: "public" },
|
|
251
|
-
|
|
249
|
+
tiers: [$e]
|
|
250
|
+
} : { level: "public" }, nt = async (t, n) => {
|
|
251
|
+
Ye((e) => new Set(e).add(t.id)), Ze(({ [t.id]: e, ...n }) => n);
|
|
252
252
|
try {
|
|
253
|
-
await u.contents.update(t.id, { access:
|
|
253
|
+
await u.contents.update(t.id, { access: tt(t, n) });
|
|
254
254
|
} catch (n) {
|
|
255
255
|
let r = e(n);
|
|
256
|
-
|
|
256
|
+
Ze((e) => ({
|
|
257
257
|
...e,
|
|
258
258
|
[t.id]: r
|
|
259
259
|
}));
|
|
260
260
|
} finally {
|
|
261
|
-
|
|
261
|
+
Ye((e) => {
|
|
262
262
|
let n = new Set(e);
|
|
263
263
|
return n.delete(t.id), n;
|
|
264
264
|
});
|
|
265
265
|
}
|
|
266
|
-
},
|
|
267
|
-
await
|
|
266
|
+
}, rt = async (e) => {
|
|
267
|
+
await We({
|
|
268
268
|
title: b("contentManager.deleteTitle", { title: e.title }),
|
|
269
269
|
description: b("contentManager.deleteBody"),
|
|
270
270
|
confirm: b("contentManager.delete")
|
|
271
|
-
}) && await
|
|
272
|
-
}, $ =
|
|
273
|
-
|
|
271
|
+
}) && await Z.run(() => u.contents.remove(e.id));
|
|
272
|
+
}, $ = X.filter((e) => Ke.has(e.id)), it = async (e, t) => {
|
|
273
|
+
Qe({ pending: !0 });
|
|
274
274
|
let n = await G(e, t), r = e.length - n;
|
|
275
|
-
|
|
275
|
+
qe(/* @__PURE__ */ new Set()), Qe({
|
|
276
276
|
pending: !1,
|
|
277
277
|
summary: n ? b("contentManager.bulkPartial", {
|
|
278
278
|
done: r,
|
|
@@ -280,68 +280,68 @@ function K({ loc: n, open: l, client: u, kind: h, languages: oe, contentHref: le
|
|
|
280
280
|
failed: n
|
|
281
281
|
}) : y.plural("contentManager.bulkDone", r)
|
|
282
282
|
});
|
|
283
|
-
},
|
|
284
|
-
await
|
|
283
|
+
}, at = async () => {
|
|
284
|
+
await We({
|
|
285
285
|
title: y.plural("contentManager.bulkDeleteTitle", $.length),
|
|
286
286
|
description: b("contentManager.bulkDeleteBody"),
|
|
287
287
|
confirm: b("contentManager.delete")
|
|
288
|
-
}) && await
|
|
289
|
-
},
|
|
290
|
-
return /* @__PURE__ */
|
|
288
|
+
}) && await it($, (e) => u.contents.remove(e.id));
|
|
289
|
+
}, ot = X.length > 0 && $.length === X.length;
|
|
290
|
+
return /* @__PURE__ */ M("div", {
|
|
291
291
|
className: "grid gap-4",
|
|
292
292
|
children: [
|
|
293
|
-
/* @__PURE__ */
|
|
293
|
+
/* @__PURE__ */ M("div", {
|
|
294
294
|
className: "flex flex-wrap items-center justify-between gap-2",
|
|
295
|
-
children: [/* @__PURE__ */
|
|
295
|
+
children: [/* @__PURE__ */ j("h2", {
|
|
296
296
|
className: "text-base font-semibold",
|
|
297
297
|
children: b("contentManager.title")
|
|
298
|
-
}), /* @__PURE__ */
|
|
298
|
+
}), /* @__PURE__ */ M("div", {
|
|
299
299
|
className: "flex gap-2",
|
|
300
|
-
children: [
|
|
300
|
+
children: [ke && !N && /* @__PURE__ */ j(d, {
|
|
301
301
|
size: "sm",
|
|
302
302
|
variant: "outline",
|
|
303
|
-
"aria-expanded":
|
|
304
|
-
onClick: () =>
|
|
303
|
+
"aria-expanded": Ae,
|
|
304
|
+
onClick: () => je((e) => !e),
|
|
305
305
|
children: b("contentManager.bulkUpload")
|
|
306
|
-
}), /* @__PURE__ */
|
|
306
|
+
}), /* @__PURE__ */ j(d, {
|
|
307
307
|
size: "sm",
|
|
308
308
|
onClick: () => n.go("new"),
|
|
309
309
|
children: b("contentManager.new")
|
|
310
310
|
})]
|
|
311
311
|
})]
|
|
312
312
|
}),
|
|
313
|
-
|
|
313
|
+
ke && Ae && !N && /* @__PURE__ */ M("section", {
|
|
314
314
|
className: "grid gap-3 rounded-lg border border-border p-3",
|
|
315
315
|
"aria-label": b("contentManager.bulkUpload"),
|
|
316
316
|
"data-ckui": "bulk-upload",
|
|
317
|
-
children: [/* @__PURE__ */
|
|
317
|
+
children: [/* @__PURE__ */ j("p", {
|
|
318
318
|
className: "text-sm text-muted-foreground",
|
|
319
|
-
children: b(
|
|
320
|
-
}), /* @__PURE__ */
|
|
319
|
+
children: b(J === "reader" ? "contentManager.bulkHintArchive" : "contentManager.bulkHintFile")
|
|
320
|
+
}), /* @__PURE__ */ j(be, {
|
|
321
321
|
client: u,
|
|
322
|
-
createItem:
|
|
323
|
-
target: (e, t, n) =>
|
|
324
|
-
accept:
|
|
322
|
+
createItem: Pe,
|
|
323
|
+
target: (e, t, n) => ye(u, e, t, n),
|
|
324
|
+
accept: J === "reader" ? ".zip,application/zip" : "video/*",
|
|
325
325
|
concurrency: 2,
|
|
326
326
|
storageKey: `ckui.bulk.${h}`,
|
|
327
|
-
onOpen:
|
|
327
|
+
onOpen: Fe,
|
|
328
328
|
onError: _e
|
|
329
329
|
})]
|
|
330
330
|
}),
|
|
331
|
-
/* @__PURE__ */
|
|
331
|
+
/* @__PURE__ */ M("div", {
|
|
332
332
|
className: "flex gap-2",
|
|
333
333
|
role: "group",
|
|
334
334
|
"aria-label": b("contentManager.title"),
|
|
335
|
-
children: [/* @__PURE__ */
|
|
335
|
+
children: [/* @__PURE__ */ j(d, {
|
|
336
336
|
size: "sm",
|
|
337
|
-
variant:
|
|
338
|
-
"aria-pressed": !
|
|
337
|
+
variant: N ? "outline" : "default",
|
|
338
|
+
"aria-pressed": !N,
|
|
339
339
|
onClick: () => n.go("", { q: C }),
|
|
340
340
|
children: b("contentManager.items")
|
|
341
|
-
}), /* @__PURE__ */
|
|
341
|
+
}), /* @__PURE__ */ j(d, {
|
|
342
342
|
size: "sm",
|
|
343
|
-
variant:
|
|
344
|
-
"aria-pressed":
|
|
343
|
+
variant: N ? "default" : "outline",
|
|
344
|
+
"aria-pressed": N,
|
|
345
345
|
onClick: () => n.go("", {
|
|
346
346
|
q: C,
|
|
347
347
|
deleted: "1"
|
|
@@ -349,68 +349,68 @@ function K({ loc: n, open: l, client: u, kind: h, languages: oe, contentHref: le
|
|
|
349
349
|
children: b("contentManager.deleted")
|
|
350
350
|
})]
|
|
351
351
|
}),
|
|
352
|
-
/* @__PURE__ */
|
|
352
|
+
/* @__PURE__ */ M("div", {
|
|
353
353
|
className: "flex flex-wrap items-center gap-2",
|
|
354
354
|
children: [
|
|
355
|
-
/* @__PURE__ */
|
|
355
|
+
/* @__PURE__ */ M("form", {
|
|
356
356
|
className: "min-w-48 flex-1",
|
|
357
357
|
role: "search",
|
|
358
358
|
onSubmit: (e) => {
|
|
359
|
-
e.preventDefault(),
|
|
359
|
+
e.preventDefault(), z({ q: V.trim() });
|
|
360
360
|
},
|
|
361
|
-
children: [/* @__PURE__ */
|
|
361
|
+
children: [/* @__PURE__ */ j(p, {
|
|
362
362
|
htmlFor: `${x}-q`,
|
|
363
363
|
className: "sr-only",
|
|
364
364
|
children: b("contentManager.search")
|
|
365
|
-
}), /* @__PURE__ */
|
|
365
|
+
}), /* @__PURE__ */ j(f, {
|
|
366
366
|
id: `${x}-q`,
|
|
367
367
|
className: "h-8",
|
|
368
368
|
type: "search",
|
|
369
|
-
value:
|
|
369
|
+
value: V,
|
|
370
370
|
placeholder: b("contentManager.search"),
|
|
371
371
|
onChange: (e) => U(e.target.value)
|
|
372
372
|
})]
|
|
373
373
|
}),
|
|
374
|
-
!
|
|
374
|
+
!N && /* @__PURE__ */ M(ne, {
|
|
375
375
|
value: E,
|
|
376
|
-
onValueChange: (e) =>
|
|
377
|
-
children: [/* @__PURE__ */
|
|
376
|
+
onValueChange: (e) => z({ status: String(e ?? "") }),
|
|
377
|
+
children: [/* @__PURE__ */ j(ie, {
|
|
378
378
|
size: "sm",
|
|
379
379
|
"aria-label": b("contentManager.status"),
|
|
380
|
-
children: /* @__PURE__ */
|
|
381
|
-
}), /* @__PURE__ */
|
|
380
|
+
children: /* @__PURE__ */ j(ae, { children: (e) => b(e ? `contentManager.${e}` : "contentManager.allStatuses") })
|
|
381
|
+
}), /* @__PURE__ */ M(re, { children: [/* @__PURE__ */ j(m, {
|
|
382
382
|
value: "",
|
|
383
383
|
children: b("contentManager.allStatuses")
|
|
384
|
-
}),
|
|
384
|
+
}), I.map((e) => /* @__PURE__ */ j(m, {
|
|
385
385
|
value: e,
|
|
386
386
|
children: b(`contentManager.${e}`)
|
|
387
387
|
}, e))] })]
|
|
388
388
|
}),
|
|
389
|
-
/* @__PURE__ */
|
|
390
|
-
value:
|
|
391
|
-
onValueChange: (e) =>
|
|
392
|
-
children: [/* @__PURE__ */
|
|
389
|
+
/* @__PURE__ */ M(ne, {
|
|
390
|
+
value: O,
|
|
391
|
+
onValueChange: (e) => z({ access: String(e ?? "") || void 0 }),
|
|
392
|
+
children: [/* @__PURE__ */ j(ie, {
|
|
393
393
|
size: "sm",
|
|
394
394
|
"aria-label": b("contentManager.access"),
|
|
395
|
-
children: /* @__PURE__ */
|
|
396
|
-
}), /* @__PURE__ */
|
|
397
|
-
/* @__PURE__ */
|
|
395
|
+
children: /* @__PURE__ */ j(ae, { children: (e) => e ? e.startsWith("tier:") ? S(g, e.slice(5)) : Ee(b, { level: e }, g) : b("contentManager.anyAccess") })
|
|
396
|
+
}), /* @__PURE__ */ M(re, { children: [
|
|
397
|
+
/* @__PURE__ */ j(m, {
|
|
398
398
|
value: "",
|
|
399
399
|
children: b("contentManager.anyAccess")
|
|
400
400
|
}),
|
|
401
|
-
/* @__PURE__ */
|
|
401
|
+
/* @__PURE__ */ j(m, {
|
|
402
402
|
value: "public",
|
|
403
403
|
children: b("contentManager.free")
|
|
404
404
|
}),
|
|
405
|
-
|
|
405
|
+
q.length > 0 && /* @__PURE__ */ j(m, {
|
|
406
406
|
value: "tier",
|
|
407
407
|
children: b("contentManager.premium")
|
|
408
408
|
}),
|
|
409
|
-
|
|
409
|
+
q.length > 1 && q.map((e) => /* @__PURE__ */ j(m, {
|
|
410
410
|
value: `tier:${e}`,
|
|
411
411
|
children: S(g, e)
|
|
412
412
|
}, e)),
|
|
413
|
-
/* @__PURE__ */
|
|
413
|
+
w(K, h) && /* @__PURE__ */ j(m, {
|
|
414
414
|
value: "ppv",
|
|
415
415
|
children: b("contentManager.ppv")
|
|
416
416
|
})
|
|
@@ -418,150 +418,150 @@ function K({ loc: n, open: l, client: u, kind: h, languages: oe, contentHref: le
|
|
|
418
418
|
})
|
|
419
419
|
]
|
|
420
420
|
}),
|
|
421
|
-
/* @__PURE__ */
|
|
422
|
-
Q.summary && /* @__PURE__ */
|
|
421
|
+
/* @__PURE__ */ j(se, { error: Z.error }),
|
|
422
|
+
Q.summary && /* @__PURE__ */ j("p", {
|
|
423
423
|
role: "status",
|
|
424
424
|
className: "text-sm text-muted-foreground",
|
|
425
425
|
children: Q.summary
|
|
426
426
|
}),
|
|
427
|
-
ge && $.length > 0 && /* @__PURE__ */
|
|
427
|
+
ge && $.length > 0 && /* @__PURE__ */ M("div", {
|
|
428
428
|
className: "flex flex-wrap items-center gap-2 rounded-lg border border-border bg-muted/40 p-2 text-sm",
|
|
429
429
|
"data-ckui": "bulk-bar",
|
|
430
430
|
children: [
|
|
431
|
-
/* @__PURE__ */
|
|
431
|
+
/* @__PURE__ */ j("span", {
|
|
432
432
|
className: "font-medium",
|
|
433
433
|
children: b("contentManager.selected", { count: $.length })
|
|
434
434
|
}),
|
|
435
|
-
|
|
435
|
+
N ? /* @__PURE__ */ j(d, {
|
|
436
436
|
size: "sm",
|
|
437
437
|
variant: "outline",
|
|
438
438
|
disabled: Q.pending,
|
|
439
|
-
onClick: () => void
|
|
439
|
+
onClick: () => void it($, (e) => u.contents.restore(e.id)),
|
|
440
440
|
children: b("moderation.restore")
|
|
441
|
-
}) : /* @__PURE__ */
|
|
442
|
-
|
|
441
|
+
}) : /* @__PURE__ */ M(Se, { children: [
|
|
442
|
+
$e && /* @__PURE__ */ j(d, {
|
|
443
443
|
size: "sm",
|
|
444
444
|
variant: "outline",
|
|
445
445
|
disabled: Q.pending,
|
|
446
|
-
onClick: () => void
|
|
446
|
+
onClick: () => void it($.filter(et), (e) => u.contents.update(e.id, { access: tt(e, !0) })),
|
|
447
447
|
children: b("contentManager.makePremium")
|
|
448
448
|
}),
|
|
449
|
-
|
|
449
|
+
$e && /* @__PURE__ */ j(d, {
|
|
450
450
|
size: "sm",
|
|
451
451
|
variant: "outline",
|
|
452
452
|
disabled: Q.pending,
|
|
453
|
-
onClick: () => void
|
|
453
|
+
onClick: () => void it($.filter(et), (e) => u.contents.update(e.id, { access: tt(e, !1) })),
|
|
454
454
|
children: b("contentManager.makeFree")
|
|
455
455
|
}),
|
|
456
|
-
/* @__PURE__ */
|
|
456
|
+
/* @__PURE__ */ j(d, {
|
|
457
457
|
size: "sm",
|
|
458
458
|
variant: "destructive",
|
|
459
459
|
disabled: Q.pending,
|
|
460
|
-
onClick: () => void
|
|
460
|
+
onClick: () => void at(),
|
|
461
461
|
children: b("contentManager.delete")
|
|
462
462
|
})
|
|
463
463
|
] }),
|
|
464
|
-
/* @__PURE__ */
|
|
464
|
+
/* @__PURE__ */ j(d, {
|
|
465
465
|
size: "sm",
|
|
466
466
|
variant: "ghost",
|
|
467
467
|
disabled: Q.pending,
|
|
468
|
-
onClick: () =>
|
|
468
|
+
onClick: () => qe(/* @__PURE__ */ new Set()),
|
|
469
469
|
children: b("contentManager.clearSelection")
|
|
470
470
|
})
|
|
471
471
|
]
|
|
472
472
|
}),
|
|
473
|
-
|
|
474
|
-
error:
|
|
473
|
+
Ue && !X.length ? /* @__PURE__ */ j(v, {}) : Y.error && !X.length ? /* @__PURE__ */ j(fe, {
|
|
474
|
+
error: Y.error,
|
|
475
475
|
message: b("contentManager.loadFailed"),
|
|
476
|
-
retry:
|
|
477
|
-
}) :
|
|
476
|
+
retry: Y.reload
|
|
477
|
+
}) : X.length ? /* @__PURE__ */ M("ul", {
|
|
478
478
|
className: "grid divide-y divide-border rounded-lg border border-border",
|
|
479
|
-
"aria-busy":
|
|
480
|
-
children: [ge && /* @__PURE__ */
|
|
479
|
+
"aria-busy": Ue,
|
|
480
|
+
children: [ge && /* @__PURE__ */ M("li", {
|
|
481
481
|
className: "flex items-center gap-3 px-3 py-2 text-xs text-muted-foreground",
|
|
482
|
-
children: [/* @__PURE__ */
|
|
482
|
+
children: [/* @__PURE__ */ j("input", {
|
|
483
483
|
type: "checkbox",
|
|
484
484
|
className: "size-4 shrink-0 accent-primary",
|
|
485
|
-
checked:
|
|
485
|
+
checked: ot,
|
|
486
486
|
"aria-label": b("contentManager.selectPage"),
|
|
487
|
-
onChange: (e) =>
|
|
488
|
-
}), /* @__PURE__ */
|
|
489
|
-
}),
|
|
490
|
-
let t =
|
|
491
|
-
return /* @__PURE__ */
|
|
487
|
+
onChange: (e) => qe(e.target.checked ? new Set(X.map((e) => e.id)) : /* @__PURE__ */ new Set())
|
|
488
|
+
}), /* @__PURE__ */ j("span", { children: b("contentManager.selectPage") })]
|
|
489
|
+
}), X.map((e) => {
|
|
490
|
+
let t = Ce(e), n = t === "published" ? le?.(e) : void 0, r = Je.has(e.id), i = e.access.level === "tier";
|
|
491
|
+
return /* @__PURE__ */ M("li", {
|
|
492
492
|
className: "flex flex-wrap items-start gap-3 p-3",
|
|
493
493
|
"data-ckui": "content-row",
|
|
494
|
-
"data-status":
|
|
494
|
+
"data-status": N ? "deleted" : t,
|
|
495
495
|
children: [
|
|
496
|
-
ge && /* @__PURE__ */
|
|
496
|
+
ge && /* @__PURE__ */ j("input", {
|
|
497
497
|
type: "checkbox",
|
|
498
498
|
className: "mt-1 size-4 shrink-0 accent-primary",
|
|
499
|
-
checked:
|
|
499
|
+
checked: Ke.has(e.id),
|
|
500
500
|
"aria-label": b("contentManager.select", { title: e.title }),
|
|
501
|
-
onChange: (t) =>
|
|
501
|
+
onChange: (t) => qe((n) => {
|
|
502
502
|
let r = new Set(n);
|
|
503
503
|
return t.target.checked ? r.add(e.id) : r.delete(e.id), r;
|
|
504
504
|
})
|
|
505
505
|
}),
|
|
506
|
-
/* @__PURE__ */
|
|
507
|
-
/* @__PURE__ */
|
|
506
|
+
/* @__PURE__ */ j(De, { url: e.cover?.url }),
|
|
507
|
+
/* @__PURE__ */ M("div", {
|
|
508
508
|
className: "grid min-w-0 flex-1 gap-1",
|
|
509
509
|
children: [
|
|
510
|
-
|
|
510
|
+
N ? /* @__PURE__ */ j("span", {
|
|
511
511
|
className: "font-medium break-words line-through",
|
|
512
512
|
children: e.title
|
|
513
|
-
}) : /* @__PURE__ */
|
|
513
|
+
}) : /* @__PURE__ */ j("button", {
|
|
514
514
|
type: "button",
|
|
515
515
|
className: "text-left font-medium break-words hover:underline",
|
|
516
516
|
onClick: () => l(e),
|
|
517
517
|
children: e.title
|
|
518
518
|
}),
|
|
519
|
-
/* @__PURE__ */
|
|
519
|
+
/* @__PURE__ */ M("div", {
|
|
520
520
|
className: "flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground",
|
|
521
521
|
children: [
|
|
522
|
-
!
|
|
523
|
-
variant:
|
|
522
|
+
!N && /* @__PURE__ */ j(te, {
|
|
523
|
+
variant: Te[t],
|
|
524
524
|
children: b(`contentManager.${t}`)
|
|
525
525
|
}),
|
|
526
|
-
/* @__PURE__ */
|
|
526
|
+
/* @__PURE__ */ j(te, {
|
|
527
527
|
variant: i ? "secondary" : "outline",
|
|
528
528
|
"data-ckui": "access-badge",
|
|
529
|
-
children:
|
|
529
|
+
children: Ee(b, e.access, g)
|
|
530
530
|
}),
|
|
531
|
-
/* @__PURE__ */
|
|
531
|
+
/* @__PURE__ */ j("span", {
|
|
532
532
|
className: "font-mono",
|
|
533
533
|
children: e.code
|
|
534
534
|
}),
|
|
535
|
-
/* @__PURE__ */
|
|
536
|
-
e.published_at && t === "published" ? /* @__PURE__ */
|
|
535
|
+
/* @__PURE__ */ j("span", { children: e.language }),
|
|
536
|
+
e.published_at && t === "published" ? /* @__PURE__ */ j("time", {
|
|
537
537
|
dateTime: e.published_at,
|
|
538
538
|
title: ue(y, e.published_at),
|
|
539
539
|
children: b("contentManager.liveOn", { date: ue(y, e.published_at, !1) })
|
|
540
|
-
}) : /* @__PURE__ */
|
|
541
|
-
t === "scheduled" && e.publish_at && /* @__PURE__ */
|
|
540
|
+
}) : /* @__PURE__ */ j(ce, { at: N && e.deleted_at ? e.deleted_at : e.updated_at }),
|
|
541
|
+
t === "scheduled" && e.publish_at && /* @__PURE__ */ j("span", { children: b("pollManager.goesLive", { date: ue(y, e.publish_at) }) })
|
|
542
542
|
]
|
|
543
543
|
}),
|
|
544
|
-
/* @__PURE__ */
|
|
544
|
+
/* @__PURE__ */ j(se, { error: Xe[e.id] ?? null })
|
|
545
545
|
]
|
|
546
546
|
}),
|
|
547
|
-
/* @__PURE__ */
|
|
547
|
+
/* @__PURE__ */ j("div", {
|
|
548
548
|
className: "flex flex-wrap items-center gap-2",
|
|
549
|
-
children:
|
|
549
|
+
children: N ? /* @__PURE__ */ j(d, {
|
|
550
550
|
size: "sm",
|
|
551
551
|
variant: "outline",
|
|
552
|
-
disabled:
|
|
553
|
-
onClick: () => void
|
|
552
|
+
disabled: Z.pending,
|
|
553
|
+
onClick: () => void Z.run(() => u.contents.restore(e.id)),
|
|
554
554
|
children: b("moderation.restore")
|
|
555
|
-
}) : /* @__PURE__ */
|
|
556
|
-
|
|
555
|
+
}) : /* @__PURE__ */ M(Se, { children: [
|
|
556
|
+
et(e) && /* @__PURE__ */ M(d, {
|
|
557
557
|
size: "sm",
|
|
558
558
|
variant: "outline",
|
|
559
559
|
disabled: r,
|
|
560
560
|
"aria-busy": r,
|
|
561
|
-
onClick: () => void
|
|
562
|
-
children: [r && /* @__PURE__ */
|
|
561
|
+
onClick: () => void nt(e, !i),
|
|
562
|
+
children: [r && /* @__PURE__ */ j(Oe, {}), b(i ? "contentManager.makeFree" : "contentManager.makePremium")]
|
|
563
563
|
}),
|
|
564
|
-
n && /* @__PURE__ */
|
|
564
|
+
n && /* @__PURE__ */ j("a", {
|
|
565
565
|
className: ee({
|
|
566
566
|
size: "sm",
|
|
567
567
|
variant: "ghost"
|
|
@@ -569,17 +569,17 @@ function K({ loc: n, open: l, client: u, kind: h, languages: oe, contentHref: le
|
|
|
569
569
|
href: n,
|
|
570
570
|
children: b("contentManager.view")
|
|
571
571
|
}),
|
|
572
|
-
/* @__PURE__ */
|
|
572
|
+
/* @__PURE__ */ j(d, {
|
|
573
573
|
size: "sm",
|
|
574
574
|
variant: "outline",
|
|
575
575
|
onClick: () => l(e),
|
|
576
576
|
children: b("comments.edit")
|
|
577
577
|
}),
|
|
578
|
-
/* @__PURE__ */
|
|
578
|
+
/* @__PURE__ */ j(d, {
|
|
579
579
|
size: "sm",
|
|
580
580
|
variant: "destructive",
|
|
581
|
-
disabled:
|
|
582
|
-
onClick: () => void
|
|
581
|
+
disabled: Z.pending,
|
|
582
|
+
onClick: () => void rt(e),
|
|
583
583
|
children: b("comments.delete")
|
|
584
584
|
})
|
|
585
585
|
] })
|
|
@@ -587,74 +587,74 @@ function K({ loc: n, open: l, client: u, kind: h, languages: oe, contentHref: le
|
|
|
587
587
|
]
|
|
588
588
|
}, e.id);
|
|
589
589
|
})]
|
|
590
|
-
}) : /* @__PURE__ */
|
|
590
|
+
}) : /* @__PURE__ */ M("div", {
|
|
591
591
|
className: "grid justify-items-start gap-2",
|
|
592
|
-
children: [/* @__PURE__ */
|
|
592
|
+
children: [/* @__PURE__ */ j("p", {
|
|
593
593
|
className: "text-muted-foreground",
|
|
594
|
-
children: b(
|
|
595
|
-
}),
|
|
594
|
+
children: b(B ? "contentManager.noMatches" : N ? "contentManager.noDeleted" : "contentManager.emptyAll")
|
|
595
|
+
}), B ? /* @__PURE__ */ j(d, {
|
|
596
596
|
size: "sm",
|
|
597
597
|
variant: "outline",
|
|
598
|
-
onClick: () => n.go("", { deleted:
|
|
598
|
+
onClick: () => n.go("", { deleted: N ? "1" : void 0 }),
|
|
599
599
|
children: b("contentManager.clearFilters")
|
|
600
|
-
}) : !
|
|
600
|
+
}) : !N && /* @__PURE__ */ j(d, {
|
|
601
601
|
size: "sm",
|
|
602
602
|
onClick: () => n.go("new"),
|
|
603
603
|
children: b("contentManager.new")
|
|
604
604
|
})]
|
|
605
605
|
}),
|
|
606
|
-
/* @__PURE__ */
|
|
607
|
-
page:
|
|
608
|
-
hasNext:
|
|
609
|
-
disabled:
|
|
610
|
-
total:
|
|
611
|
-
truncated:
|
|
612
|
-
pageSize:
|
|
613
|
-
pageSizes:
|
|
606
|
+
/* @__PURE__ */ j(pe, {
|
|
607
|
+
page: P,
|
|
608
|
+
hasNext: Y.hasNext,
|
|
609
|
+
disabled: Ue,
|
|
610
|
+
total: He,
|
|
611
|
+
truncated: Ve.data?.truncated,
|
|
612
|
+
pageSize: L,
|
|
613
|
+
pageSizes: H,
|
|
614
614
|
onPageSize: (e) => n.go("", {
|
|
615
|
-
...
|
|
615
|
+
...R,
|
|
616
616
|
size: e === _ ? void 0 : e,
|
|
617
617
|
page: void 0
|
|
618
618
|
}),
|
|
619
619
|
onPage: (e) => n.go("", {
|
|
620
|
-
...
|
|
620
|
+
...R,
|
|
621
621
|
page: e > 1 ? e : void 0
|
|
622
622
|
})
|
|
623
623
|
}),
|
|
624
|
-
|
|
624
|
+
Ge
|
|
625
625
|
]
|
|
626
626
|
});
|
|
627
627
|
}
|
|
628
|
-
function
|
|
629
|
-
return e ? /* @__PURE__ */
|
|
628
|
+
function De({ url: e }) {
|
|
629
|
+
return e ? /* @__PURE__ */ j("img", {
|
|
630
630
|
src: e,
|
|
631
631
|
alt: "",
|
|
632
632
|
loading: "lazy",
|
|
633
633
|
className: "aspect-[7/10] w-12 shrink-0 rounded-sm bg-muted object-cover"
|
|
634
|
-
}) : /* @__PURE__ */
|
|
634
|
+
}) : /* @__PURE__ */ j("span", {
|
|
635
635
|
"aria-hidden": !0,
|
|
636
636
|
className: "grid aspect-[7/10] w-12 shrink-0 place-items-center rounded-sm bg-muted text-muted-foreground",
|
|
637
|
-
children: /* @__PURE__ */
|
|
638
|
-
icon:
|
|
637
|
+
children: /* @__PURE__ */ j(P, {
|
|
638
|
+
icon: N,
|
|
639
639
|
strokeWidth: 1.5,
|
|
640
640
|
className: "size-5"
|
|
641
641
|
})
|
|
642
642
|
});
|
|
643
643
|
}
|
|
644
|
-
function
|
|
645
|
-
return /* @__PURE__ */
|
|
644
|
+
function Oe() {
|
|
645
|
+
return /* @__PURE__ */ j("span", {
|
|
646
646
|
"aria-hidden": !0,
|
|
647
647
|
className: "size-3 animate-spin rounded-full border-2 border-current border-t-transparent"
|
|
648
648
|
});
|
|
649
649
|
}
|
|
650
|
-
var
|
|
650
|
+
var q = {
|
|
651
651
|
title: "",
|
|
652
652
|
description: "",
|
|
653
653
|
publishAt: "",
|
|
654
654
|
body: ""
|
|
655
655
|
};
|
|
656
|
-
function
|
|
657
|
-
let { client: n, scope: r } = a(e.client), i =
|
|
656
|
+
function J(e) {
|
|
657
|
+
let { client: n, scope: r } = a(e.client), i = k(null), [o, s] = A({
|
|
658
658
|
id: e.id,
|
|
659
659
|
kind: e.kind,
|
|
660
660
|
client: n,
|
|
@@ -672,11 +672,11 @@ function Y(e) {
|
|
|
672
672
|
}, s(l);
|
|
673
673
|
}
|
|
674
674
|
let { kinds: u, error: d, reload: ee } = c({ client: n }), { t: te } = t();
|
|
675
|
-
if (!u) return d ? /* @__PURE__ */
|
|
675
|
+
if (!u) return d ? /* @__PURE__ */ j(fe, {
|
|
676
676
|
error: d,
|
|
677
677
|
message: te("contentManager.loadFailed"),
|
|
678
678
|
retry: ee
|
|
679
|
-
}) : /* @__PURE__ */
|
|
679
|
+
}) : /* @__PURE__ */ j(v, {});
|
|
680
680
|
let f = {
|
|
681
681
|
...e,
|
|
682
682
|
client: n,
|
|
@@ -687,273 +687,273 @@ function Y(e) {
|
|
|
687
687
|
}, e.onCreated?.(t);
|
|
688
688
|
}
|
|
689
689
|
};
|
|
690
|
-
return u.kinds[e.kind]?.presentation === "reader" ? /* @__PURE__ */
|
|
690
|
+
return u.kinds[e.kind]?.presentation === "reader" ? /* @__PURE__ */ j(E, {
|
|
691
691
|
...f,
|
|
692
692
|
model: u
|
|
693
|
-
}, l.key) : /* @__PURE__ */
|
|
693
|
+
}, l.key) : /* @__PURE__ */ j(ke, { ...f }, l.key);
|
|
694
694
|
}
|
|
695
|
-
function
|
|
696
|
-
let y = n(a), b = t(), { t: x } = b, S =
|
|
697
|
-
|
|
698
|
-
if (!
|
|
699
|
-
let e =
|
|
700
|
-
|
|
695
|
+
function ke({ id: i, client: a, kind: o, languages: s, renderEditor: ee, contentHref: ce, labels: ue, ownerGroup: de, entities: g, onCreated: _, onDeleted: pe, onError: v, management: me }) {
|
|
696
|
+
let y = n(a), b = t(), { t: x } = b, S = xe(), w = we(s), [T, ye] = A(w[0]?.value ?? "en"), E = ve(i, o, T, { client: y }), be = c({ client: y }).kinds, k = !!be?.kinds[o]?.versions.hidden, N = r(v), [P, F] = A(i ? null : q), [I, L] = A(null), [R, z] = A(null), { confirm: B, dialog: V } = he(), H = E.content;
|
|
697
|
+
D(() => {
|
|
698
|
+
if (!H) return;
|
|
699
|
+
let e = H.text?.[T];
|
|
700
|
+
F((t) => t ?? {
|
|
701
701
|
title: e?.title ?? "",
|
|
702
702
|
description: e?.description ?? "",
|
|
703
703
|
body: e?.body ?? "",
|
|
704
|
-
publishAt:
|
|
704
|
+
publishAt: H.publish_at && !H.live ? ge(new Date(H.publish_at)) : ""
|
|
705
705
|
});
|
|
706
|
-
}, [
|
|
707
|
-
let { imageSrc:
|
|
708
|
-
let n =
|
|
706
|
+
}, [H, T]);
|
|
707
|
+
let { imageSrc: U } = E, Ee = O(() => (P?.body ?? "").replace(_e(), (e, t) => {
|
|
708
|
+
let n = U(t);
|
|
709
709
|
return n && n !== t ? n.replaceAll("&", "&") : e;
|
|
710
|
-
}), [
|
|
711
|
-
if (i && !
|
|
712
|
-
error:
|
|
710
|
+
}), [P?.body, U]);
|
|
711
|
+
if (i && !P) return E.error ? /* @__PURE__ */ j(fe, {
|
|
712
|
+
error: E.error,
|
|
713
713
|
message: x("contentManager.loadFailed"),
|
|
714
|
-
retry:
|
|
715
|
-
}) : /* @__PURE__ */
|
|
714
|
+
retry: E.reload
|
|
715
|
+
}) : /* @__PURE__ */ M("div", {
|
|
716
716
|
className: "grid gap-3",
|
|
717
717
|
"aria-busy": !0,
|
|
718
|
-
children: [/* @__PURE__ */
|
|
718
|
+
children: [/* @__PURE__ */ j(h, { className: "h-9 w-full" }), /* @__PURE__ */ j(h, { className: "h-48 w-full" })]
|
|
719
719
|
});
|
|
720
|
-
let
|
|
720
|
+
let W = P, G = (e) => F((t) => ({
|
|
721
721
|
...t,
|
|
722
722
|
...e
|
|
723
|
-
})),
|
|
723
|
+
})), K = (t) => {
|
|
724
724
|
let n = e(t);
|
|
725
|
-
|
|
726
|
-
},
|
|
727
|
-
title:
|
|
728
|
-
description:
|
|
729
|
-
body:
|
|
730
|
-
}),
|
|
731
|
-
if (
|
|
725
|
+
L(n), N(n, "content.save");
|
|
726
|
+
}, De = () => ({
|
|
727
|
+
title: W.title.trim(),
|
|
728
|
+
description: W.description.trim(),
|
|
729
|
+
body: W.body
|
|
730
|
+
}), Oe = async () => {
|
|
731
|
+
if (L(null), z(null), !W.title.trim()) return L(x("contentManager.titleRequired"));
|
|
732
732
|
try {
|
|
733
|
-
if (!
|
|
734
|
-
let e = await
|
|
733
|
+
if (!H) {
|
|
734
|
+
let e = await E.create({
|
|
735
735
|
kind: o,
|
|
736
|
-
text: { [T]:
|
|
736
|
+
text: { [T]: De() },
|
|
737
737
|
owner_group_id: de
|
|
738
|
-
}), t = (g ?? []).filter((e) =>
|
|
738
|
+
}), t = (g ?? []).filter((e) => be?.kinds[o]?.entities?.includes(e.kind) && !be.entity_kinds[e.kind]?.version_level);
|
|
739
739
|
t.length && await y.entities.setOfContent(e.id, {
|
|
740
740
|
kinds: [...new Set(t.map((e) => e.kind))],
|
|
741
741
|
memberships: t.map((e) => ({ group_id: e.id }))
|
|
742
|
-
}, T).catch(
|
|
742
|
+
}, T).catch(K), _?.(e);
|
|
743
743
|
return;
|
|
744
744
|
}
|
|
745
|
-
await
|
|
745
|
+
await E.putText(De()), z(x("pollEditor.saved"));
|
|
746
746
|
} catch (e) {
|
|
747
|
-
|
|
747
|
+
K(e);
|
|
748
748
|
}
|
|
749
|
-
},
|
|
750
|
-
|
|
749
|
+
}, J = async (e) => {
|
|
750
|
+
L(null), z(null);
|
|
751
751
|
try {
|
|
752
|
-
e ? await
|
|
752
|
+
e ? await E.publish(W.publishAt ? new Date(W.publishAt).toISOString() : void 0) : await E.unpublish(), z(x(e ? "contentManager.publishedNotice" : "contentManager.unpublishedNotice"));
|
|
753
753
|
} catch (e) {
|
|
754
|
-
|
|
754
|
+
K(e);
|
|
755
755
|
}
|
|
756
756
|
}, ke = async () => {
|
|
757
|
-
if (
|
|
758
|
-
title: x("contentManager.deleteTitle", { title:
|
|
757
|
+
if (H && await B({
|
|
758
|
+
title: x("contentManager.deleteTitle", { title: H.title }),
|
|
759
759
|
description: x("contentManager.deleteBody"),
|
|
760
760
|
confirm: x("contentManager.delete")
|
|
761
761
|
})) try {
|
|
762
|
-
await
|
|
762
|
+
await E.remove(), pe?.(H);
|
|
763
763
|
} catch (e) {
|
|
764
|
-
|
|
764
|
+
K(e);
|
|
765
765
|
}
|
|
766
|
-
},
|
|
767
|
-
value:
|
|
768
|
-
onChange: (e) =>
|
|
769
|
-
uploadImage:
|
|
770
|
-
disabled:
|
|
766
|
+
}, je = H ? Ce(H) : "draft", Me = H && je === "published" ? ce?.(H) : void 0, Ne = {
|
|
767
|
+
value: Ee,
|
|
768
|
+
onChange: (e) => G({ body: E.storedBody(e) }),
|
|
769
|
+
uploadImage: H ? (e) => E.uploadImage(e) : void 0,
|
|
770
|
+
disabled: E.saving,
|
|
771
771
|
placeholder: x("contentManager.bodyPlaceholder"),
|
|
772
772
|
"aria-label": x("contentManager.body")
|
|
773
773
|
};
|
|
774
|
-
return /* @__PURE__ */
|
|
774
|
+
return /* @__PURE__ */ M(Se, { children: [/* @__PURE__ */ M("form", {
|
|
775
775
|
className: "grid gap-4",
|
|
776
776
|
"data-ckui": "content-form",
|
|
777
777
|
onSubmit: (e) => {
|
|
778
|
-
e.preventDefault(),
|
|
778
|
+
e.preventDefault(), Oe();
|
|
779
779
|
},
|
|
780
780
|
children: [
|
|
781
|
-
/* @__PURE__ */
|
|
781
|
+
/* @__PURE__ */ M("div", {
|
|
782
782
|
className: "flex flex-wrap items-center gap-2",
|
|
783
783
|
children: [
|
|
784
|
-
/* @__PURE__ */
|
|
784
|
+
/* @__PURE__ */ j("h2", {
|
|
785
785
|
className: "text-base font-semibold",
|
|
786
|
-
children: x(
|
|
786
|
+
children: x(H ? "contentManager.editTitle" : "contentManager.newTitle")
|
|
787
787
|
}),
|
|
788
|
-
|
|
789
|
-
variant:
|
|
790
|
-
children: x(`contentManager.${
|
|
788
|
+
H && /* @__PURE__ */ j(te, {
|
|
789
|
+
variant: Te[je],
|
|
790
|
+
children: x(`contentManager.${je}`)
|
|
791
791
|
}),
|
|
792
|
-
|
|
792
|
+
Me && /* @__PURE__ */ j("a", {
|
|
793
793
|
className: "text-xs text-muted-foreground hover:underline",
|
|
794
|
-
href:
|
|
794
|
+
href: Me,
|
|
795
795
|
children: x("contentManager.view")
|
|
796
796
|
})
|
|
797
797
|
]
|
|
798
798
|
}),
|
|
799
|
-
|
|
800
|
-
variant:
|
|
801
|
-
children: /* @__PURE__ */
|
|
799
|
+
H?.moderation && /* @__PURE__ */ j(l, {
|
|
800
|
+
variant: H.moderation === "rejected" ? "destructive" : "default",
|
|
801
|
+
children: /* @__PURE__ */ j(u, { children: H.moderation_reason ? x(`contentManager.${H.moderation === "rejected" ? "rejectedBecause" : "heldBecause"}`, { reason: H.moderation_reason }) : x(`contentManager.${H.moderation === "rejected" ? "rejectedNote" : "heldNote"}`) })
|
|
802
802
|
}),
|
|
803
|
-
w.length > 1 && /* @__PURE__ */
|
|
803
|
+
w.length > 1 && /* @__PURE__ */ M("div", {
|
|
804
804
|
className: "grid gap-1.5",
|
|
805
|
-
children: [/* @__PURE__ */
|
|
805
|
+
children: [/* @__PURE__ */ j(p, {
|
|
806
806
|
htmlFor: `${S}-lang`,
|
|
807
807
|
children: x("contentManager.language")
|
|
808
|
-
}), /* @__PURE__ */
|
|
808
|
+
}), /* @__PURE__ */ M(ne, {
|
|
809
809
|
value: T,
|
|
810
810
|
onValueChange: (e) => {
|
|
811
|
-
|
|
811
|
+
ye(String(e ?? "")), F(H ? null : q);
|
|
812
812
|
},
|
|
813
|
-
children: [/* @__PURE__ */
|
|
813
|
+
children: [/* @__PURE__ */ j(ie, {
|
|
814
814
|
id: `${S}-lang`,
|
|
815
815
|
className: "w-full",
|
|
816
|
-
children: /* @__PURE__ */
|
|
817
|
-
}), /* @__PURE__ */
|
|
816
|
+
children: /* @__PURE__ */ j(ae, { children: (e) => w.find((t) => t.value === e)?.label ?? e })
|
|
817
|
+
}), /* @__PURE__ */ j(re, { children: w.map((e) => /* @__PURE__ */ j(m, {
|
|
818
818
|
value: e.value,
|
|
819
819
|
children: e.label
|
|
820
820
|
}, e.value)) })]
|
|
821
821
|
})]
|
|
822
822
|
}),
|
|
823
|
-
/* @__PURE__ */
|
|
823
|
+
/* @__PURE__ */ M("div", {
|
|
824
824
|
className: "grid gap-1.5",
|
|
825
|
-
children: [/* @__PURE__ */
|
|
825
|
+
children: [/* @__PURE__ */ j(p, {
|
|
826
826
|
htmlFor: `${S}-title`,
|
|
827
827
|
children: x("contentManager.itemTitle")
|
|
828
|
-
}), /* @__PURE__ */
|
|
828
|
+
}), /* @__PURE__ */ j(f, {
|
|
829
829
|
id: `${S}-title`,
|
|
830
|
-
value:
|
|
830
|
+
value: W.title,
|
|
831
831
|
required: !0,
|
|
832
832
|
maxLength: 300,
|
|
833
|
-
onChange: (e) =>
|
|
833
|
+
onChange: (e) => G({ title: e.target.value })
|
|
834
834
|
})]
|
|
835
835
|
}),
|
|
836
|
-
/* @__PURE__ */
|
|
836
|
+
/* @__PURE__ */ j("div", {
|
|
837
837
|
className: "grid gap-4 sm:grid-cols-2",
|
|
838
|
-
children: /* @__PURE__ */
|
|
838
|
+
children: /* @__PURE__ */ M("div", {
|
|
839
839
|
className: "grid gap-1.5",
|
|
840
|
-
children: [/* @__PURE__ */
|
|
840
|
+
children: [/* @__PURE__ */ j(p, {
|
|
841
841
|
htmlFor: `${S}-publish`,
|
|
842
842
|
children: x("contentManager.publishAt")
|
|
843
|
-
}), /* @__PURE__ */
|
|
843
|
+
}), /* @__PURE__ */ j(f, {
|
|
844
844
|
id: `${S}-publish`,
|
|
845
845
|
type: "datetime-local",
|
|
846
|
-
value:
|
|
847
|
-
onChange: (e) =>
|
|
846
|
+
value: W.publishAt,
|
|
847
|
+
onChange: (e) => G({ publishAt: e.target.value })
|
|
848
848
|
})]
|
|
849
849
|
})
|
|
850
850
|
}),
|
|
851
|
-
/* @__PURE__ */
|
|
851
|
+
/* @__PURE__ */ M("div", {
|
|
852
852
|
className: "grid gap-1.5",
|
|
853
|
-
children: [/* @__PURE__ */
|
|
853
|
+
children: [/* @__PURE__ */ j(p, {
|
|
854
854
|
htmlFor: `${S}-description`,
|
|
855
855
|
children: x("contentManager.description")
|
|
856
|
-
}), /* @__PURE__ */
|
|
856
|
+
}), /* @__PURE__ */ j(oe, {
|
|
857
857
|
id: `${S}-description`,
|
|
858
858
|
rows: 2,
|
|
859
|
-
value:
|
|
860
|
-
onChange: (e) =>
|
|
859
|
+
value: W.description,
|
|
860
|
+
onChange: (e) => G({ description: e.target.value })
|
|
861
861
|
})]
|
|
862
862
|
}),
|
|
863
|
-
(
|
|
864
|
-
item:
|
|
865
|
-
src:
|
|
866
|
-
saving:
|
|
867
|
-
onFile: (e) => void
|
|
863
|
+
(k || !H) && /* @__PURE__ */ j(Ae, {
|
|
864
|
+
item: H,
|
|
865
|
+
src: E.coverSrc,
|
|
866
|
+
saving: E.saving,
|
|
867
|
+
onFile: (e) => void E.setCover(e).catch(K)
|
|
868
868
|
}),
|
|
869
|
-
/* @__PURE__ */
|
|
869
|
+
/* @__PURE__ */ M("div", {
|
|
870
870
|
className: "grid gap-1.5",
|
|
871
871
|
children: [
|
|
872
|
-
/* @__PURE__ */
|
|
872
|
+
/* @__PURE__ */ j("span", {
|
|
873
873
|
className: "text-sm font-medium",
|
|
874
874
|
children: x("contentManager.body")
|
|
875
875
|
}),
|
|
876
|
-
ee ? ee(
|
|
877
|
-
"aria-label":
|
|
876
|
+
ee ? ee(Ne) : /* @__PURE__ */ j(oe, {
|
|
877
|
+
"aria-label": Ne["aria-label"],
|
|
878
878
|
rows: 12,
|
|
879
|
-
value:
|
|
880
|
-
placeholder:
|
|
881
|
-
onChange: (e) =>
|
|
879
|
+
value: W.body,
|
|
880
|
+
placeholder: Ne.placeholder,
|
|
881
|
+
onChange: (e) => G({ body: e.target.value })
|
|
882
882
|
}),
|
|
883
|
-
!
|
|
883
|
+
!H && /* @__PURE__ */ j("p", {
|
|
884
884
|
className: "text-xs text-muted-foreground",
|
|
885
885
|
children: x("contentManager.imagesAfterCreate")
|
|
886
886
|
})
|
|
887
887
|
]
|
|
888
888
|
}),
|
|
889
|
-
|
|
890
|
-
|
|
889
|
+
I && /* @__PURE__ */ j(se, { children: typeof I == "string" ? I : le(b, I) }),
|
|
890
|
+
R && !I && /* @__PURE__ */ j("p", {
|
|
891
891
|
role: "status",
|
|
892
892
|
className: "text-sm text-muted-foreground",
|
|
893
|
-
children:
|
|
893
|
+
children: R
|
|
894
894
|
}),
|
|
895
|
-
/* @__PURE__ */
|
|
895
|
+
/* @__PURE__ */ M("div", {
|
|
896
896
|
className: "flex flex-wrap gap-2 border-t border-border pt-4",
|
|
897
897
|
children: [
|
|
898
|
-
/* @__PURE__ */
|
|
898
|
+
/* @__PURE__ */ j(d, {
|
|
899
899
|
type: "submit",
|
|
900
|
-
disabled:
|
|
901
|
-
children:
|
|
900
|
+
disabled: E.saving,
|
|
901
|
+
children: E.saving ? x("common.saving") : x(H ? "common.save" : "contentManager.createDraft")
|
|
902
902
|
}),
|
|
903
|
-
|
|
903
|
+
H && !H.live && /* @__PURE__ */ j(d, {
|
|
904
904
|
type: "button",
|
|
905
905
|
variant: "outline",
|
|
906
|
-
disabled:
|
|
907
|
-
onClick: () => void
|
|
906
|
+
disabled: E.saving,
|
|
907
|
+
onClick: () => void J(!0),
|
|
908
908
|
children: x("contentManager.publish")
|
|
909
909
|
}),
|
|
910
|
-
|
|
910
|
+
H?.state === "published" && /* @__PURE__ */ j(d, {
|
|
911
911
|
type: "button",
|
|
912
912
|
variant: "outline",
|
|
913
|
-
disabled:
|
|
914
|
-
onClick: () => void
|
|
913
|
+
disabled: E.saving,
|
|
914
|
+
onClick: () => void J(!1),
|
|
915
915
|
children: x("contentManager.unpublish")
|
|
916
916
|
}),
|
|
917
|
-
|
|
917
|
+
H && /* @__PURE__ */ j(d, {
|
|
918
918
|
type: "button",
|
|
919
919
|
variant: "destructive",
|
|
920
920
|
className: "ms-auto",
|
|
921
|
-
disabled:
|
|
921
|
+
disabled: E.saving,
|
|
922
922
|
onClick: () => void ke(),
|
|
923
923
|
children: x("contentManager.delete")
|
|
924
924
|
})
|
|
925
925
|
]
|
|
926
926
|
}),
|
|
927
|
-
|
|
927
|
+
V
|
|
928
928
|
]
|
|
929
|
-
}),
|
|
929
|
+
}), H && /* @__PURE__ */ j(C, {
|
|
930
930
|
management: me,
|
|
931
|
-
content:
|
|
931
|
+
content: H,
|
|
932
932
|
client: y,
|
|
933
933
|
onError: v,
|
|
934
934
|
labels: ue
|
|
935
935
|
})] });
|
|
936
936
|
}
|
|
937
|
-
function
|
|
938
|
-
let { t: a } = t(), o =
|
|
939
|
-
return /* @__PURE__ */
|
|
937
|
+
function Ae({ item: e, src: n, saving: r, onFile: i }) {
|
|
938
|
+
let { t: a } = t(), o = k(null);
|
|
939
|
+
return /* @__PURE__ */ M("div", {
|
|
940
940
|
className: "grid gap-1.5",
|
|
941
941
|
"data-ckui": "content-cover",
|
|
942
|
-
children: [/* @__PURE__ */
|
|
942
|
+
children: [/* @__PURE__ */ j("span", {
|
|
943
943
|
className: "text-sm font-medium",
|
|
944
944
|
children: a("contentManager.cover")
|
|
945
|
-
}), e ? /* @__PURE__ */
|
|
945
|
+
}), e ? /* @__PURE__ */ M("div", {
|
|
946
946
|
className: "flex flex-wrap items-center gap-3",
|
|
947
947
|
children: [
|
|
948
|
-
n ? /* @__PURE__ */
|
|
948
|
+
n ? /* @__PURE__ */ j("img", {
|
|
949
949
|
src: n,
|
|
950
950
|
alt: "",
|
|
951
951
|
className: "h-20 w-36 rounded-md border border-border object-cover"
|
|
952
|
-
}) : /* @__PURE__ */
|
|
952
|
+
}) : /* @__PURE__ */ j("span", {
|
|
953
953
|
className: "text-muted-foreground",
|
|
954
954
|
children: a("contentManager.noCover")
|
|
955
955
|
}),
|
|
956
|
-
/* @__PURE__ */
|
|
956
|
+
/* @__PURE__ */ j(d, {
|
|
957
957
|
type: "button",
|
|
958
958
|
size: "sm",
|
|
959
959
|
variant: "outline",
|
|
@@ -961,7 +961,7 @@ function Oe({ item: e, src: n, saving: r, onFile: i }) {
|
|
|
961
961
|
onClick: () => o.current?.click(),
|
|
962
962
|
children: a(n ? "pollEditor.replaceImage" : "contentManager.addCover")
|
|
963
963
|
}),
|
|
964
|
-
n && /* @__PURE__ */
|
|
964
|
+
n && /* @__PURE__ */ j(d, {
|
|
965
965
|
type: "button",
|
|
966
966
|
size: "sm",
|
|
967
967
|
variant: "ghost",
|
|
@@ -969,7 +969,7 @@ function Oe({ item: e, src: n, saving: r, onFile: i }) {
|
|
|
969
969
|
onClick: () => i(null),
|
|
970
970
|
children: a("pollEditor.removeImage")
|
|
971
971
|
}),
|
|
972
|
-
/* @__PURE__ */
|
|
972
|
+
/* @__PURE__ */ j("input", {
|
|
973
973
|
ref: o,
|
|
974
974
|
type: "file",
|
|
975
975
|
accept: "image/*",
|
|
@@ -981,13 +981,13 @@ function Oe({ item: e, src: n, saving: r, onFile: i }) {
|
|
|
981
981
|
}
|
|
982
982
|
})
|
|
983
983
|
]
|
|
984
|
-
}) : /* @__PURE__ */
|
|
984
|
+
}) : /* @__PURE__ */ j("p", {
|
|
985
985
|
className: "text-xs text-muted-foreground",
|
|
986
986
|
children: a("contentManager.imagesAfterCreate")
|
|
987
987
|
})]
|
|
988
988
|
});
|
|
989
989
|
}
|
|
990
990
|
//#endregion
|
|
991
|
-
export {
|
|
991
|
+
export { J as ContentEditor, L as ContentManager, Ee as accessLabel, Ce as contentStatus, F as useContentManagerAccess };
|
|
992
992
|
|
|
993
993
|
//# sourceMappingURL=content-manager.js.map
|