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