@openrails/contentkit-ui 0.85.1 → 0.86.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -4
- 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/generated/error-codes.js +1 -1
- package/dist/client/generated/error-codes.js.map +1 -1
- package/dist/client/generated/routes.d.ts +14 -1
- package/dist/client/generated/routes.js +17 -1
- package/dist/client/generated/routes.js.map +1 -1
- package/dist/client/generated/wire.d.ts +29 -0
- 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/stats.d.ts +32 -0
- package/dist/client/stats.js +35 -0
- package/dist/client/stats.js.map +1 -0
- 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.js +42 -42
- package/dist/components/content/card.js.map +1 -1
- package/dist/components/content/editors.js +455 -427
- package/dist/components/content/editors.js.map +1 -1
- package/dist/components/content/grid.js +47 -47
- package/dist/components/content/index.d.ts +2 -1
- package/dist/components/content/listing.js +34 -34
- package/dist/components/content/listing.js.map +1 -1
- package/dist/components/content/paywall.d.ts +17 -5
- package/dist/components/content/paywall.js +115 -100
- package/dist/components/content/paywall.js.map +1 -1
- package/dist/components/content/reader-stats.d.ts +12 -0
- package/dist/components/content/reader-stats.js +47 -0
- package/dist/components/content/reader-stats.js.map +1 -0
- package/dist/components/groups/banner.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/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/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 +12 -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 +1 -0
- package/dist/locales/de.js.map +1 -1
- package/dist/locales/en.d.ts +34 -0
- 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/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/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/contents.js +144 -144
- package/dist/react/contents.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/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 +4 -2
- 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.js +20 -20
- package/dist/react.js +26 -24
- package/dist/styles.css +1 -1
- package/dist/urls/index.d.ts +35 -10
- package/dist/urls.js +100 -70
- package/dist/urls.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { toContentKitError as e } from "../../client/errors.js";
|
|
2
|
-
import {
|
|
3
|
-
import { ContentKitUiRoot as
|
|
4
|
-
import { useContentKitClient as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import { GroupPicker as
|
|
2
|
+
import { useLanguageName as t, useMessages as n } from "../../i18n/context.js";
|
|
3
|
+
import { ContentKitUiRoot as r } from "../../scope.js";
|
|
4
|
+
import { useContentKitClient as i } from "../../react/context.js";
|
|
5
|
+
import { useGroup as a, useKinds as o } from "../../react/groups.js";
|
|
6
|
+
import { Button as s } from "../../ui/button.js";
|
|
7
|
+
import { Dialog as c, DialogContent as l, DialogDescription as u, DialogFooter as d, DialogHeader as f, DialogTitle as p } from "../../ui/dialog.js";
|
|
8
|
+
import { Badge as m } from "../../ui/badge.js";
|
|
9
|
+
import { Input as h } from "../../ui/input.js";
|
|
10
|
+
import { Label as g } from "../../ui/label.js";
|
|
11
|
+
import { Select as _, SelectContent as v, SelectItem as y, SelectTrigger as b, SelectValue as x } from "../../ui/select.js";
|
|
12
|
+
import { Skeleton as S } from "../../ui/skeleton.js";
|
|
13
|
+
import { Textarea as C } from "../../ui/textarea.js";
|
|
14
|
+
import { ErrorLine as w, contentError as T, useAction as E } from "../social/parts.js";
|
|
15
|
+
import { parseAttributes as D, slugify as O } from "../../client/group-fields.js";
|
|
16
|
+
import { GroupPicker as k, labelOf as A, useGroupNames as j } from "./parts.js";
|
|
17
17
|
import { OfferFields as M } from "../content/offer-fields.js";
|
|
18
18
|
import { AttributeFields as N, formOf as P } from "./fields.js";
|
|
19
19
|
import { GroupImageEditor as F } from "./banner.js";
|
|
@@ -22,45 +22,45 @@ import { Fragment as V, jsx as H, jsxs as U } from "react/jsx-runtime";
|
|
|
22
22
|
import { cn as W } from "cn";
|
|
23
23
|
//#region src/components/groups/editor.tsx
|
|
24
24
|
function G(e) {
|
|
25
|
-
let { t
|
|
25
|
+
let { t } = n(), { kinds: i, loading: c } = o({ client: e.client }), l = a(e.id, { client: e.client }), u = e.languages ?? i?.languages ?? ["en"], d = l.group?.kind ?? e.kind, f = i?.group_kinds?.[d] ?? {}, p = (t) => /* @__PURE__ */ H(r, {
|
|
26
26
|
appearance: e.appearance,
|
|
27
27
|
className: W("grid gap-6 text-sm", e.className),
|
|
28
28
|
"data-ckui": "group-editor",
|
|
29
|
-
"data-kind":
|
|
29
|
+
"data-kind": d,
|
|
30
30
|
children: t
|
|
31
31
|
});
|
|
32
|
-
if (
|
|
33
|
-
if (!e.id && !
|
|
32
|
+
if (c) return p(/* @__PURE__ */ H(S, { className: "h-40 w-full" }));
|
|
33
|
+
if (!e.id && !l.group && !l.loading) return p(/* @__PURE__ */ H(Q, {
|
|
34
34
|
...e,
|
|
35
|
-
kind:
|
|
36
|
-
spec:
|
|
37
|
-
languages:
|
|
38
|
-
g:
|
|
35
|
+
kind: d,
|
|
36
|
+
spec: f,
|
|
37
|
+
languages: u,
|
|
38
|
+
g: l
|
|
39
39
|
}));
|
|
40
|
-
if (
|
|
41
|
-
group:
|
|
42
|
-
onRestore: () =>
|
|
40
|
+
if (l.deleted) return p(/* @__PURE__ */ H(J, {
|
|
41
|
+
group: l.deleted,
|
|
42
|
+
onRestore: () => l.restore(),
|
|
43
43
|
onError: e.onError,
|
|
44
|
-
name:
|
|
44
|
+
name: l.deleted.slug
|
|
45
45
|
}));
|
|
46
|
-
if (!
|
|
46
|
+
if (!l.group) return l.error ? p(/* @__PURE__ */ U("div", {
|
|
47
47
|
role: "alert",
|
|
48
48
|
className: "grid justify-items-start gap-2",
|
|
49
49
|
children: [/* @__PURE__ */ H("p", {
|
|
50
50
|
className: "text-destructive",
|
|
51
|
-
children:
|
|
52
|
-
}), /* @__PURE__ */ H(
|
|
51
|
+
children: t("groupEditor.loadFailed")
|
|
52
|
+
}), /* @__PURE__ */ H(s, {
|
|
53
53
|
size: "sm",
|
|
54
54
|
variant: "outline",
|
|
55
|
-
onClick:
|
|
56
|
-
children:
|
|
55
|
+
onClick: l.reload,
|
|
56
|
+
children: t("common.retry")
|
|
57
57
|
})]
|
|
58
|
-
})) :
|
|
59
|
-
let
|
|
60
|
-
return
|
|
58
|
+
})) : p(/* @__PURE__ */ H(S, { className: "h-40 w-full" }));
|
|
59
|
+
let m = l.group;
|
|
60
|
+
return p(/* @__PURE__ */ U(V, { children: [
|
|
61
61
|
/* @__PURE__ */ H(Y, {
|
|
62
|
-
group:
|
|
63
|
-
g:
|
|
62
|
+
group: m,
|
|
63
|
+
g: l,
|
|
64
64
|
labels: e.labels,
|
|
65
65
|
onMerged: e.onMerged,
|
|
66
66
|
onDeleted: e.onDeleted,
|
|
@@ -68,45 +68,45 @@ function G(e) {
|
|
|
68
68
|
client: e.client
|
|
69
69
|
}),
|
|
70
70
|
/* @__PURE__ */ H($, {
|
|
71
|
-
group:
|
|
72
|
-
spec:
|
|
73
|
-
g:
|
|
71
|
+
group: m,
|
|
72
|
+
spec: f,
|
|
73
|
+
g: l,
|
|
74
74
|
labels: e.labels,
|
|
75
75
|
onError: e.onError,
|
|
76
76
|
client: e.client
|
|
77
|
-
},
|
|
77
|
+
}, m.id),
|
|
78
78
|
/* @__PURE__ */ H(ee, {
|
|
79
|
-
group:
|
|
80
|
-
g:
|
|
81
|
-
languages:
|
|
79
|
+
group: m,
|
|
80
|
+
g: l,
|
|
81
|
+
languages: u,
|
|
82
82
|
onError: e.onError
|
|
83
83
|
}),
|
|
84
84
|
/* @__PURE__ */ H(te, {
|
|
85
|
-
group:
|
|
86
|
-
g:
|
|
87
|
-
languages:
|
|
85
|
+
group: m,
|
|
86
|
+
g: l,
|
|
87
|
+
languages: u,
|
|
88
88
|
onError: e.onError
|
|
89
|
-
},
|
|
89
|
+
}, m.id),
|
|
90
90
|
/* @__PURE__ */ H(ne, {
|
|
91
|
-
group:
|
|
92
|
-
spec:
|
|
91
|
+
group: m,
|
|
92
|
+
spec: f,
|
|
93
93
|
onError: e.onError,
|
|
94
94
|
client: e.client
|
|
95
95
|
}),
|
|
96
|
-
|
|
97
|
-
group:
|
|
96
|
+
f.sellable && /* @__PURE__ */ H(re, {
|
|
97
|
+
group: m,
|
|
98
98
|
onError: e.onError,
|
|
99
99
|
client: e.client
|
|
100
100
|
}),
|
|
101
101
|
/* @__PURE__ */ H(ae, {
|
|
102
|
-
group:
|
|
103
|
-
g:
|
|
104
|
-
kinds:
|
|
102
|
+
group: m,
|
|
103
|
+
g: l,
|
|
104
|
+
kinds: i,
|
|
105
105
|
labels: e.labels,
|
|
106
106
|
onError: e.onError,
|
|
107
107
|
client: e.client
|
|
108
108
|
}),
|
|
109
|
-
e.children?.(
|
|
109
|
+
e.children?.(m)
|
|
110
110
|
] }));
|
|
111
111
|
}
|
|
112
112
|
function K(e, t) {
|
|
@@ -136,27 +136,27 @@ function q({ title: e, children: t, ckui: n, action: r }) {
|
|
|
136
136
|
}), t]
|
|
137
137
|
});
|
|
138
138
|
}
|
|
139
|
-
function J({ group: e, name:
|
|
140
|
-
let { t:
|
|
139
|
+
function J({ group: e, name: t, onRestore: r, onError: i }) {
|
|
140
|
+
let { t: a } = n(), o = E("group.save", i);
|
|
141
141
|
return /* @__PURE__ */ U("div", {
|
|
142
142
|
className: "grid justify-items-start gap-2",
|
|
143
143
|
"data-ckui": "group-deleted",
|
|
144
144
|
"data-state": e.state,
|
|
145
145
|
children: [
|
|
146
|
-
/* @__PURE__ */ H("p", { children:
|
|
147
|
-
/* @__PURE__ */ H(
|
|
146
|
+
/* @__PURE__ */ H("p", { children: a("groupEditor.deletedNotice", { name: t }) }),
|
|
147
|
+
/* @__PURE__ */ H(s, {
|
|
148
148
|
size: "sm",
|
|
149
149
|
variant: "outline",
|
|
150
|
-
disabled:
|
|
151
|
-
onClick: () => void
|
|
152
|
-
children:
|
|
150
|
+
disabled: o.pending,
|
|
151
|
+
onClick: () => void o.run(r),
|
|
152
|
+
children: a("groupEditor.restore")
|
|
153
153
|
}),
|
|
154
|
-
/* @__PURE__ */ H(
|
|
154
|
+
/* @__PURE__ */ H(w, { error: o.error })
|
|
155
155
|
]
|
|
156
156
|
});
|
|
157
157
|
}
|
|
158
|
-
function Y({ group: e, g:
|
|
159
|
-
let { t: g } =
|
|
158
|
+
function Y({ group: e, g: t, labels: r, onMerged: i, onDeleted: a, onError: o, client: h }) {
|
|
159
|
+
let { t: g } = n(), [_, v] = B(!1), [y, b] = B(!1), x = E("group.save", o);
|
|
160
160
|
return /* @__PURE__ */ U("div", {
|
|
161
161
|
className: "flex flex-wrap items-center gap-2",
|
|
162
162
|
"data-ckui": "group-head",
|
|
@@ -165,27 +165,27 @@ function Y({ group: e, g: n, labels: r, onMerged: f, onDeleted: p, onError: m, c
|
|
|
165
165
|
className: "text-base font-semibold break-words",
|
|
166
166
|
children: e.name || e.slug
|
|
167
167
|
}),
|
|
168
|
-
/* @__PURE__ */ H(
|
|
168
|
+
/* @__PURE__ */ H(m, {
|
|
169
169
|
variant: "outline",
|
|
170
|
-
children:
|
|
170
|
+
children: A(r, e.kind)
|
|
171
171
|
}),
|
|
172
172
|
/* @__PURE__ */ U("div", {
|
|
173
173
|
className: "ms-auto flex flex-wrap gap-2",
|
|
174
|
-
children: [/* @__PURE__ */ H(
|
|
174
|
+
children: [/* @__PURE__ */ H(s, {
|
|
175
175
|
size: "sm",
|
|
176
176
|
variant: "outline",
|
|
177
177
|
onClick: () => v(!0),
|
|
178
178
|
children: g("groupEditor.merge")
|
|
179
|
-
}), /* @__PURE__ */ H(
|
|
179
|
+
}), /* @__PURE__ */ H(s, {
|
|
180
180
|
size: "sm",
|
|
181
181
|
variant: "destructive",
|
|
182
|
-
disabled:
|
|
182
|
+
disabled: x.pending,
|
|
183
183
|
onClick: () => b(!0),
|
|
184
184
|
children: g("groupEditor.delete")
|
|
185
185
|
})]
|
|
186
186
|
}),
|
|
187
|
-
/* @__PURE__ */ H(
|
|
188
|
-
error:
|
|
187
|
+
/* @__PURE__ */ H(w, {
|
|
188
|
+
error: x.error,
|
|
189
189
|
className: "basis-full"
|
|
190
190
|
}),
|
|
191
191
|
/* @__PURE__ */ H(X, {
|
|
@@ -194,24 +194,24 @@ function Y({ group: e, g: n, labels: r, onMerged: f, onDeleted: p, onError: m, c
|
|
|
194
194
|
group: e,
|
|
195
195
|
client: h,
|
|
196
196
|
onMerge: async (e) => {
|
|
197
|
-
let
|
|
198
|
-
return
|
|
197
|
+
let n = await t.merge(e.id);
|
|
198
|
+
return i?.(n), n;
|
|
199
199
|
}
|
|
200
200
|
}),
|
|
201
|
-
/* @__PURE__ */ H(
|
|
201
|
+
/* @__PURE__ */ H(c, {
|
|
202
202
|
open: y,
|
|
203
203
|
onOpenChange: b,
|
|
204
|
-
children: /* @__PURE__ */ U(
|
|
204
|
+
children: /* @__PURE__ */ U(l, {
|
|
205
205
|
"data-ckui": "group-delete-dialog",
|
|
206
|
-
children: [/* @__PURE__ */ U(
|
|
206
|
+
children: [/* @__PURE__ */ U(f, { children: [/* @__PURE__ */ H(p, { children: g("groupEditor.deleteTitle", { name: e.name || e.slug }) }), /* @__PURE__ */ H(u, { children: g("groupEditor.deleteBody") })] }), /* @__PURE__ */ U(d, { children: [/* @__PURE__ */ H(s, {
|
|
207
207
|
variant: "outline",
|
|
208
208
|
onClick: () => b(!1),
|
|
209
209
|
children: g("common.cancel")
|
|
210
|
-
}), /* @__PURE__ */ H(
|
|
210
|
+
}), /* @__PURE__ */ H(s, {
|
|
211
211
|
variant: "destructive",
|
|
212
|
-
disabled:
|
|
212
|
+
disabled: x.pending,
|
|
213
213
|
onClick: () => {
|
|
214
|
-
b(!1),
|
|
214
|
+
b(!1), x.run(t.remove).then((e) => e && a?.(e));
|
|
215
215
|
},
|
|
216
216
|
children: g("groupEditor.delete")
|
|
217
217
|
})] })]
|
|
@@ -220,62 +220,62 @@ function Y({ group: e, g: n, labels: r, onMerged: f, onDeleted: p, onError: m, c
|
|
|
220
220
|
]
|
|
221
221
|
});
|
|
222
222
|
}
|
|
223
|
-
function X({ open:
|
|
224
|
-
let _ =
|
|
223
|
+
function X({ open: t, onOpenChange: r, group: i, onMerge: a, language: o, client: m }) {
|
|
224
|
+
let _ = n(), { t: v } = _, y = R(), [b, x] = B(null), [S, C] = B(""), [E, D] = B(!1), [O, A] = B(null);
|
|
225
225
|
L(() => {
|
|
226
|
-
|
|
227
|
-
}, [
|
|
228
|
-
let j = v("groupEditor.mergeWord"), M = !!b &&
|
|
229
|
-
return /* @__PURE__ */ H(
|
|
230
|
-
open:
|
|
226
|
+
t && (x(null), C(""), A(null));
|
|
227
|
+
}, [t]);
|
|
228
|
+
let j = v("groupEditor.mergeWord"), M = !!b && S.trim().toLowerCase() === j.toLowerCase(), N = i.name || i.slug;
|
|
229
|
+
return /* @__PURE__ */ H(c, {
|
|
230
|
+
open: t,
|
|
231
231
|
onOpenChange: r,
|
|
232
|
-
children: /* @__PURE__ */ U(
|
|
232
|
+
children: /* @__PURE__ */ U(l, {
|
|
233
233
|
"data-ckui": "group-merge-dialog",
|
|
234
234
|
children: [
|
|
235
|
-
/* @__PURE__ */ U(
|
|
235
|
+
/* @__PURE__ */ U(f, { children: [/* @__PURE__ */ H(p, { children: v("groupEditor.mergeTitle", { name: N }) }), /* @__PURE__ */ H(u, { children: v("groupEditor.mergeBody") })] }),
|
|
236
236
|
b ? /* @__PURE__ */ U("div", {
|
|
237
237
|
className: "flex flex-wrap items-center gap-2",
|
|
238
238
|
"data-ckui": "merge-target",
|
|
239
|
-
children: [/* @__PURE__ */ H("span", { children: v("groupEditor.mergeInto", { name: b.name || b.slug }) }), /* @__PURE__ */ H(
|
|
239
|
+
children: [/* @__PURE__ */ H("span", { children: v("groupEditor.mergeInto", { name: b.name || b.slug }) }), /* @__PURE__ */ H(s, {
|
|
240
240
|
size: "xs",
|
|
241
241
|
variant: "ghost",
|
|
242
|
-
onClick: () =>
|
|
242
|
+
onClick: () => x(null),
|
|
243
243
|
children: v("groupEditor.change")
|
|
244
244
|
})]
|
|
245
|
-
}) : /* @__PURE__ */ H(
|
|
246
|
-
kind:
|
|
247
|
-
language:
|
|
248
|
-
exclude: [
|
|
245
|
+
}) : /* @__PURE__ */ H(k, {
|
|
246
|
+
kind: i.kind,
|
|
247
|
+
language: o,
|
|
248
|
+
exclude: [i.id],
|
|
249
249
|
label: v("groupEditor.mergeTarget"),
|
|
250
|
-
onPick:
|
|
251
|
-
client:
|
|
250
|
+
onPick: x,
|
|
251
|
+
client: m,
|
|
252
252
|
autoFocus: !0
|
|
253
253
|
}),
|
|
254
254
|
/* @__PURE__ */ U("div", {
|
|
255
255
|
className: "grid gap-1.5",
|
|
256
|
-
children: [/* @__PURE__ */ H(
|
|
256
|
+
children: [/* @__PURE__ */ H(g, {
|
|
257
257
|
htmlFor: `${y}-typed`,
|
|
258
258
|
children: v("admin.typeToConfirm", { word: j })
|
|
259
|
-
}), /* @__PURE__ */ H(
|
|
259
|
+
}), /* @__PURE__ */ H(h, {
|
|
260
260
|
id: `${y}-typed`,
|
|
261
|
-
value:
|
|
261
|
+
value: S,
|
|
262
262
|
autoComplete: "off",
|
|
263
|
-
onChange: (e) =>
|
|
263
|
+
onChange: (e) => C(e.target.value)
|
|
264
264
|
})]
|
|
265
265
|
}),
|
|
266
|
-
|
|
267
|
-
/* @__PURE__ */ U(
|
|
266
|
+
O && /* @__PURE__ */ H(w, { children: T(_, O) }),
|
|
267
|
+
/* @__PURE__ */ U(d, { children: [/* @__PURE__ */ H(s, {
|
|
268
268
|
variant: "outline",
|
|
269
269
|
onClick: () => r(!1),
|
|
270
270
|
children: v("common.cancel")
|
|
271
|
-
}), /* @__PURE__ */ H(
|
|
271
|
+
}), /* @__PURE__ */ H(s, {
|
|
272
272
|
variant: "destructive",
|
|
273
273
|
disabled: !M || E,
|
|
274
274
|
onClick: async () => {
|
|
275
275
|
if (b) {
|
|
276
276
|
D(!0), A(null);
|
|
277
277
|
try {
|
|
278
|
-
await
|
|
278
|
+
await a(b), r(!1);
|
|
279
279
|
} catch (t) {
|
|
280
280
|
A(e(t));
|
|
281
281
|
} finally {
|
|
@@ -289,14 +289,14 @@ function X({ open: n, onOpenChange: r, group: d, onMerge: m, language: h, client
|
|
|
289
289
|
})
|
|
290
290
|
});
|
|
291
291
|
}
|
|
292
|
-
function Z({ label: e, kind:
|
|
293
|
-
let { t: l } =
|
|
292
|
+
function Z({ label: e, kind: t, value: r, onChange: i, exclude: a, required: o, client: c }) {
|
|
293
|
+
let { t: l } = n();
|
|
294
294
|
return /* @__PURE__ */ U("div", {
|
|
295
295
|
className: "grid gap-1.5",
|
|
296
296
|
"data-ckui": "group-field",
|
|
297
297
|
children: [/* @__PURE__ */ U("span", {
|
|
298
298
|
className: "text-sm font-medium",
|
|
299
|
-
children: [e,
|
|
299
|
+
children: [e, o && /* @__PURE__ */ H("span", {
|
|
300
300
|
"aria-hidden": !0,
|
|
301
301
|
children: " *"
|
|
302
302
|
})]
|
|
@@ -306,50 +306,50 @@ function Z({ label: e, kind: n, value: r, onChange: a, exclude: o, required: s,
|
|
|
306
306
|
className: "rounded-md border border-border px-2 py-0.5",
|
|
307
307
|
"data-ckui": "group-field-value",
|
|
308
308
|
children: r.name || r.slug
|
|
309
|
-
}), /* @__PURE__ */ H(
|
|
309
|
+
}), /* @__PURE__ */ H(s, {
|
|
310
310
|
type: "button",
|
|
311
311
|
size: "xs",
|
|
312
312
|
variant: "ghost",
|
|
313
|
-
onClick: () =>
|
|
313
|
+
onClick: () => i(null),
|
|
314
314
|
"aria-label": l("groupEditor.clearField", { field: e }),
|
|
315
|
-
children: l(
|
|
315
|
+
children: l(o ? "groupEditor.change" : "common.remove")
|
|
316
316
|
})]
|
|
317
|
-
}) : /* @__PURE__ */ H(
|
|
318
|
-
kind:
|
|
317
|
+
}) : /* @__PURE__ */ H(k, {
|
|
318
|
+
kind: t,
|
|
319
319
|
label: e,
|
|
320
|
-
exclude:
|
|
321
|
-
onPick:
|
|
320
|
+
exclude: a,
|
|
321
|
+
onPick: i,
|
|
322
322
|
client: c
|
|
323
323
|
})]
|
|
324
324
|
});
|
|
325
325
|
}
|
|
326
|
-
function Q({ kind: e, spec:
|
|
327
|
-
let
|
|
326
|
+
function Q({ kind: e, spec: r, languages: i, labels: a, g: o, onCreated: c, onError: l, client: u }) {
|
|
327
|
+
let d = n(), { t: f } = d, p = R(), m = t(), [_, v] = B({}), [y, b] = B(""), [x, S] = B(!1), [C, k] = B(null), [j, M] = B(null), F = r.attributes ?? {}, [I, z] = B(() => P(F, {})), [V, W] = B(null), G = E("group.save", l), K = _[i[0]] ?? "";
|
|
328
328
|
L(() => {
|
|
329
|
-
|
|
330
|
-
}, [K,
|
|
329
|
+
x || b(O(K));
|
|
330
|
+
}, [K, x]);
|
|
331
331
|
let q = async () => {
|
|
332
332
|
W(null);
|
|
333
333
|
let t;
|
|
334
334
|
try {
|
|
335
|
-
t =
|
|
335
|
+
t = D(F, I);
|
|
336
336
|
} catch (e) {
|
|
337
337
|
W(e.message);
|
|
338
338
|
return;
|
|
339
339
|
}
|
|
340
|
-
let n =
|
|
340
|
+
let n = i.filter((e) => _[e]?.trim()).map((e) => ({
|
|
341
341
|
language: e,
|
|
342
342
|
kind: "name",
|
|
343
|
-
name:
|
|
344
|
-
})),
|
|
343
|
+
name: _[e].trim()
|
|
344
|
+
})), r = await G.run(() => o.create({
|
|
345
345
|
kind: e,
|
|
346
|
-
slug:
|
|
346
|
+
slug: y.trim(),
|
|
347
347
|
names: n,
|
|
348
|
-
parent_id:
|
|
349
|
-
scope_id:
|
|
348
|
+
parent_id: C?.id,
|
|
349
|
+
scope_id: j?.id,
|
|
350
350
|
attributes: Object.keys(t).length ? t : void 0
|
|
351
351
|
}));
|
|
352
|
-
|
|
352
|
+
r && c?.(r);
|
|
353
353
|
};
|
|
354
354
|
return /* @__PURE__ */ U("form", {
|
|
355
355
|
className: "grid gap-4",
|
|
@@ -360,20 +360,20 @@ function Q({ kind: e, spec: n, languages: r, labels: a, g: o, onCreated: s, onEr
|
|
|
360
360
|
children: [
|
|
361
361
|
/* @__PURE__ */ H("h2", {
|
|
362
362
|
className: "text-base font-semibold",
|
|
363
|
-
children:
|
|
363
|
+
children: f("groupEditor.newTitle", { kind: A(a, e) })
|
|
364
364
|
}),
|
|
365
|
-
|
|
365
|
+
i.map((e, t) => /* @__PURE__ */ U("div", {
|
|
366
366
|
className: "grid gap-1.5",
|
|
367
|
-
children: [/* @__PURE__ */ H(
|
|
368
|
-
htmlFor: `${
|
|
369
|
-
children:
|
|
370
|
-
}), /* @__PURE__ */ H(
|
|
371
|
-
id: `${
|
|
367
|
+
children: [/* @__PURE__ */ H(g, {
|
|
368
|
+
htmlFor: `${p}-${e}`,
|
|
369
|
+
children: f("groupEditor.nameIn", { language: m(e) })
|
|
370
|
+
}), /* @__PURE__ */ H(h, {
|
|
371
|
+
id: `${p}-${e}`,
|
|
372
372
|
className: "h-8",
|
|
373
373
|
lang: e,
|
|
374
374
|
required: t === 0,
|
|
375
|
-
value:
|
|
376
|
-
onChange: (t) =>
|
|
375
|
+
value: _[e] ?? "",
|
|
376
|
+
onChange: (t) => v((n) => ({
|
|
377
377
|
...n,
|
|
378
378
|
[e]: t.target.value
|
|
379
379
|
}))
|
|
@@ -381,33 +381,33 @@ function Q({ kind: e, spec: n, languages: r, labels: a, g: o, onCreated: s, onEr
|
|
|
381
381
|
}, e)),
|
|
382
382
|
/* @__PURE__ */ U("div", {
|
|
383
383
|
className: "grid gap-1.5",
|
|
384
|
-
children: [/* @__PURE__ */ H(
|
|
385
|
-
htmlFor: `${
|
|
386
|
-
children:
|
|
387
|
-
}), /* @__PURE__ */ H(
|
|
388
|
-
id: `${
|
|
384
|
+
children: [/* @__PURE__ */ H(g, {
|
|
385
|
+
htmlFor: `${p}-slug`,
|
|
386
|
+
children: f("groupEditor.slug")
|
|
387
|
+
}), /* @__PURE__ */ H(h, {
|
|
388
|
+
id: `${p}-slug`,
|
|
389
389
|
className: "h-8",
|
|
390
390
|
required: !0,
|
|
391
|
-
value:
|
|
391
|
+
value: y,
|
|
392
392
|
onChange: (e) => {
|
|
393
|
-
|
|
393
|
+
S(!0), b(e.target.value);
|
|
394
394
|
}
|
|
395
395
|
})]
|
|
396
396
|
}),
|
|
397
|
-
|
|
398
|
-
label:
|
|
399
|
-
kind:
|
|
400
|
-
value:
|
|
397
|
+
r.scoped_by && /* @__PURE__ */ H(Z, {
|
|
398
|
+
label: A(a, r.scoped_by),
|
|
399
|
+
kind: r.scoped_by,
|
|
400
|
+
value: j,
|
|
401
401
|
onChange: M,
|
|
402
402
|
required: !0,
|
|
403
|
-
client:
|
|
403
|
+
client: u
|
|
404
404
|
}),
|
|
405
|
-
|
|
406
|
-
label:
|
|
407
|
-
kind:
|
|
408
|
-
value:
|
|
409
|
-
onChange:
|
|
410
|
-
client:
|
|
405
|
+
r.parent && /* @__PURE__ */ H(Z, {
|
|
406
|
+
label: f("groupEditor.parent"),
|
|
407
|
+
kind: r.parent,
|
|
408
|
+
value: C,
|
|
409
|
+
onChange: k,
|
|
410
|
+
client: u
|
|
411
411
|
}),
|
|
412
412
|
/* @__PURE__ */ H(N, {
|
|
413
413
|
declared: F,
|
|
@@ -418,43 +418,43 @@ function Q({ kind: e, spec: n, languages: r, labels: a, g: o, onCreated: s, onEr
|
|
|
418
418
|
})),
|
|
419
419
|
labels: a
|
|
420
420
|
}),
|
|
421
|
-
V && /* @__PURE__ */ H(
|
|
422
|
-
G.error && /* @__PURE__ */ H(
|
|
423
|
-
/* @__PURE__ */ H(
|
|
421
|
+
V && /* @__PURE__ */ H(w, { children: V }),
|
|
422
|
+
G.error && /* @__PURE__ */ H(w, { children: T(d, G.error) }),
|
|
423
|
+
/* @__PURE__ */ H(s, {
|
|
424
424
|
type: "submit",
|
|
425
425
|
className: "justify-self-start",
|
|
426
|
-
disabled: G.pending || !K.trim() || !
|
|
427
|
-
children: G.pending ?
|
|
426
|
+
disabled: G.pending || !K.trim() || !y.trim() || !!r.scoped_by && !j,
|
|
427
|
+
children: G.pending ? f("common.saving") : f("groupEditor.create")
|
|
428
428
|
})
|
|
429
429
|
]
|
|
430
430
|
});
|
|
431
431
|
}
|
|
432
|
-
function $({ group: e, spec:
|
|
433
|
-
let { t: c } =
|
|
432
|
+
function $({ group: e, spec: t, g: r, labels: i, onError: a, client: o }) {
|
|
433
|
+
let { t: c } = n(), l = R(), u = t.attributes ?? {}, [d, f, p] = K(() => ({
|
|
434
434
|
slug: e.slug,
|
|
435
435
|
parent: e.parent ?? null,
|
|
436
436
|
scope: e.scope ?? null,
|
|
437
437
|
attrs: P(u, e.attributes)
|
|
438
|
-
}), e.revision), { slug:
|
|
439
|
-
M(!1),
|
|
438
|
+
}), e.revision), { slug: m, parent: _, scope: v, attrs: y } = d, b = (e) => {
|
|
439
|
+
M(!1), f((t) => ({
|
|
440
440
|
...t,
|
|
441
441
|
...e
|
|
442
442
|
}));
|
|
443
|
-
},
|
|
444
|
-
|
|
443
|
+
}, x = (e) => b({ slug: e }), S = (e) => b({ parent: e }), C = (e) => b({ scope: e }), T = (e) => b({ attrs: e(y) }), [O, k] = B(null), [j, M] = B(!1), F = E("group.save", a), I = async () => {
|
|
444
|
+
k(null), M(!1);
|
|
445
445
|
let e;
|
|
446
446
|
try {
|
|
447
|
-
e =
|
|
447
|
+
e = D(u, y);
|
|
448
448
|
} catch (e) {
|
|
449
|
-
|
|
449
|
+
k(e.message);
|
|
450
450
|
return;
|
|
451
451
|
}
|
|
452
452
|
await F.run(() => r.update({
|
|
453
|
-
slug:
|
|
453
|
+
slug: m.trim(),
|
|
454
454
|
attributes: e,
|
|
455
|
-
...
|
|
456
|
-
...
|
|
457
|
-
})) && (
|
|
455
|
+
...t.parent ? { parent_id: _?.id ?? "" } : {},
|
|
456
|
+
...t.scoped_by && v ? { scope_id: v.id } : {}
|
|
457
|
+
})) && (p(), M(!0));
|
|
458
458
|
};
|
|
459
459
|
return /* @__PURE__ */ H(q, {
|
|
460
460
|
title: c("groupEditor.details"),
|
|
@@ -467,50 +467,50 @@ function $({ group: e, spec: n, g: r, labels: a, onError: o, client: s }) {
|
|
|
467
467
|
children: [
|
|
468
468
|
/* @__PURE__ */ U("div", {
|
|
469
469
|
className: "grid gap-1.5",
|
|
470
|
-
children: [/* @__PURE__ */ H(
|
|
470
|
+
children: [/* @__PURE__ */ H(g, {
|
|
471
471
|
htmlFor: `${l}-slug`,
|
|
472
472
|
children: c("groupEditor.slug")
|
|
473
|
-
}), /* @__PURE__ */ H(
|
|
473
|
+
}), /* @__PURE__ */ H(h, {
|
|
474
474
|
id: `${l}-slug`,
|
|
475
475
|
className: "h-8",
|
|
476
476
|
required: !0,
|
|
477
|
-
value:
|
|
478
|
-
onChange: (e) =>
|
|
477
|
+
value: m,
|
|
478
|
+
onChange: (e) => x(e.target.value)
|
|
479
479
|
})]
|
|
480
480
|
}),
|
|
481
|
-
|
|
482
|
-
label:
|
|
483
|
-
kind:
|
|
481
|
+
t.scoped_by && /* @__PURE__ */ H(Z, {
|
|
482
|
+
label: A(i, t.scoped_by),
|
|
483
|
+
kind: t.scoped_by,
|
|
484
484
|
value: v,
|
|
485
|
-
onChange:
|
|
485
|
+
onChange: C,
|
|
486
486
|
required: !0,
|
|
487
|
-
client:
|
|
487
|
+
client: o
|
|
488
488
|
}),
|
|
489
|
-
|
|
489
|
+
t.parent && /* @__PURE__ */ H(Z, {
|
|
490
490
|
label: c("groupEditor.parent"),
|
|
491
|
-
kind:
|
|
491
|
+
kind: t.parent,
|
|
492
492
|
value: _,
|
|
493
|
-
onChange:
|
|
493
|
+
onChange: S,
|
|
494
494
|
exclude: [e.id],
|
|
495
|
-
client:
|
|
495
|
+
client: o
|
|
496
496
|
}),
|
|
497
497
|
/* @__PURE__ */ H(N, {
|
|
498
498
|
declared: u,
|
|
499
499
|
form: y,
|
|
500
|
-
onChange: (e, t) =>
|
|
500
|
+
onChange: (e, t) => T((n) => ({
|
|
501
501
|
...n,
|
|
502
502
|
[e]: t
|
|
503
503
|
})),
|
|
504
|
-
labels:
|
|
504
|
+
labels: i
|
|
505
505
|
}),
|
|
506
|
-
O && /* @__PURE__ */ H(
|
|
507
|
-
/* @__PURE__ */ H(
|
|
506
|
+
O && /* @__PURE__ */ H(w, { children: O }),
|
|
507
|
+
/* @__PURE__ */ H(w, { error: F.error }),
|
|
508
508
|
/* @__PURE__ */ U("div", {
|
|
509
509
|
className: "flex items-center gap-3",
|
|
510
|
-
children: [/* @__PURE__ */ H(
|
|
510
|
+
children: [/* @__PURE__ */ H(s, {
|
|
511
511
|
type: "submit",
|
|
512
512
|
size: "sm",
|
|
513
|
-
disabled: F.pending || !
|
|
513
|
+
disabled: F.pending || !m.trim() || !!t.scoped_by && !v,
|
|
514
514
|
children: F.pending ? c("common.saving") : c("common.save")
|
|
515
515
|
}), j && /* @__PURE__ */ H("span", {
|
|
516
516
|
role: "status",
|
|
@@ -522,23 +522,23 @@ function $({ group: e, spec: n, g: r, labels: a, onError: o, client: s }) {
|
|
|
522
522
|
})
|
|
523
523
|
});
|
|
524
524
|
}
|
|
525
|
-
function ee({ group: e, g:
|
|
526
|
-
let { t: o } =
|
|
525
|
+
function ee({ group: e, g: r, languages: i, onError: a }) {
|
|
526
|
+
let { t: o } = n(), c = R(), l = t(), [u, d] = B(i[0]), [f, p] = B("alias"), [S, C] = B(""), T = E("group.save", a), D = [...e.names].sort((e, t) => e.language.localeCompare(t.language) || (e.kind === t.kind ? e.name.localeCompare(t.name) : e.kind === "name" ? -1 : 1)), O = [.../* @__PURE__ */ new Set([...i, ...e.names.map((e) => e.language)])];
|
|
527
527
|
return /* @__PURE__ */ U(q, {
|
|
528
528
|
title: o("groupEditor.names"),
|
|
529
529
|
ckui: "group-names-editor",
|
|
530
530
|
children: [
|
|
531
|
-
|
|
531
|
+
D.length ? /* @__PURE__ */ H("ul", {
|
|
532
532
|
className: "grid divide-y divide-border rounded-lg border border-border",
|
|
533
|
-
children:
|
|
533
|
+
children: D.map((e) => /* @__PURE__ */ U("li", {
|
|
534
534
|
className: "flex flex-wrap items-center gap-2 p-2.5",
|
|
535
535
|
"data-ckui": "group-name",
|
|
536
536
|
"data-kind": e.kind,
|
|
537
537
|
"data-language": e.language,
|
|
538
538
|
children: [
|
|
539
|
-
/* @__PURE__ */ H(
|
|
539
|
+
/* @__PURE__ */ H(m, {
|
|
540
540
|
variant: "outline",
|
|
541
|
-
children:
|
|
541
|
+
children: l(e.language)
|
|
542
542
|
}),
|
|
543
543
|
/* @__PURE__ */ H("span", {
|
|
544
544
|
className: "min-w-0 flex-1 break-words",
|
|
@@ -549,22 +549,22 @@ function ee({ group: e, g: n, languages: r, onError: a }) {
|
|
|
549
549
|
className: "text-xs text-muted-foreground",
|
|
550
550
|
children: o(e.kind === "name" ? "groupEditor.canonical" : "groupEditor.alias")
|
|
551
551
|
}),
|
|
552
|
-
e.kind === "alias" && /* @__PURE__ */ H(
|
|
552
|
+
e.kind === "alias" && /* @__PURE__ */ H(s, {
|
|
553
553
|
size: "xs",
|
|
554
554
|
variant: "ghost",
|
|
555
555
|
disabled: T.pending,
|
|
556
|
-
onClick: () => void T.run(() =>
|
|
556
|
+
onClick: () => void T.run(() => r.names("add", [{
|
|
557
557
|
...e,
|
|
558
558
|
kind: "name"
|
|
559
559
|
}])),
|
|
560
560
|
children: o("groupEditor.makeCanonical")
|
|
561
561
|
}),
|
|
562
|
-
/* @__PURE__ */ H(
|
|
562
|
+
/* @__PURE__ */ H(s, {
|
|
563
563
|
size: "xs",
|
|
564
564
|
variant: "ghost",
|
|
565
565
|
disabled: T.pending,
|
|
566
566
|
"aria-label": o("groupEditor.removeName", { name: e.name }),
|
|
567
|
-
onClick: () => void T.run(() =>
|
|
567
|
+
onClick: () => void T.run(() => r.names("remove", [e])),
|
|
568
568
|
children: o("common.remove")
|
|
569
569
|
})
|
|
570
570
|
]
|
|
@@ -578,54 +578,54 @@ function ee({ group: e, g: n, languages: r, onError: a }) {
|
|
|
578
578
|
onSubmit: (e) => {
|
|
579
579
|
e.preventDefault();
|
|
580
580
|
let t = S.trim();
|
|
581
|
-
t && T.run(() =>
|
|
582
|
-
language:
|
|
583
|
-
kind:
|
|
581
|
+
t && T.run(() => r.names("add", [{
|
|
582
|
+
language: u,
|
|
583
|
+
kind: f,
|
|
584
584
|
name: t
|
|
585
|
-
}])).then((e) => e &&
|
|
585
|
+
}])).then((e) => e && C(""));
|
|
586
586
|
},
|
|
587
587
|
children: [
|
|
588
|
-
|
|
589
|
-
value:
|
|
590
|
-
onValueChange: (e) =>
|
|
591
|
-
children: [/* @__PURE__ */ H(
|
|
588
|
+
O.length > 1 && /* @__PURE__ */ U(_, {
|
|
589
|
+
value: u,
|
|
590
|
+
onValueChange: (e) => d(String(e)),
|
|
591
|
+
children: [/* @__PURE__ */ H(b, {
|
|
592
592
|
size: "sm",
|
|
593
593
|
"aria-label": o("groupEditor.language"),
|
|
594
|
-
children: /* @__PURE__ */ H(
|
|
595
|
-
}), /* @__PURE__ */ H(
|
|
594
|
+
children: /* @__PURE__ */ H(x, { children: (e) => l(e) })
|
|
595
|
+
}), /* @__PURE__ */ H(v, { children: O.map((e) => /* @__PURE__ */ H(y, {
|
|
596
596
|
value: e,
|
|
597
|
-
children:
|
|
597
|
+
children: l(e)
|
|
598
598
|
}, e)) })]
|
|
599
599
|
}),
|
|
600
|
-
/* @__PURE__ */ U(
|
|
601
|
-
value:
|
|
602
|
-
onValueChange: (e) =>
|
|
603
|
-
children: [/* @__PURE__ */ H(
|
|
600
|
+
/* @__PURE__ */ U(_, {
|
|
601
|
+
value: f,
|
|
602
|
+
onValueChange: (e) => p(e),
|
|
603
|
+
children: [/* @__PURE__ */ H(b, {
|
|
604
604
|
size: "sm",
|
|
605
605
|
"aria-label": o("groupEditor.nameKind"),
|
|
606
|
-
children: /* @__PURE__ */ H(
|
|
607
|
-
}), /* @__PURE__ */ U(
|
|
606
|
+
children: /* @__PURE__ */ H(x, { children: (e) => o(e === "name" ? "groupEditor.canonical" : "groupEditor.alias") })
|
|
607
|
+
}), /* @__PURE__ */ U(v, { children: [/* @__PURE__ */ H(y, {
|
|
608
608
|
value: "alias",
|
|
609
609
|
children: o("groupEditor.alias")
|
|
610
|
-
}), /* @__PURE__ */ H(
|
|
610
|
+
}), /* @__PURE__ */ H(y, {
|
|
611
611
|
value: "name",
|
|
612
612
|
children: o("groupEditor.canonical")
|
|
613
613
|
})] })]
|
|
614
614
|
}),
|
|
615
|
-
/* @__PURE__ */ H(
|
|
616
|
-
htmlFor: `${
|
|
615
|
+
/* @__PURE__ */ H(g, {
|
|
616
|
+
htmlFor: `${c}-name`,
|
|
617
617
|
className: "sr-only",
|
|
618
618
|
children: o("groupEditor.newName")
|
|
619
619
|
}),
|
|
620
|
-
/* @__PURE__ */ H(
|
|
621
|
-
id: `${
|
|
620
|
+
/* @__PURE__ */ H(h, {
|
|
621
|
+
id: `${c}-name`,
|
|
622
622
|
className: "h-8 min-w-40 flex-1",
|
|
623
|
-
lang:
|
|
623
|
+
lang: u,
|
|
624
624
|
value: S,
|
|
625
625
|
placeholder: o("groupEditor.newName"),
|
|
626
|
-
onChange: (e) =>
|
|
626
|
+
onChange: (e) => C(e.target.value)
|
|
627
627
|
}),
|
|
628
|
-
/* @__PURE__ */ H(
|
|
628
|
+
/* @__PURE__ */ H(s, {
|
|
629
629
|
type: "submit",
|
|
630
630
|
size: "sm",
|
|
631
631
|
variant: "outline",
|
|
@@ -634,13 +634,13 @@ function ee({ group: e, g: n, languages: r, onError: a }) {
|
|
|
634
634
|
})
|
|
635
635
|
]
|
|
636
636
|
}),
|
|
637
|
-
/* @__PURE__ */ H(
|
|
637
|
+
/* @__PURE__ */ H(w, { error: T.error })
|
|
638
638
|
]
|
|
639
639
|
});
|
|
640
640
|
}
|
|
641
|
-
function te({ group: e, g:
|
|
642
|
-
let { t: o } =
|
|
643
|
-
|
|
641
|
+
function te({ group: e, g: r, languages: i, onError: a }) {
|
|
642
|
+
let { t: o } = n(), c = R(), l = t(), u = [.../* @__PURE__ */ new Set([...i, ...e.text.map((e) => e.language)])], [d, f, p] = K(() => Object.fromEntries(u.map((t) => [t, e.text.find((e) => e.language === t) ?? { language: t }])), e.revision), [m, _] = B(!1), v = E("group.save", a), y = (e, t) => {
|
|
643
|
+
_(!1), f((n) => ({
|
|
644
644
|
...n,
|
|
645
645
|
[e]: {
|
|
646
646
|
...n[e],
|
|
@@ -655,61 +655,61 @@ function te({ group: e, g: n, languages: r, onError: a }) {
|
|
|
655
655
|
className: "grid gap-4",
|
|
656
656
|
onSubmit: (e) => {
|
|
657
657
|
e.preventDefault();
|
|
658
|
-
let t = Object.values(
|
|
658
|
+
let t = Object.values(d).map((e) => ({
|
|
659
659
|
language: e.language,
|
|
660
660
|
description: e.description?.trim() || void 0,
|
|
661
661
|
sort_key: e.sort_key?.trim() || void 0
|
|
662
662
|
})).filter((e) => e.description || e.sort_key);
|
|
663
|
-
|
|
664
|
-
e && (
|
|
663
|
+
v.run(() => r.update({ text: t })).then((e) => {
|
|
664
|
+
e && (p(), _(!0));
|
|
665
665
|
});
|
|
666
666
|
},
|
|
667
667
|
children: [
|
|
668
|
-
|
|
668
|
+
u.map((e) => /* @__PURE__ */ U("fieldset", {
|
|
669
669
|
className: "grid gap-2",
|
|
670
670
|
"data-language": e,
|
|
671
671
|
children: [
|
|
672
672
|
/* @__PURE__ */ H("legend", {
|
|
673
673
|
className: "mb-1 text-xs font-medium text-muted-foreground",
|
|
674
|
-
children:
|
|
674
|
+
children: l(e)
|
|
675
675
|
}),
|
|
676
|
-
/* @__PURE__ */ H(
|
|
677
|
-
htmlFor: `${
|
|
676
|
+
/* @__PURE__ */ H(g, {
|
|
677
|
+
htmlFor: `${c}-${e}-d`,
|
|
678
678
|
className: "sr-only",
|
|
679
|
-
children: o("groupEditor.descriptionIn", { language:
|
|
679
|
+
children: o("groupEditor.descriptionIn", { language: l(e) })
|
|
680
680
|
}),
|
|
681
|
-
/* @__PURE__ */ H(
|
|
682
|
-
id: `${
|
|
681
|
+
/* @__PURE__ */ H(C, {
|
|
682
|
+
id: `${c}-${e}-d`,
|
|
683
683
|
lang: e,
|
|
684
684
|
rows: 3,
|
|
685
685
|
placeholder: o("groupEditor.description"),
|
|
686
|
-
value:
|
|
687
|
-
onChange: (t) =>
|
|
686
|
+
value: d[e]?.description ?? "",
|
|
687
|
+
onChange: (t) => y(e, { description: t.target.value })
|
|
688
688
|
}),
|
|
689
|
-
/* @__PURE__ */ H(
|
|
690
|
-
htmlFor: `${
|
|
689
|
+
/* @__PURE__ */ H(g, {
|
|
690
|
+
htmlFor: `${c}-${e}-s`,
|
|
691
691
|
className: "sr-only",
|
|
692
|
-
children: o("groupEditor.sortKeyIn", { language:
|
|
692
|
+
children: o("groupEditor.sortKeyIn", { language: l(e) })
|
|
693
693
|
}),
|
|
694
|
-
/* @__PURE__ */ H(
|
|
695
|
-
id: `${
|
|
694
|
+
/* @__PURE__ */ H(h, {
|
|
695
|
+
id: `${c}-${e}-s`,
|
|
696
696
|
className: "h-8",
|
|
697
697
|
lang: e,
|
|
698
698
|
placeholder: o("groupEditor.sortKey"),
|
|
699
|
-
value:
|
|
700
|
-
onChange: (t) =>
|
|
699
|
+
value: d[e]?.sort_key ?? "",
|
|
700
|
+
onChange: (t) => y(e, { sort_key: t.target.value })
|
|
701
701
|
})
|
|
702
702
|
]
|
|
703
703
|
}, e)),
|
|
704
|
-
/* @__PURE__ */ H(
|
|
704
|
+
/* @__PURE__ */ H(w, { error: v.error }),
|
|
705
705
|
/* @__PURE__ */ U("div", {
|
|
706
706
|
className: "flex items-center gap-3",
|
|
707
|
-
children: [/* @__PURE__ */ H(
|
|
707
|
+
children: [/* @__PURE__ */ H(s, {
|
|
708
708
|
type: "submit",
|
|
709
709
|
size: "sm",
|
|
710
|
-
disabled:
|
|
711
|
-
children:
|
|
712
|
-
}),
|
|
710
|
+
disabled: v.pending,
|
|
711
|
+
children: v.pending ? o("common.saving") : o("common.save")
|
|
712
|
+
}), m && /* @__PURE__ */ H("span", {
|
|
713
713
|
role: "status",
|
|
714
714
|
className: "text-muted-foreground",
|
|
715
715
|
children: o("groupEditor.saved")
|
|
@@ -719,10 +719,10 @@ function te({ group: e, g: n, languages: r, onError: a }) {
|
|
|
719
719
|
})
|
|
720
720
|
});
|
|
721
721
|
}
|
|
722
|
-
function ne({ group: e, spec:
|
|
723
|
-
let { t: a } =
|
|
722
|
+
function ne({ group: e, spec: t, onError: r, client: i }) {
|
|
723
|
+
let { t: a } = n(), o = e.cover, s = o?.image ? "image" : o?.content_id && !o.auto ? "content" : "auto";
|
|
724
724
|
return /* @__PURE__ */ U(q, {
|
|
725
|
-
title: a(
|
|
725
|
+
title: a(t.owner === "user" ? "groupEditor.images" : "groupEditor.cover"),
|
|
726
726
|
ckui: "group-cover-editor",
|
|
727
727
|
children: [
|
|
728
728
|
/* @__PURE__ */ H("p", {
|
|
@@ -736,7 +736,7 @@ function ne({ group: e, spec: n, onError: r, client: i }) {
|
|
|
736
736
|
client: i,
|
|
737
737
|
onError: r
|
|
738
738
|
}),
|
|
739
|
-
|
|
739
|
+
t.owner === "user" && /* @__PURE__ */ H(F, {
|
|
740
740
|
group: e,
|
|
741
741
|
slot: "avatar",
|
|
742
742
|
client: i,
|
|
@@ -745,8 +745,8 @@ function ne({ group: e, spec: n, onError: r, client: i }) {
|
|
|
745
745
|
]
|
|
746
746
|
});
|
|
747
747
|
}
|
|
748
|
-
function re({ group: e, onError:
|
|
749
|
-
let { t: a } =
|
|
748
|
+
function re({ group: e, onError: t, client: r }) {
|
|
749
|
+
let { t: a } = n(), o = i(r), s = E("offer.save", t);
|
|
750
750
|
return /* @__PURE__ */ U(q, {
|
|
751
751
|
title: a("groupEditor.membershipPrice"),
|
|
752
752
|
ckui: "group-offer",
|
|
@@ -755,53 +755,53 @@ function re({ group: e, onError: n, client: i }) {
|
|
|
755
755
|
pending: s.pending,
|
|
756
756
|
onSell: (t) => void s.run(() => o.offers.sellGroup(e.id, t)),
|
|
757
757
|
onWithdraw: () => void s.run(() => o.offers.withdrawGroup(e.id))
|
|
758
|
-
}, e.offer?.revision), /* @__PURE__ */ H(
|
|
758
|
+
}, e.offer?.revision), /* @__PURE__ */ H(w, { error: s.error })]
|
|
759
759
|
});
|
|
760
760
|
}
|
|
761
761
|
var ie = /^[a-z][a-z0-9_]*$/;
|
|
762
|
-
function ae({ group: e, g:
|
|
763
|
-
let { t: c } =
|
|
764
|
-
let t =
|
|
762
|
+
function ae({ group: e, g: t, kinds: r, labels: i, onError: a, client: o }) {
|
|
763
|
+
let { t: c } = n(), l = R(), u = E("group.save", a), d = j(e.edges.map((t) => t.from === e.id ? t.to : t.from), { client: o }), f = Object.keys(r?.group_kinds ?? {}).sort(), [p, S] = B(""), [C, T] = B(f[0] ?? e.kind), D = e.edges.filter((t) => t.from === e.id), O = e.edges.filter((t) => t.to === e.id), M = (e) => {
|
|
764
|
+
let t = d.get(e);
|
|
765
765
|
return t ? t.name || t.slug : e;
|
|
766
|
-
}, N = ie.test(
|
|
766
|
+
}, N = ie.test(p.trim());
|
|
767
767
|
return /* @__PURE__ */ U(q, {
|
|
768
768
|
title: c("groupEditor.edges"),
|
|
769
769
|
ckui: "group-edges",
|
|
770
770
|
children: [
|
|
771
|
-
D.length +
|
|
771
|
+
D.length + O.length ? /* @__PURE__ */ U("ul", {
|
|
772
772
|
className: "grid gap-1.5",
|
|
773
773
|
children: [D.map((e) => /* @__PURE__ */ U("li", {
|
|
774
774
|
className: "flex flex-wrap items-center gap-2",
|
|
775
775
|
"data-ckui": "group-edge",
|
|
776
776
|
"data-relation": e.relation,
|
|
777
777
|
children: [
|
|
778
|
-
/* @__PURE__ */ H(
|
|
778
|
+
/* @__PURE__ */ H(m, {
|
|
779
779
|
variant: "secondary",
|
|
780
|
-
children:
|
|
780
|
+
children: A(i, e.relation)
|
|
781
781
|
}),
|
|
782
782
|
/* @__PURE__ */ H("span", { children: M(e.to) }),
|
|
783
|
-
/* @__PURE__ */ H(
|
|
783
|
+
/* @__PURE__ */ H(s, {
|
|
784
784
|
size: "xs",
|
|
785
785
|
variant: "ghost",
|
|
786
786
|
disabled: u.pending,
|
|
787
787
|
"aria-label": c("groupEditor.removeEdge", { name: M(e.to) }),
|
|
788
|
-
onClick: () => void u.run(() =>
|
|
788
|
+
onClick: () => void u.run(() => t.edges("remove", [{
|
|
789
789
|
relation: e.relation,
|
|
790
790
|
to: e.to
|
|
791
791
|
}])),
|
|
792
792
|
children: c("common.remove")
|
|
793
793
|
})
|
|
794
794
|
]
|
|
795
|
-
}, `${e.relation}:${e.to}`)),
|
|
795
|
+
}, `${e.relation}:${e.to}`)), O.map((e) => /* @__PURE__ */ U("li", {
|
|
796
796
|
className: "flex flex-wrap items-center gap-2 text-muted-foreground",
|
|
797
797
|
"data-ckui": "group-edge",
|
|
798
798
|
"data-relation": `inverse:${e.relation}`,
|
|
799
799
|
children: [/* @__PURE__ */ H("span", {
|
|
800
800
|
className: "text-foreground",
|
|
801
801
|
children: M(e.from)
|
|
802
|
-
}), /* @__PURE__ */ H(
|
|
802
|
+
}), /* @__PURE__ */ H(m, {
|
|
803
803
|
variant: "outline",
|
|
804
|
-
children:
|
|
804
|
+
children: A(i, e.relation)
|
|
805
805
|
})]
|
|
806
806
|
}, `in:${e.relation}:${e.from}`))]
|
|
807
807
|
}) : /* @__PURE__ */ H("p", {
|
|
@@ -813,44 +813,44 @@ function ae({ group: e, g: n, kinds: r, labels: a, onError: o, client: s }) {
|
|
|
813
813
|
children: [
|
|
814
814
|
/* @__PURE__ */ U("div", {
|
|
815
815
|
className: "grid gap-1",
|
|
816
|
-
children: [/* @__PURE__ */ H(
|
|
816
|
+
children: [/* @__PURE__ */ H(g, {
|
|
817
817
|
htmlFor: `${l}-rel`,
|
|
818
818
|
className: "text-xs text-muted-foreground",
|
|
819
819
|
children: c("groupEditor.relation")
|
|
820
|
-
}), /* @__PURE__ */ H(
|
|
820
|
+
}), /* @__PURE__ */ H(h, {
|
|
821
821
|
id: `${l}-rel`,
|
|
822
822
|
className: "h-8 w-40",
|
|
823
|
-
value:
|
|
823
|
+
value: p,
|
|
824
824
|
placeholder: "member_of",
|
|
825
|
-
"aria-invalid": !!
|
|
826
|
-
onChange: (e) =>
|
|
825
|
+
"aria-invalid": !!p && !N,
|
|
826
|
+
onChange: (e) => S(e.target.value)
|
|
827
827
|
})]
|
|
828
828
|
}),
|
|
829
|
-
|
|
830
|
-
value:
|
|
831
|
-
onValueChange: (e) =>
|
|
832
|
-
children: [/* @__PURE__ */ H(
|
|
829
|
+
f.length > 1 && /* @__PURE__ */ U(_, {
|
|
830
|
+
value: C,
|
|
831
|
+
onValueChange: (e) => T(String(e)),
|
|
832
|
+
children: [/* @__PURE__ */ H(b, {
|
|
833
833
|
size: "sm",
|
|
834
834
|
"aria-label": c("groupEditor.edgeKind"),
|
|
835
|
-
children: /* @__PURE__ */ H(
|
|
836
|
-
}), /* @__PURE__ */ H(
|
|
835
|
+
children: /* @__PURE__ */ H(x, { children: (e) => A(i, e) })
|
|
836
|
+
}), /* @__PURE__ */ H(v, { children: f.map((e) => /* @__PURE__ */ H(y, {
|
|
837
837
|
value: e,
|
|
838
|
-
children:
|
|
838
|
+
children: A(i, e)
|
|
839
839
|
}, e)) })]
|
|
840
840
|
}),
|
|
841
|
-
N && /* @__PURE__ */ H(
|
|
842
|
-
kind:
|
|
841
|
+
N && /* @__PURE__ */ H(k, {
|
|
842
|
+
kind: C,
|
|
843
843
|
label: c("groupEditor.edgeTarget"),
|
|
844
844
|
exclude: [e.id],
|
|
845
|
-
client:
|
|
846
|
-
onPick: (e) => void u.run(() =>
|
|
847
|
-
relation:
|
|
845
|
+
client: o,
|
|
846
|
+
onPick: (e) => void u.run(() => t.edges("add", [{
|
|
847
|
+
relation: p.trim(),
|
|
848
848
|
to: e.id
|
|
849
|
-
}])).then((e) => e &&
|
|
850
|
-
},
|
|
849
|
+
}])).then((e) => e && S(""))
|
|
850
|
+
}, C)
|
|
851
851
|
]
|
|
852
852
|
}),
|
|
853
|
-
/* @__PURE__ */ H(
|
|
853
|
+
/* @__PURE__ */ H(w, { error: u.error })
|
|
854
854
|
]
|
|
855
855
|
});
|
|
856
856
|
}
|