@openrails/contentkit-ui 0.85.1 → 0.87.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -7
- package/dist/client/beacons.d.ts +13 -4
- package/dist/client/beacons.js +14 -7
- package/dist/client/beacons.js.map +1 -1
- package/dist/client/client.d.ts +3 -0
- package/dist/client/client.js +29 -27
- package/dist/client/client.js.map +1 -1
- package/dist/client/codes.d.ts +6 -1
- package/dist/client/codes.js +4 -1
- package/dist/client/codes.js.map +1 -1
- package/dist/client/content/types.d.ts +4 -2
- package/dist/client/content/types.js.map +1 -1
- package/dist/client/discovery.js +3 -0
- package/dist/client/discovery.js.map +1 -1
- package/dist/client/errors.d.ts +6 -0
- package/dist/client/errors.js +6 -2
- package/dist/client/errors.js.map +1 -1
- package/dist/client/gallery.d.ts +3 -5
- package/dist/client/gallery.js +16 -20
- package/dist/client/gallery.js.map +1 -1
- package/dist/client/generated/error-codes.d.ts +1 -1
- package/dist/client/generated/error-codes.js +9 -1
- package/dist/client/generated/error-codes.js.map +1 -1
- package/dist/client/generated/routes.d.ts +29 -3
- package/dist/client/generated/routes.js +44 -3
- package/dist/client/generated/routes.js.map +1 -1
- package/dist/client/generated/wire.d.ts +60 -10
- package/dist/client/generated/wire.js.map +1 -1
- package/dist/client/index.d.ts +2 -1
- package/dist/client/media/queue.d.ts +4 -2
- package/dist/client/media/queue.js +18 -12
- package/dist/client/media/queue.js.map +1 -1
- package/dist/client/media/rules.d.ts +7 -1
- package/dist/client/media/rules.js +27 -21
- package/dist/client/media/rules.js.map +1 -1
- package/dist/client/media/windows.js +1 -1
- package/dist/client/media/windows.js.map +1 -1
- package/dist/client/stats.d.ts +32 -0
- package/dist/client/stats.js +35 -0
- package/dist/client/stats.js.map +1 -0
- package/dist/client/versions.d.ts +6 -4
- package/dist/client/versions.js +24 -26
- package/dist/client/versions.js.map +1 -1
- package/dist/client.js +30 -29
- package/dist/components/admin/content-manager.js +206 -206
- package/dist/components/admin/content-manager.js.map +1 -1
- package/dist/components/admin/group-manager.js +71 -70
- package/dist/components/admin/group-manager.js.map +1 -1
- package/dist/components/admin/media-item-panel.d.ts +24 -7
- package/dist/components/admin/media-item-panel.js +209 -197
- package/dist/components/admin/media-item-panel.js.map +1 -1
- package/dist/components/admin/poll-manager.js +25 -25
- package/dist/components/admin/stats-dashboard.d.ts +22 -0
- package/dist/components/admin/stats-dashboard.js +257 -0
- package/dist/components/admin/stats-dashboard.js.map +1 -0
- package/dist/components/content/card.d.ts +5 -3
- package/dist/components/content/card.js +155 -133
- package/dist/components/content/card.js.map +1 -1
- package/dist/components/content/download-button.d.ts +26 -0
- package/dist/components/content/download-button.js +51 -0
- package/dist/components/content/download-button.js.map +1 -0
- package/dist/components/content/editors.js +455 -427
- package/dist/components/content/editors.js.map +1 -1
- package/dist/components/content/grid.d.ts +8 -1
- package/dist/components/content/grid.js +153 -104
- package/dist/components/content/grid.js.map +1 -1
- package/dist/components/content/index.d.ts +4 -2
- package/dist/components/content/listing.d.ts +3 -1
- package/dist/components/content/listing.js +34 -34
- package/dist/components/content/listing.js.map +1 -1
- package/dist/components/content/paywall.d.ts +17 -5
- package/dist/components/content/paywall.js +115 -100
- package/dist/components/content/paywall.js.map +1 -1
- package/dist/components/content/reader-stats.d.ts +12 -0
- package/dist/components/content/reader-stats.js +47 -0
- package/dist/components/content/reader-stats.js.map +1 -0
- package/dist/components/groups/banner.js +33 -33
- package/dist/components/groups/directory.js +11 -11
- package/dist/components/groups/editor.js +293 -293
- package/dist/components/groups/editor.js.map +1 -1
- package/dist/components/groups/header.js +27 -27
- package/dist/components/groups/header.js.map +1 -1
- package/dist/components/groups/memberships.js +180 -180
- package/dist/components/groups/parts.d.ts +0 -2
- package/dist/components/groups/parts.js +9 -27
- package/dist/components/groups/parts.js.map +1 -1
- package/dist/components/media-folder-editor.js +239 -189
- package/dist/components/media-folder-editor.js.map +1 -1
- package/dist/components/media-gallery.d.ts +1 -4
- package/dist/components/media-gallery.js +19 -34
- package/dist/components/media-gallery.js.map +1 -1
- package/dist/components/notifications.js +17 -17
- package/dist/components/slot-upload.d.ts +2 -2
- package/dist/components/slot-upload.js +84 -79
- package/dist/components/slot-upload.js.map +1 -1
- package/dist/components/social/bans.js +34 -34
- package/dist/components/social/comments.js +1 -1
- package/dist/components/social/comments.js.map +1 -1
- package/dist/components/social/engagement.d.ts +2 -1
- package/dist/components/social/engagement.js +5 -3
- package/dist/components/social/engagement.js.map +1 -1
- package/dist/components/social/moderation.js +52 -48
- package/dist/components/social/moderation.js.map +1 -1
- package/dist/components/video-player.d.ts +2 -0
- package/dist/components/video-player.js +318 -314
- package/dist/components/video-player.js.map +1 -1
- package/dist/i18n/context.d.ts +2 -0
- package/dist/i18n/context.js +23 -5
- package/dist/i18n/context.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +13 -10
- package/dist/locales/admin/de.js +27 -0
- package/dist/locales/admin/de.js.map +1 -1
- package/dist/locales/admin/en.d.ts +27 -0
- package/dist/locales/admin/en.js +27 -0
- package/dist/locales/admin/en.js.map +1 -1
- package/dist/locales/admin/es.js +27 -0
- package/dist/locales/admin/es.js.map +1 -1
- package/dist/locales/admin/ja.js +27 -0
- package/dist/locales/admin/ja.js.map +1 -1
- package/dist/locales/admin/ko.js +27 -0
- package/dist/locales/admin/ko.js.map +1 -1
- package/dist/locales/admin/zh.js +27 -0
- package/dist/locales/admin/zh.js.map +1 -1
- package/dist/locales/content/de.js +6 -0
- package/dist/locales/content/de.js.map +1 -1
- package/dist/locales/content/en.d.ts +6 -0
- package/dist/locales/content/en.js +6 -0
- package/dist/locales/content/en.js.map +1 -1
- package/dist/locales/content/es.js +6 -0
- package/dist/locales/content/es.js.map +1 -1
- package/dist/locales/content/ja.js +6 -0
- package/dist/locales/content/ja.js.map +1 -1
- package/dist/locales/content/ko.js +6 -0
- package/dist/locales/content/ko.js.map +1 -1
- package/dist/locales/content/zh.js +6 -0
- package/dist/locales/content/zh.js.map +1 -1
- package/dist/locales/de.js +14 -2
- package/dist/locales/de.js.map +1 -1
- package/dist/locales/discovery/de.js +3 -0
- package/dist/locales/discovery/de.js.map +1 -1
- package/dist/locales/discovery/en.d.ts +3 -0
- package/dist/locales/discovery/en.js +3 -0
- package/dist/locales/discovery/en.js.map +1 -1
- package/dist/locales/discovery/es.js +3 -0
- package/dist/locales/discovery/es.js.map +1 -1
- package/dist/locales/discovery/ja.js +3 -0
- package/dist/locales/discovery/ja.js.map +1 -1
- package/dist/locales/discovery/ko.js +3 -0
- package/dist/locales/discovery/ko.js.map +1 -1
- package/dist/locales/discovery/zh.js +3 -0
- package/dist/locales/discovery/zh.js.map +1 -1
- package/dist/locales/en.d.ts +50 -2
- package/dist/locales/en.js +14 -2
- package/dist/locales/en.js.map +1 -1
- package/dist/locales/es.js +14 -2
- package/dist/locales/es.js.map +1 -1
- package/dist/locales/ja.js +14 -2
- package/dist/locales/ja.js.map +1 -1
- package/dist/locales/ko.js +14 -2
- package/dist/locales/ko.js.map +1 -1
- package/dist/locales/zh.js +14 -2
- package/dist/locales/zh.js.map +1 -1
- package/dist/react/admin.js +22 -23
- package/dist/react/admin.js.map +1 -1
- package/dist/react/canonical.d.ts +4 -3
- package/dist/react/canonical.js +34 -33
- package/dist/react/canonical.js.map +1 -1
- package/dist/react/comments.d.ts +1 -1
- package/dist/react/comments.js +3 -2
- package/dist/react/comments.js.map +1 -1
- package/dist/react/contents.js +144 -144
- package/dist/react/contents.js.map +1 -1
- package/dist/react/context.d.ts +1 -1
- package/dist/react/context.js.map +1 -1
- package/dist/react/detail.d.ts +12 -6
- package/dist/react/detail.js +31 -24
- package/dist/react/detail.js.map +1 -1
- package/dist/react/discovery.d.ts +11 -0
- package/dist/react/discovery.js +49 -30
- package/dist/react/discovery.js.map +1 -1
- package/dist/react/engagement.d.ts +6 -2
- package/dist/react/engagement.js +2 -6
- package/dist/react/engagement.js.map +1 -1
- package/dist/react/folder.d.ts +7 -2
- package/dist/react/folder.js +165 -147
- package/dist/react/folder.js.map +1 -1
- package/dist/react/groups.d.ts +0 -1
- package/dist/react/groups.js +13 -12
- package/dist/react/groups.js.map +1 -1
- package/dist/react/index.d.ts +6 -4
- package/dist/react/location.d.ts +11 -0
- package/dist/react/location.js +18 -0
- package/dist/react/location.js.map +1 -0
- package/dist/react/public.d.ts +8 -0
- package/dist/react/public.js +32 -27
- package/dist/react/public.js.map +1 -1
- package/dist/react/stats.d.ts +24 -0
- package/dist/react/stats.js +28 -0
- package/dist/react/stats.js.map +1 -0
- package/dist/react/use-resource.js +8 -7
- package/dist/react/use-resource.js.map +1 -1
- package/dist/react/versions.d.ts +25 -5
- package/dist/react/versions.js +61 -40
- package/dist/react/versions.js.map +1 -1
- package/dist/react.js +26 -24
- package/dist/styles.css +1 -1
- package/dist/urls/index.d.ts +35 -10
- package/dist/urls.js +100 -70
- package/dist/urls.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { useMessages as e } from "../../i18n/context.js";
|
|
2
2
|
import { ContentKitUiRoot as t } from "../../scope.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
3
|
+
import { useContentGroups as n, useGroupMembers as r, useKinds as i } from "../../react/groups.js";
|
|
4
|
+
import { Button as a } from "../../ui/button.js";
|
|
5
|
+
import { SortableList as o } from "../sortable-list.js";
|
|
6
|
+
import { Badge as s } from "../../ui/badge.js";
|
|
7
|
+
import { Input as c } from "../../ui/input.js";
|
|
8
|
+
import { Label as l } from "../../ui/label.js";
|
|
9
|
+
import { Select as u, SelectContent as d, SelectItem as f, SelectTrigger as p, SelectValue as m } from "../../ui/select.js";
|
|
10
|
+
import { Skeleton as h } from "../../ui/skeleton.js";
|
|
11
|
+
import { ErrorLine as g, contentError as _, formatDate as v, useAction as y } from "../social/parts.js";
|
|
12
|
+
import { fromLocalInput as b, toLocalInput as x } from "../../client/group-fields.js";
|
|
13
13
|
import { GroupPicker as S, labelOf as C } from "./parts.js";
|
|
14
14
|
import { useEffect as w, useId as T, useMemo as E, useRef as D, useState as O } from "react";
|
|
15
15
|
import { Fragment as k, jsx as A, jsxs as j } from "react/jsx-runtime";
|
|
@@ -17,28 +17,28 @@ import { cn as M } from "cn";
|
|
|
17
17
|
//#region src/components/groups/memberships.tsx
|
|
18
18
|
var N = "__none__", P = ({ key: e, ...t }) => t, F = (e, t) => JSON.stringify(e) === JSON.stringify(t);
|
|
19
19
|
function I(r) {
|
|
20
|
-
let
|
|
20
|
+
let o = e(), { t: s } = o, { kinds: c, loading: l } = i({ client: r.client }), u = n(r.content, {
|
|
21
21
|
language: r.language,
|
|
22
22
|
client: r.client
|
|
23
|
-
}),
|
|
23
|
+
}), d = E(() => r.groupKinds ?? c?.kinds[r.contentKind]?.groups ?? [], [
|
|
24
24
|
r.groupKinds,
|
|
25
|
-
|
|
25
|
+
c,
|
|
26
26
|
r.contentKind
|
|
27
|
-
]), [
|
|
27
|
+
]), [f, p] = O(/* @__PURE__ */ new Map()), m = E(() => new Map([...u.groups, ...f]), [u.groups, f]), v = D(0), b = E(() => u.memberships.filter((e) => d.includes(u.groups.get(e.group_id ?? "")?.kind ?? "")).map((e) => ({
|
|
28
28
|
...e,
|
|
29
29
|
content_id: void 0
|
|
30
30
|
})), [
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
]), [
|
|
31
|
+
u.memberships,
|
|
32
|
+
u.groups,
|
|
33
|
+
d
|
|
34
|
+
]), [x, T] = O([]), k = !F(x.map(P), b), N = D(k);
|
|
35
35
|
N.current = k, w(() => {
|
|
36
|
-
(!N.current || !
|
|
36
|
+
(!N.current || !x.length) && T(b.map((e) => ({
|
|
37
37
|
...e,
|
|
38
|
-
key: ++
|
|
38
|
+
key: ++v.current
|
|
39
39
|
})));
|
|
40
|
-
}, [
|
|
41
|
-
let I =
|
|
40
|
+
}, [b]);
|
|
41
|
+
let I = y("membership.save", r.onError), [R, z] = O(!1), B = (e, t) => {
|
|
42
42
|
z(!1), T((n) => n.map((n) => n.key === e ? {
|
|
43
43
|
...n,
|
|
44
44
|
...t
|
|
@@ -49,35 +49,35 @@ function I(r) {
|
|
|
49
49
|
"data-ckui": "membership-editor",
|
|
50
50
|
children: e
|
|
51
51
|
});
|
|
52
|
-
if (
|
|
53
|
-
if (
|
|
52
|
+
if (l || u.loading && !u.memberships.length) return V(/* @__PURE__ */ A(h, { className: "h-32 w-full" }));
|
|
53
|
+
if (u.error && !u.memberships.length) return V(/* @__PURE__ */ j("div", {
|
|
54
54
|
role: "alert",
|
|
55
55
|
className: "grid justify-items-start gap-2",
|
|
56
56
|
children: [/* @__PURE__ */ A("p", {
|
|
57
57
|
className: "text-destructive",
|
|
58
|
-
children:
|
|
59
|
-
}), /* @__PURE__ */ A(
|
|
58
|
+
children: _(o, u.error)
|
|
59
|
+
}), /* @__PURE__ */ A(a, {
|
|
60
60
|
size: "sm",
|
|
61
61
|
variant: "outline",
|
|
62
|
-
onClick:
|
|
63
|
-
children:
|
|
62
|
+
onClick: u.reload,
|
|
63
|
+
children: s("common.retry")
|
|
64
64
|
})]
|
|
65
65
|
}));
|
|
66
66
|
let H = (e) => r.versions?.find((t) => t.id === e)?.label ?? e.slice(0, 8);
|
|
67
67
|
return V(/* @__PURE__ */ j("form", {
|
|
68
68
|
className: "grid gap-5",
|
|
69
69
|
onSubmit: (e) => {
|
|
70
|
-
e.preventDefault(), z(!1), I.run(() =>
|
|
71
|
-
e && (z(!0), T(e.memberships.filter((t) =>
|
|
70
|
+
e.preventDefault(), z(!1), I.run(() => u.set(x.map(P), [...d])).then((e) => {
|
|
71
|
+
e && (z(!0), T(e.memberships.filter((t) => d.includes(e.groups.find((e) => e.id === t.group_id)?.kind ?? "")).map((e) => ({
|
|
72
72
|
...e,
|
|
73
73
|
content_id: void 0,
|
|
74
|
-
key: ++
|
|
74
|
+
key: ++v.current
|
|
75
75
|
}))), r.onSaved?.(e));
|
|
76
76
|
});
|
|
77
77
|
},
|
|
78
78
|
children: [
|
|
79
|
-
|
|
80
|
-
let t =
|
|
79
|
+
d.map((e) => {
|
|
80
|
+
let t = c?.group_kinds?.[e] ?? {}, n = x.filter((t) => m.get(t.group_id ?? "")?.kind === e), i = C(r.labels, e);
|
|
81
81
|
return /* @__PURE__ */ j("fieldset", {
|
|
82
82
|
className: "grid gap-2",
|
|
83
83
|
"data-ckui": "membership-kind",
|
|
@@ -91,7 +91,7 @@ function I(r) {
|
|
|
91
91
|
className: "grid gap-2",
|
|
92
92
|
children: n.map((e) => /* @__PURE__ */ A(L, {
|
|
93
93
|
m: e,
|
|
94
|
-
card:
|
|
94
|
+
card: m.get(e.group_id ?? ""),
|
|
95
95
|
spec: t,
|
|
96
96
|
labels: r.labels,
|
|
97
97
|
versions: r.versions,
|
|
@@ -105,113 +105,113 @@ function I(r) {
|
|
|
105
105
|
/* @__PURE__ */ A(S, {
|
|
106
106
|
kind: e,
|
|
107
107
|
language: r.language,
|
|
108
|
-
label:
|
|
108
|
+
label: s("memberships.add", { kind: i }),
|
|
109
109
|
exclude: n.filter((e) => !e.version_id && !e.role).map((e) => e.group_id),
|
|
110
110
|
client: r.client,
|
|
111
111
|
onPick: (e) => {
|
|
112
|
-
z(!1),
|
|
112
|
+
z(!1), p((t) => new Map(t).set(e.id, e)), T((t) => [...t, {
|
|
113
113
|
group_id: e.id,
|
|
114
|
-
key: ++
|
|
114
|
+
key: ++v.current
|
|
115
115
|
}]);
|
|
116
116
|
}
|
|
117
117
|
})
|
|
118
118
|
]
|
|
119
119
|
}, e);
|
|
120
120
|
}),
|
|
121
|
-
!
|
|
121
|
+
!d.length && /* @__PURE__ */ A("p", {
|
|
122
122
|
className: "text-muted-foreground",
|
|
123
|
-
children:
|
|
123
|
+
children: s("memberships.noKinds")
|
|
124
124
|
}),
|
|
125
|
-
/* @__PURE__ */ A(
|
|
125
|
+
/* @__PURE__ */ A(g, { error: I.error }),
|
|
126
126
|
/* @__PURE__ */ j("div", {
|
|
127
127
|
className: "flex items-center gap-3",
|
|
128
128
|
children: [
|
|
129
|
-
/* @__PURE__ */ A(
|
|
129
|
+
/* @__PURE__ */ A(a, {
|
|
130
130
|
type: "submit",
|
|
131
131
|
size: "sm",
|
|
132
132
|
disabled: I.pending || !k,
|
|
133
|
-
children: I.pending ?
|
|
133
|
+
children: I.pending ? s("common.saving") : s("common.save")
|
|
134
134
|
}),
|
|
135
|
-
k && /* @__PURE__ */ A(
|
|
135
|
+
k && /* @__PURE__ */ A(a, {
|
|
136
136
|
type: "button",
|
|
137
137
|
size: "sm",
|
|
138
138
|
variant: "ghost",
|
|
139
139
|
disabled: I.pending,
|
|
140
|
-
onClick: () => T(
|
|
140
|
+
onClick: () => T(b.map((e) => ({
|
|
141
141
|
...e,
|
|
142
|
-
key: ++
|
|
142
|
+
key: ++v.current
|
|
143
143
|
}))),
|
|
144
|
-
children:
|
|
144
|
+
children: s("memberships.discard")
|
|
145
145
|
}),
|
|
146
146
|
R && !k && /* @__PURE__ */ A("span", {
|
|
147
147
|
role: "status",
|
|
148
148
|
className: "text-muted-foreground",
|
|
149
|
-
children:
|
|
149
|
+
children: s("memberships.saved")
|
|
150
150
|
})
|
|
151
151
|
]
|
|
152
152
|
})
|
|
153
153
|
]
|
|
154
154
|
}));
|
|
155
155
|
}
|
|
156
|
-
function L({ m: t, card:
|
|
157
|
-
let { t: v } = e(), y = T(), b =
|
|
156
|
+
function L({ m: t, card: n, spec: r, labels: i, versions: o, versionLabel: h, onChange: g, onRemove: _ }) {
|
|
157
|
+
let { t: v } = e(), y = T(), b = n ? n.name || n.slug : t.group_id ?? "", x = [.../* @__PURE__ */ new Set([...(o ?? []).map((e) => e.id), ...t.version_id ? [t.version_id] : []])];
|
|
158
158
|
return /* @__PURE__ */ j("li", {
|
|
159
159
|
className: "flex flex-wrap items-center gap-2 rounded-md border border-border p-2",
|
|
160
160
|
"data-ckui": "membership",
|
|
161
|
-
"data-group":
|
|
161
|
+
"data-group": n?.slug,
|
|
162
162
|
"data-state": t.state ?? "active",
|
|
163
163
|
children: [
|
|
164
164
|
/* @__PURE__ */ A("span", {
|
|
165
165
|
className: "min-w-0 flex-1 font-medium break-words",
|
|
166
166
|
children: b
|
|
167
167
|
}),
|
|
168
|
-
t.state === "proposed" && /* @__PURE__ */ j(k, { children: [/* @__PURE__ */ A(
|
|
168
|
+
t.state === "proposed" && /* @__PURE__ */ j(k, { children: [/* @__PURE__ */ A(s, {
|
|
169
169
|
variant: "secondary",
|
|
170
170
|
children: v("memberships.proposed")
|
|
171
|
-
}), /* @__PURE__ */ A(
|
|
171
|
+
}), /* @__PURE__ */ A(a, {
|
|
172
172
|
type: "button",
|
|
173
173
|
size: "xs",
|
|
174
174
|
variant: "outline",
|
|
175
175
|
onClick: () => g({ state: "active" }),
|
|
176
176
|
children: v("memberships.accept")
|
|
177
177
|
})] }),
|
|
178
|
-
|
|
178
|
+
r.version_level && x.length > 0 && /* @__PURE__ */ j(u, {
|
|
179
179
|
value: t.version_id ?? N,
|
|
180
180
|
onValueChange: (e) => g({ version_id: e === N ? void 0 : String(e) }),
|
|
181
|
-
children: [/* @__PURE__ */ A(
|
|
181
|
+
children: [/* @__PURE__ */ A(p, {
|
|
182
182
|
size: "sm",
|
|
183
183
|
"aria-label": v("memberships.versionOf", { name: b }),
|
|
184
|
-
children: /* @__PURE__ */ A(
|
|
185
|
-
}), /* @__PURE__ */ j(
|
|
184
|
+
children: /* @__PURE__ */ A(m, { children: (e) => e === N ? v("memberships.wholeContent") : h(e) })
|
|
185
|
+
}), /* @__PURE__ */ j(d, { children: [/* @__PURE__ */ A(f, {
|
|
186
186
|
value: N,
|
|
187
187
|
children: v("memberships.wholeContent")
|
|
188
|
-
}), x.map((e) => /* @__PURE__ */ A(
|
|
188
|
+
}), x.map((e) => /* @__PURE__ */ A(f, {
|
|
189
189
|
value: e,
|
|
190
190
|
children: h(e)
|
|
191
191
|
}, e))] })]
|
|
192
192
|
}),
|
|
193
|
-
!!
|
|
193
|
+
!!r.roles?.length && /* @__PURE__ */ j(u, {
|
|
194
194
|
value: t.role || N,
|
|
195
195
|
onValueChange: (e) => g({ role: e === N ? void 0 : String(e) }),
|
|
196
|
-
children: [/* @__PURE__ */ A(
|
|
196
|
+
children: [/* @__PURE__ */ A(p, {
|
|
197
197
|
size: "sm",
|
|
198
198
|
"aria-label": v("memberships.roleOf", { name: b }),
|
|
199
|
-
children: /* @__PURE__ */ A(
|
|
200
|
-
}), /* @__PURE__ */ j(
|
|
199
|
+
children: /* @__PURE__ */ A(m, { children: (e) => e === N ? v("memberships.noRole") : C(i, e) })
|
|
200
|
+
}), /* @__PURE__ */ j(d, { children: [/* @__PURE__ */ A(f, {
|
|
201
201
|
value: N,
|
|
202
202
|
children: v("memberships.noRole")
|
|
203
|
-
}),
|
|
203
|
+
}), r.roles.map((e) => /* @__PURE__ */ A(f, {
|
|
204
204
|
value: e,
|
|
205
|
-
children: C(
|
|
205
|
+
children: C(i, e)
|
|
206
206
|
}, e))] })]
|
|
207
207
|
}),
|
|
208
|
-
|
|
208
|
+
r.ordered && /* @__PURE__ */ j("div", {
|
|
209
209
|
className: "flex items-center gap-1",
|
|
210
|
-
children: [/* @__PURE__ */ A(
|
|
210
|
+
children: [/* @__PURE__ */ A(l, {
|
|
211
211
|
htmlFor: `${y}-pos`,
|
|
212
212
|
className: "text-xs text-muted-foreground",
|
|
213
213
|
children: v("memberships.position")
|
|
214
|
-
}), /* @__PURE__ */ A(
|
|
214
|
+
}), /* @__PURE__ */ A(c, {
|
|
215
215
|
id: `${y}-pos`,
|
|
216
216
|
className: "h-8 w-20",
|
|
217
217
|
type: "number",
|
|
@@ -222,13 +222,13 @@ function L({ m: t, card: r, spec: f, labels: p, versions: m, versionLabel: h, on
|
|
|
222
222
|
onChange: (e) => g({ position: e.target.value === "" ? void 0 : Math.max(0, Math.trunc(Number(e.target.value))) })
|
|
223
223
|
})]
|
|
224
224
|
}),
|
|
225
|
-
|
|
225
|
+
r.windows && /* @__PURE__ */ A(R, {
|
|
226
226
|
from: t.active_from,
|
|
227
227
|
until: t.active_until,
|
|
228
228
|
name: b,
|
|
229
229
|
onChange: g
|
|
230
230
|
}),
|
|
231
|
-
/* @__PURE__ */ A(
|
|
231
|
+
/* @__PURE__ */ A(a, {
|
|
232
232
|
type: "button",
|
|
233
233
|
size: "xs",
|
|
234
234
|
variant: "ghost",
|
|
@@ -240,46 +240,46 @@ function L({ m: t, card: r, spec: f, labels: p, versions: m, versionLabel: h, on
|
|
|
240
240
|
});
|
|
241
241
|
}
|
|
242
242
|
function R({ from: t, until: n, name: r, onChange: i }) {
|
|
243
|
-
let { t:
|
|
243
|
+
let { t: a } = e(), o = T();
|
|
244
244
|
return /* @__PURE__ */ j("div", {
|
|
245
245
|
className: "flex flex-wrap items-center gap-1",
|
|
246
246
|
"data-ckui": "membership-window",
|
|
247
247
|
children: [
|
|
248
|
-
/* @__PURE__ */ A(
|
|
249
|
-
htmlFor: `${
|
|
248
|
+
/* @__PURE__ */ A(l, {
|
|
249
|
+
htmlFor: `${o}-from`,
|
|
250
250
|
className: "text-xs text-muted-foreground",
|
|
251
|
-
children:
|
|
251
|
+
children: a("memberships.from")
|
|
252
252
|
}),
|
|
253
|
-
/* @__PURE__ */ A(
|
|
254
|
-
id: `${
|
|
253
|
+
/* @__PURE__ */ A(c, {
|
|
254
|
+
id: `${o}-from`,
|
|
255
255
|
className: "h-8 w-48",
|
|
256
256
|
type: "datetime-local",
|
|
257
|
-
"aria-label":
|
|
258
|
-
value:
|
|
259
|
-
onChange: (e) => i({ active_from:
|
|
257
|
+
"aria-label": a("memberships.fromOf", { name: r }),
|
|
258
|
+
value: x(t),
|
|
259
|
+
onChange: (e) => i({ active_from: b(e.target.value) })
|
|
260
260
|
}),
|
|
261
|
-
/* @__PURE__ */ A(
|
|
262
|
-
htmlFor: `${
|
|
261
|
+
/* @__PURE__ */ A(l, {
|
|
262
|
+
htmlFor: `${o}-until`,
|
|
263
263
|
className: "text-xs text-muted-foreground",
|
|
264
|
-
children:
|
|
264
|
+
children: a("memberships.until")
|
|
265
265
|
}),
|
|
266
|
-
/* @__PURE__ */ A(
|
|
267
|
-
id: `${
|
|
266
|
+
/* @__PURE__ */ A(c, {
|
|
267
|
+
id: `${o}-until`,
|
|
268
268
|
className: "h-8 w-48",
|
|
269
269
|
type: "datetime-local",
|
|
270
|
-
"aria-label":
|
|
271
|
-
value:
|
|
272
|
-
onChange: (e) => i({ active_until:
|
|
270
|
+
"aria-label": a("memberships.untilOf", { name: r }),
|
|
271
|
+
value: x(n),
|
|
272
|
+
onChange: (e) => i({ active_until: b(e.target.value) })
|
|
273
273
|
})
|
|
274
274
|
]
|
|
275
275
|
});
|
|
276
276
|
}
|
|
277
277
|
var z = (e) => `${e.content_id}|${e.version_id ?? ""}`;
|
|
278
|
-
function B(
|
|
279
|
-
let
|
|
280
|
-
pageSize:
|
|
281
|
-
client:
|
|
282
|
-
}),
|
|
278
|
+
function B(n) {
|
|
279
|
+
let c = e(), { t: l } = c, { kinds: u } = i({ client: n.client }), d = u?.group_kinds?.[n.group.kind] ?? {}, f = r(n.group.id, {
|
|
280
|
+
pageSize: n.pageSize,
|
|
281
|
+
client: n.client
|
|
282
|
+
}), p = y("membership.save", n.onError), [m, b] = O(null), [x, S] = O({}), w = (e) => n.renderContent ? n.renderContent(e) : /* @__PURE__ */ A("span", {
|
|
283
283
|
className: "font-mono text-xs break-all",
|
|
284
284
|
children: e.content_id
|
|
285
285
|
}), T = (e) => `${e.content_id}${e.version_id ? ` ${e.version_id}` : ""}`, E = (e) => [...new Map(e.map((e) => [z(e), {
|
|
@@ -292,7 +292,7 @@ function B(a) {
|
|
|
292
292
|
"data-state": e.state ?? "active",
|
|
293
293
|
children: [
|
|
294
294
|
t,
|
|
295
|
-
|
|
295
|
+
d.ordered && e.position !== void 0 && /* @__PURE__ */ A("span", {
|
|
296
296
|
className: "w-8 text-xs text-muted-foreground tabular-nums",
|
|
297
297
|
children: e.position
|
|
298
298
|
}),
|
|
@@ -300,159 +300,159 @@ function B(a) {
|
|
|
300
300
|
className: "min-w-0 flex-1",
|
|
301
301
|
children: w(e)
|
|
302
302
|
}),
|
|
303
|
-
e.version_id && /* @__PURE__ */ A(
|
|
303
|
+
e.version_id && /* @__PURE__ */ A(s, {
|
|
304
304
|
variant: "outline",
|
|
305
|
-
children:
|
|
305
|
+
children: l("memberships.version")
|
|
306
306
|
}),
|
|
307
|
-
e.role && /* @__PURE__ */ A(
|
|
307
|
+
e.role && /* @__PURE__ */ A(s, {
|
|
308
308
|
variant: "secondary",
|
|
309
|
-
children: C(
|
|
309
|
+
children: C(n.labels, e.role)
|
|
310
310
|
}),
|
|
311
|
-
e.state === "proposed" && /* @__PURE__ */ j(k, { children: [/* @__PURE__ */ A(
|
|
311
|
+
e.state === "proposed" && /* @__PURE__ */ j(k, { children: [/* @__PURE__ */ A(s, {
|
|
312
312
|
variant: "secondary",
|
|
313
|
-
children:
|
|
314
|
-
}), /* @__PURE__ */ A(
|
|
313
|
+
children: l("memberships.proposed")
|
|
314
|
+
}), /* @__PURE__ */ A(a, {
|
|
315
315
|
size: "xs",
|
|
316
316
|
variant: "outline",
|
|
317
|
-
disabled:
|
|
318
|
-
onClick: () => void
|
|
317
|
+
disabled: p.pending,
|
|
318
|
+
onClick: () => void p.run(() => f.add([{
|
|
319
319
|
...D(e),
|
|
320
320
|
state: "active"
|
|
321
321
|
}])),
|
|
322
|
-
children:
|
|
322
|
+
children: l("memberships.accept")
|
|
323
323
|
})] }),
|
|
324
|
-
|
|
324
|
+
d.windows && (m === e.id ? /* @__PURE__ */ j("span", {
|
|
325
325
|
className: "flex flex-wrap items-center gap-1",
|
|
326
326
|
children: [
|
|
327
327
|
/* @__PURE__ */ A(R, {
|
|
328
|
-
from:
|
|
329
|
-
until:
|
|
328
|
+
from: x.from,
|
|
329
|
+
until: x.until,
|
|
330
330
|
name: T(e),
|
|
331
331
|
onChange: (e) => S((t) => ({
|
|
332
332
|
from: "active_from" in e ? e.active_from : t.from,
|
|
333
333
|
until: "active_until" in e ? e.active_until : t.until
|
|
334
334
|
}))
|
|
335
335
|
}),
|
|
336
|
-
/* @__PURE__ */ A(
|
|
336
|
+
/* @__PURE__ */ A(a, {
|
|
337
337
|
size: "xs",
|
|
338
|
-
disabled:
|
|
339
|
-
onClick: () => void
|
|
338
|
+
disabled: p.pending,
|
|
339
|
+
onClick: () => void p.run(() => f.add([{
|
|
340
340
|
...D(e),
|
|
341
|
-
active_from:
|
|
342
|
-
active_until:
|
|
343
|
-
}])).then((e) => e !== void 0 &&
|
|
344
|
-
children:
|
|
341
|
+
active_from: x.from,
|
|
342
|
+
active_until: x.until
|
|
343
|
+
}])).then((e) => e !== void 0 && b(null)),
|
|
344
|
+
children: l("common.save")
|
|
345
345
|
}),
|
|
346
|
-
/* @__PURE__ */ A(
|
|
346
|
+
/* @__PURE__ */ A(a, {
|
|
347
347
|
size: "xs",
|
|
348
348
|
variant: "ghost",
|
|
349
|
-
onClick: () =>
|
|
350
|
-
children:
|
|
349
|
+
onClick: () => b(null),
|
|
350
|
+
children: l("common.cancel")
|
|
351
351
|
})
|
|
352
352
|
]
|
|
353
353
|
}) : /* @__PURE__ */ j(k, { children: [/* @__PURE__ */ A("span", {
|
|
354
354
|
className: "text-xs text-muted-foreground",
|
|
355
355
|
"data-ckui": "member-window",
|
|
356
|
-
children: e.active_from || e.active_until ?
|
|
357
|
-
from: e.active_from ?
|
|
358
|
-
until: e.active_until ?
|
|
359
|
-
}) :
|
|
360
|
-
}), /* @__PURE__ */ A(
|
|
356
|
+
children: e.active_from || e.active_until ? l("memberships.window", {
|
|
357
|
+
from: e.active_from ? v(c, e.active_from) : "…",
|
|
358
|
+
until: e.active_until ? v(c, e.active_until) : "…"
|
|
359
|
+
}) : l("memberships.always")
|
|
360
|
+
}), /* @__PURE__ */ A(a, {
|
|
361
361
|
size: "xs",
|
|
362
362
|
variant: "ghost",
|
|
363
363
|
onClick: () => {
|
|
364
364
|
S({
|
|
365
365
|
from: e.active_from,
|
|
366
366
|
until: e.active_until
|
|
367
|
-
}),
|
|
367
|
+
}), b(e.id);
|
|
368
368
|
},
|
|
369
|
-
children:
|
|
369
|
+
children: l("memberships.editWindow")
|
|
370
370
|
})] })),
|
|
371
|
-
|
|
371
|
+
n.onUseCover && !e.version_id && /* @__PURE__ */ A(a, {
|
|
372
372
|
size: "xs",
|
|
373
373
|
variant: "ghost",
|
|
374
|
-
disabled:
|
|
375
|
-
onClick: () => void
|
|
376
|
-
children:
|
|
374
|
+
disabled: p.pending || n.group.cover?.content_id === e.content_id && !n.group.cover?.auto,
|
|
375
|
+
onClick: () => void p.run(() => n.onUseCover(e.content_id)),
|
|
376
|
+
children: l("memberships.useCover")
|
|
377
377
|
}),
|
|
378
|
-
/* @__PURE__ */ A(
|
|
378
|
+
/* @__PURE__ */ A(a, {
|
|
379
379
|
size: "xs",
|
|
380
380
|
variant: "ghost",
|
|
381
|
-
disabled:
|
|
382
|
-
"aria-label":
|
|
383
|
-
onClick: () => void
|
|
384
|
-
children:
|
|
381
|
+
disabled: p.pending,
|
|
382
|
+
"aria-label": l("memberships.remove", { name: T(e) }),
|
|
383
|
+
onClick: () => void p.run(() => f.remove([D(e)])),
|
|
384
|
+
children: l("common.remove")
|
|
385
385
|
})
|
|
386
386
|
]
|
|
387
387
|
});
|
|
388
388
|
return /* @__PURE__ */ j(t, {
|
|
389
|
-
appearance:
|
|
390
|
-
className: M("grid gap-3 text-sm",
|
|
389
|
+
appearance: n.appearance,
|
|
390
|
+
className: M("grid gap-3 text-sm", n.className),
|
|
391
391
|
"data-ckui": "group-members",
|
|
392
392
|
children: [
|
|
393
393
|
/* @__PURE__ */ A("h3", {
|
|
394
394
|
className: "font-medium",
|
|
395
|
-
children:
|
|
395
|
+
children: l("memberships.members")
|
|
396
396
|
}),
|
|
397
|
-
|
|
397
|
+
f.loading && !f.items.length ? /* @__PURE__ */ A(h, { className: "h-20 w-full" }) : f.error && !f.items.length ? /* @__PURE__ */ j("div", {
|
|
398
398
|
role: "alert",
|
|
399
399
|
className: "grid justify-items-start gap-2",
|
|
400
400
|
children: [/* @__PURE__ */ A("p", {
|
|
401
401
|
className: "text-destructive",
|
|
402
|
-
children:
|
|
403
|
-
}), /* @__PURE__ */ A(
|
|
402
|
+
children: _(c, f.error)
|
|
403
|
+
}), /* @__PURE__ */ A(a, {
|
|
404
404
|
size: "sm",
|
|
405
405
|
variant: "outline",
|
|
406
|
-
onClick:
|
|
407
|
-
children:
|
|
406
|
+
onClick: f.reload,
|
|
407
|
+
children: l("common.retry")
|
|
408
408
|
})]
|
|
409
|
-
}) :
|
|
410
|
-
items:
|
|
409
|
+
}) : f.items.length ? d.ordered ? /* @__PURE__ */ A(o, {
|
|
410
|
+
items: f.items,
|
|
411
411
|
id: (e) => e.id,
|
|
412
412
|
name: T,
|
|
413
|
-
label:
|
|
414
|
-
disabled:
|
|
413
|
+
label: l("memberships.members"),
|
|
414
|
+
disabled: p.pending,
|
|
415
415
|
onMove: (e, t) => {
|
|
416
|
-
let n = [...
|
|
417
|
-
n.splice(t, 0, r),
|
|
416
|
+
let n = [...f.items], [r] = n.splice(e, 1);
|
|
417
|
+
n.splice(t, 0, r), p.run(() => f.reorder(E(n)));
|
|
418
418
|
},
|
|
419
419
|
children: (e, t) => N(e, t)
|
|
420
420
|
}) : /* @__PURE__ */ A("ul", {
|
|
421
421
|
className: "grid divide-y divide-border rounded-lg border border-border",
|
|
422
|
-
children:
|
|
422
|
+
children: f.items.map((e) => /* @__PURE__ */ A("li", {
|
|
423
423
|
className: "p-2",
|
|
424
424
|
children: N(e)
|
|
425
425
|
}, e.id))
|
|
426
426
|
}) : /* @__PURE__ */ A("p", {
|
|
427
427
|
className: "text-muted-foreground",
|
|
428
|
-
children:
|
|
428
|
+
children: l("memberships.noMembers")
|
|
429
429
|
}),
|
|
430
|
-
|
|
430
|
+
f.hasMore && /* @__PURE__ */ A(a, {
|
|
431
431
|
variant: "outline",
|
|
432
432
|
size: "sm",
|
|
433
433
|
className: "justify-self-center",
|
|
434
|
-
disabled:
|
|
435
|
-
onClick: () => void
|
|
436
|
-
children:
|
|
434
|
+
disabled: f.loadingMore,
|
|
435
|
+
onClick: () => void f.loadMore(),
|
|
436
|
+
children: l("groups.loadMore")
|
|
437
437
|
}),
|
|
438
438
|
/* @__PURE__ */ A(H, {
|
|
439
|
-
spec:
|
|
440
|
-
labels:
|
|
441
|
-
onAdd: (e) =>
|
|
439
|
+
spec: d,
|
|
440
|
+
labels: n.labels,
|
|
441
|
+
onAdd: (e) => p.run(() => f.add([e]))
|
|
442
442
|
}),
|
|
443
|
-
/* @__PURE__ */ A(
|
|
443
|
+
/* @__PURE__ */ A(g, { error: p.error })
|
|
444
444
|
]
|
|
445
445
|
});
|
|
446
446
|
}
|
|
447
447
|
var V = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
448
|
-
function H({ spec: t, labels:
|
|
449
|
-
let { t:
|
|
448
|
+
function H({ spec: t, labels: n, onAdd: r }) {
|
|
449
|
+
let { t: i } = e(), o = T(), [s, h] = O(""), [g, _] = O(""), [v, y] = O(""), [b, x] = O(), [S, w] = O(), E = V.test(s.trim()) && (!g.trim() || V.test(g.trim()));
|
|
450
450
|
return /* @__PURE__ */ j("form", {
|
|
451
451
|
className: "flex flex-wrap items-end gap-2",
|
|
452
452
|
"data-ckui": "add-member",
|
|
453
453
|
onSubmit: (e) => {
|
|
454
|
-
e.preventDefault(), E &&
|
|
455
|
-
content_id:
|
|
454
|
+
e.preventDefault(), E && r({
|
|
455
|
+
content_id: s.trim(),
|
|
456
456
|
version_id: g.trim() || void 0,
|
|
457
457
|
role: v || void 0,
|
|
458
458
|
active_from: b,
|
|
@@ -464,59 +464,59 @@ function H({ spec: t, labels: r, onAdd: i }) {
|
|
|
464
464
|
children: [
|
|
465
465
|
/* @__PURE__ */ j("div", {
|
|
466
466
|
className: "grid gap-1",
|
|
467
|
-
children: [/* @__PURE__ */ A(
|
|
468
|
-
htmlFor: `${
|
|
467
|
+
children: [/* @__PURE__ */ A(l, {
|
|
468
|
+
htmlFor: `${o}-c`,
|
|
469
469
|
className: "text-xs text-muted-foreground",
|
|
470
|
-
children:
|
|
471
|
-
}), /* @__PURE__ */ A(
|
|
472
|
-
id: `${
|
|
470
|
+
children: i("memberships.contentId")
|
|
471
|
+
}), /* @__PURE__ */ A(c, {
|
|
472
|
+
id: `${o}-c`,
|
|
473
473
|
className: "h-8 w-80 max-w-full font-mono",
|
|
474
|
-
value:
|
|
474
|
+
value: s,
|
|
475
475
|
onChange: (e) => h(e.target.value)
|
|
476
476
|
})]
|
|
477
477
|
}),
|
|
478
478
|
t.version_level && /* @__PURE__ */ j("div", {
|
|
479
479
|
className: "grid gap-1",
|
|
480
|
-
children: [/* @__PURE__ */ A(
|
|
481
|
-
htmlFor: `${
|
|
480
|
+
children: [/* @__PURE__ */ A(l, {
|
|
481
|
+
htmlFor: `${o}-v`,
|
|
482
482
|
className: "text-xs text-muted-foreground",
|
|
483
|
-
children:
|
|
484
|
-
}), /* @__PURE__ */ A(
|
|
485
|
-
id: `${
|
|
483
|
+
children: i("memberships.versionId")
|
|
484
|
+
}), /* @__PURE__ */ A(c, {
|
|
485
|
+
id: `${o}-v`,
|
|
486
486
|
className: "h-8 w-80 max-w-full font-mono",
|
|
487
487
|
value: g,
|
|
488
488
|
onChange: (e) => _(e.target.value)
|
|
489
489
|
})]
|
|
490
490
|
}),
|
|
491
|
-
!!t.roles?.length && /* @__PURE__ */ j(
|
|
491
|
+
!!t.roles?.length && /* @__PURE__ */ j(u, {
|
|
492
492
|
value: v || N,
|
|
493
493
|
onValueChange: (e) => y(e === N ? "" : String(e)),
|
|
494
|
-
children: [/* @__PURE__ */ A(
|
|
494
|
+
children: [/* @__PURE__ */ A(p, {
|
|
495
495
|
size: "sm",
|
|
496
|
-
"aria-label":
|
|
497
|
-
children: /* @__PURE__ */ A(
|
|
498
|
-
}), /* @__PURE__ */ j(
|
|
496
|
+
"aria-label": i("memberships.role"),
|
|
497
|
+
children: /* @__PURE__ */ A(m, { children: (e) => e === N ? i("memberships.noRole") : C(n, e) })
|
|
498
|
+
}), /* @__PURE__ */ j(d, { children: [/* @__PURE__ */ A(f, {
|
|
499
499
|
value: N,
|
|
500
|
-
children:
|
|
501
|
-
}), t.roles.map((e) => /* @__PURE__ */ A(
|
|
500
|
+
children: i("memberships.noRole")
|
|
501
|
+
}), t.roles.map((e) => /* @__PURE__ */ A(f, {
|
|
502
502
|
value: e,
|
|
503
|
-
children: C(
|
|
503
|
+
children: C(n, e)
|
|
504
504
|
}, e))] })]
|
|
505
505
|
}),
|
|
506
506
|
t.windows && /* @__PURE__ */ A(R, {
|
|
507
507
|
from: b,
|
|
508
508
|
until: S,
|
|
509
|
-
name:
|
|
509
|
+
name: i("memberships.newMember"),
|
|
510
510
|
onChange: (e) => {
|
|
511
511
|
"active_from" in e && x(e.active_from), "active_until" in e && w(e.active_until);
|
|
512
512
|
}
|
|
513
513
|
}),
|
|
514
|
-
/* @__PURE__ */ A(
|
|
514
|
+
/* @__PURE__ */ A(a, {
|
|
515
515
|
type: "submit",
|
|
516
516
|
size: "sm",
|
|
517
517
|
variant: "outline",
|
|
518
518
|
disabled: !E,
|
|
519
|
-
children:
|
|
519
|
+
children: i("memberships.addMember")
|
|
520
520
|
})
|
|
521
521
|
]
|
|
522
522
|
});
|