@burdenoff/microfe-theculturepost 2026.1113.2 → 2026.1113.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/theculturepost/components/CreateStoryDialog.js +138 -136
- package/dist/theculturepost/components/CreateStoryDialog.js.map +1 -1
- package/dist/theculturepost/components/FramingPrompts.d.ts +9 -0
- package/dist/theculturepost/components/FramingPrompts.js +48 -0
- package/dist/theculturepost/components/FramingPrompts.js.map +1 -0
- package/dist/theculturepost/hooks/index.js +7 -7
- package/dist/theculturepost/hooks/useTcpApi.d.ts +6 -1
- package/dist/theculturepost/hooks/useTcpApi.js +252 -237
- package/dist/theculturepost/hooks/useTcpApi.js.map +1 -1
- package/dist/theculturepost/pages/stories/StoriesPage.js +120 -83
- package/dist/theculturepost/pages/stories/StoriesPage.js.map +1 -1
- package/dist/theculturepost/pages/stories/StoryDetailPage.js +349 -347
- package/dist/theculturepost/pages/stories/StoryDetailPage.js.map +1 -1
- package/dist/theculturepost/translations/en.d.ts +7 -0
- package/dist/theculturepost/translations/en.js +7 -0
- package/dist/theculturepost/translations/en.js.map +1 -1
- package/dist/theculturepost/utils/storyTraditions.d.ts +8 -0
- package/dist/theculturepost/utils/storyTraditions.js +22 -0
- package/dist/theculturepost/utils/storyTraditions.js.map +1 -0
- package/package.json +1 -1
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FramingPrompts as e } from "./FramingPrompts.js";
|
|
2
2
|
import { FILE_FOLDERS as t, uploadImageToFiles as n } from "../hooks/useFiles.js";
|
|
3
|
-
import {
|
|
3
|
+
import { TagInput as r } from "./TagInput.js";
|
|
4
4
|
import { useTcpCreateStory as i, useTcpTopics as a } from "../hooks/useTcpApi.js";
|
|
5
|
+
import { cn as o } from "../utils/cn.js";
|
|
5
6
|
import "../hooks/index.js";
|
|
6
|
-
import { slugify as
|
|
7
|
-
import { formatEnumLabel as
|
|
8
|
-
import { describeError as
|
|
7
|
+
import { slugify as s } from "../utils/slug.js";
|
|
8
|
+
import { formatEnumLabel as c } from "../utils/formatters.js";
|
|
9
|
+
import { describeError as ee, notify as l } from "../lib/toast.js";
|
|
9
10
|
import { useRef as u, useState as d } from "react";
|
|
10
|
-
import { CheckCircle2 as f, FileCheck2 as p, Loader2 as
|
|
11
|
-
import { Fragment as
|
|
12
|
-
import { Button as
|
|
11
|
+
import { CheckCircle2 as f, FileCheck2 as p, Loader2 as m, UploadCloud as h, X as g } from "lucide-react";
|
|
12
|
+
import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
13
|
+
import { Button as b, Input as x, Label as S, ResponsiveDialog as C, ResponsiveDialogContent as w, ResponsiveDialogDescription as T, ResponsiveDialogFooter as E, ResponsiveDialogHeader as D, ResponsiveDialogTitle as O, Select as k, SelectContent as te, SelectItem as ne, SelectTrigger as re, SelectValue as A, Textarea as j } from "@burdenoff/fe-libs/ui";
|
|
13
14
|
// src/theculturepost/components/CreateStoryDialog.tsx
|
|
14
|
-
var
|
|
15
|
+
var ie = [
|
|
15
16
|
"ARTICLE",
|
|
16
17
|
"ESSAY",
|
|
17
18
|
"EXPLAINER",
|
|
@@ -19,129 +20,129 @@ var re = [
|
|
|
19
20
|
"PHOTO_STORY",
|
|
20
21
|
"TIMELINE"
|
|
21
22
|
], M = 200, N = 25;
|
|
22
|
-
function
|
|
23
|
-
let
|
|
23
|
+
function ae({ coverFileId: e, onUploaded: r, onCleared: i }) {
|
|
24
|
+
let a = u(null), [s, c] = d(!1), [f, _] = d(!1), [x, S] = d(null), [C, w] = d(null), T = async (e) => {
|
|
24
25
|
if (!e.type.startsWith("image/")) l.error("Unsupported file", "Please choose an image (JPG or PNG).");
|
|
25
26
|
else if (e.size > N * 1024 * 1024) l.error("File too large", `Please choose an image under ${N} MB.`);
|
|
26
27
|
else {
|
|
27
|
-
|
|
28
|
+
c(!0);
|
|
28
29
|
try {
|
|
29
|
-
let
|
|
30
|
-
|
|
30
|
+
let i = await n(e, t.covers);
|
|
31
|
+
S(i.url), w(i.name), r(i.id), l.success("Cover uploaded", i.name);
|
|
31
32
|
} catch (e) {
|
|
32
|
-
l.error("Upload failed",
|
|
33
|
+
l.error("Upload failed", ee(e));
|
|
33
34
|
} finally {
|
|
34
|
-
|
|
35
|
+
c(!1);
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
|
-
}, T = (e) => {
|
|
38
|
-
let t = e.target.files?.[0];
|
|
39
|
-
e.target.value = "", t && w(t);
|
|
40
38
|
}, E = (e) => {
|
|
41
|
-
|
|
39
|
+
let t = e.target.files?.[0];
|
|
40
|
+
e.target.value = "", t && T(t);
|
|
41
|
+
}, D = (e) => {
|
|
42
|
+
if (e.preventDefault(), _(!1), s) return;
|
|
42
43
|
let t = e.dataTransfer.files?.[0];
|
|
43
|
-
t &&
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
},
|
|
47
|
-
ref:
|
|
44
|
+
t && T(t);
|
|
45
|
+
}, O = () => {
|
|
46
|
+
S(null), w(null), i();
|
|
47
|
+
}, k = /* @__PURE__ */ v("input", {
|
|
48
|
+
ref: a,
|
|
48
49
|
type: "file",
|
|
49
50
|
accept: "image/*",
|
|
50
51
|
className: "sr-only",
|
|
51
|
-
onChange:
|
|
52
|
+
onChange: E,
|
|
52
53
|
disabled: s,
|
|
53
54
|
"aria-label": "Upload cover image"
|
|
54
55
|
});
|
|
55
|
-
return
|
|
56
|
+
return x ? /* @__PURE__ */ y("div", {
|
|
56
57
|
className: "relative overflow-hidden rounded-2xl border border-border-seam",
|
|
57
58
|
children: [
|
|
58
|
-
|
|
59
|
-
/* @__PURE__ */
|
|
60
|
-
src:
|
|
59
|
+
k,
|
|
60
|
+
/* @__PURE__ */ v("img", {
|
|
61
|
+
src: x,
|
|
61
62
|
alt: "Cover preview",
|
|
62
63
|
className: "max-h-52 w-full object-cover"
|
|
63
64
|
}),
|
|
64
|
-
/* @__PURE__ */
|
|
65
|
+
/* @__PURE__ */ y("div", {
|
|
65
66
|
className: "absolute right-2 top-2 flex gap-1.5",
|
|
66
|
-
children: [/* @__PURE__ */
|
|
67
|
+
children: [/* @__PURE__ */ v("button", {
|
|
67
68
|
type: "button",
|
|
68
|
-
onClick: () =>
|
|
69
|
+
onClick: () => a.current?.click(),
|
|
69
70
|
className: "rounded-full bg-bg-canvas/85 px-2.5 py-1 text-xs font-medium text-text-primary backdrop-blur-sm hover:bg-bg-canvas",
|
|
70
71
|
children: "Replace"
|
|
71
|
-
}), /* @__PURE__ */
|
|
72
|
+
}), /* @__PURE__ */ v("button", {
|
|
72
73
|
type: "button",
|
|
73
|
-
onClick:
|
|
74
|
+
onClick: O,
|
|
74
75
|
"aria-label": "Remove cover",
|
|
75
76
|
className: "rounded-full bg-bg-canvas/85 p-1.5 text-text-primary backdrop-blur-sm hover:bg-bg-canvas",
|
|
76
|
-
children: /* @__PURE__ */ g
|
|
77
|
+
children: /* @__PURE__ */ v(g, {
|
|
77
78
|
className: "h-4 w-4",
|
|
78
79
|
"aria-hidden": "true"
|
|
79
80
|
})
|
|
80
81
|
})]
|
|
81
82
|
})
|
|
82
83
|
]
|
|
83
|
-
}) : e ? /* @__PURE__ */
|
|
84
|
+
}) : e ? /* @__PURE__ */ y("div", {
|
|
84
85
|
className: "flex items-center justify-between gap-2 rounded-2xl border border-border-seam bg-bg-surface px-3 py-2.5 text-sm",
|
|
85
86
|
children: [
|
|
86
|
-
|
|
87
|
-
/* @__PURE__ */
|
|
87
|
+
k,
|
|
88
|
+
/* @__PURE__ */ y("span", {
|
|
88
89
|
className: "inline-flex min-w-0 items-center gap-2 text-text-primary",
|
|
89
|
-
children: [/* @__PURE__ */
|
|
90
|
+
children: [/* @__PURE__ */ v(p, {
|
|
90
91
|
className: "h-4 w-4 shrink-0 text-status-success-text",
|
|
91
92
|
"aria-hidden": "true"
|
|
92
|
-
}), /* @__PURE__ */
|
|
93
|
+
}), /* @__PURE__ */ v("span", {
|
|
93
94
|
className: "truncate",
|
|
94
|
-
children:
|
|
95
|
+
children: C ?? "Cover selected"
|
|
95
96
|
})]
|
|
96
97
|
}),
|
|
97
|
-
/* @__PURE__ */
|
|
98
|
+
/* @__PURE__ */ v("button", {
|
|
98
99
|
type: "button",
|
|
99
|
-
onClick:
|
|
100
|
+
onClick: O,
|
|
100
101
|
"aria-label": "Remove cover",
|
|
101
102
|
className: "text-text-tertiary hover:text-text-primary",
|
|
102
|
-
children: /* @__PURE__ */ g
|
|
103
|
+
children: /* @__PURE__ */ v(g, {
|
|
103
104
|
className: "h-4 w-4",
|
|
104
105
|
"aria-hidden": "true"
|
|
105
106
|
})
|
|
106
107
|
})
|
|
107
108
|
]
|
|
108
|
-
}) : /* @__PURE__ */
|
|
109
|
+
}) : /* @__PURE__ */ y("div", {
|
|
109
110
|
onDragOver: (e) => {
|
|
110
|
-
e.preventDefault(), s ||
|
|
111
|
+
e.preventDefault(), s || _(!0);
|
|
111
112
|
},
|
|
112
113
|
onDragLeave: (e) => {
|
|
113
|
-
e.preventDefault(),
|
|
114
|
+
e.preventDefault(), _(!1);
|
|
114
115
|
},
|
|
115
|
-
onDrop:
|
|
116
|
-
className:
|
|
116
|
+
onDrop: D,
|
|
117
|
+
className: o("rounded-2xl border-2 border-dashed px-4 py-6 text-center transition-colors", f ? "border-accent bg-[var(--color-accent-soft)]" : "border-border-seam bg-bg-sunken/40"),
|
|
117
118
|
children: [
|
|
118
|
-
|
|
119
|
-
s ? /* @__PURE__ */
|
|
119
|
+
k,
|
|
120
|
+
s ? /* @__PURE__ */ y("div", {
|
|
120
121
|
className: "flex items-center justify-center gap-2 text-sm text-text-secondary",
|
|
121
|
-
children: [/* @__PURE__ */
|
|
122
|
+
children: [/* @__PURE__ */ v(m, {
|
|
122
123
|
className: "h-5 w-5 animate-spin",
|
|
123
124
|
"aria-hidden": "true"
|
|
124
125
|
}), " Uploading cover…"]
|
|
125
|
-
}) : /* @__PURE__ */
|
|
126
|
+
}) : /* @__PURE__ */ y("div", {
|
|
126
127
|
className: "flex flex-col items-center justify-center gap-3 sm:flex-row",
|
|
127
128
|
children: [
|
|
128
|
-
/* @__PURE__ */
|
|
129
|
+
/* @__PURE__ */ v(h, {
|
|
129
130
|
className: "h-8 w-8 text-accent",
|
|
130
131
|
"aria-hidden": "true"
|
|
131
132
|
}),
|
|
132
|
-
/* @__PURE__ */
|
|
133
|
+
/* @__PURE__ */ v("p", {
|
|
133
134
|
className: "text-sm text-text-secondary",
|
|
134
135
|
children: "Drag and drop an image here, or"
|
|
135
136
|
}),
|
|
136
|
-
/* @__PURE__ */
|
|
137
|
+
/* @__PURE__ */ v(b, {
|
|
137
138
|
type: "button",
|
|
138
139
|
size: "sm",
|
|
139
|
-
onClick: () =>
|
|
140
|
+
onClick: () => a.current?.click(),
|
|
140
141
|
children: "Upload cover"
|
|
141
142
|
})
|
|
142
143
|
]
|
|
143
144
|
}),
|
|
144
|
-
/* @__PURE__ */
|
|
145
|
+
/* @__PURE__ */ y("p", {
|
|
145
146
|
className: "mt-3 text-xs text-text-tertiary",
|
|
146
147
|
children: [
|
|
147
148
|
"Recommended: 16:9 ratio, min 1200×675px. JPG or PNG, up to ",
|
|
@@ -152,119 +153,119 @@ function ie({ coverFileId: e, onUploaded: i, onCleared: a }) {
|
|
|
152
153
|
]
|
|
153
154
|
});
|
|
154
155
|
}
|
|
155
|
-
function P({ open: t, onOpenChange: n, topicId:
|
|
156
|
-
let p = i(),
|
|
157
|
-
N(""), F(""), I(!1), R(""), B(""),
|
|
156
|
+
function P({ open: t, onOpenChange: n, topicId: o, onCreated: u }) {
|
|
157
|
+
let p = i(), h = a({ pagination: { limit: 100 } }), [g, N] = d(""), [P, F] = d(""), [oe, I] = d(!1), [L, R] = d(""), [z, B] = d(""), [V, H] = d("ARTICLE"), [U, W] = d(o ?? ""), [G, K] = d([]), [q, J] = d([]), [Y, se] = d(""), [ce, X] = d(null), [Z, Q] = d(null), [le, ue] = d(0), $ = oe ? P : s(g), de = () => {
|
|
158
|
+
N(""), F(""), I(!1), R(""), B(""), H("ARTICLE"), W(o ?? ""), K([]), J([]), se(""), X(null), Q(null), ue((e) => e + 1);
|
|
158
159
|
};
|
|
159
|
-
return /* @__PURE__ */
|
|
160
|
+
return /* @__PURE__ */ v(C, {
|
|
160
161
|
open: t,
|
|
161
162
|
onOpenChange: n,
|
|
162
|
-
children: /* @__PURE__ */
|
|
163
|
+
children: /* @__PURE__ */ y(w, {
|
|
163
164
|
className: "sm:max-w-3xl",
|
|
164
165
|
children: [
|
|
165
|
-
/* @__PURE__ */
|
|
166
|
+
/* @__PURE__ */ y(D, { children: [/* @__PURE__ */ v(O, {
|
|
166
167
|
className: "font-display",
|
|
167
168
|
children: "Draft a story"
|
|
168
|
-
}), /* @__PURE__ */
|
|
169
|
-
/* @__PURE__ */
|
|
169
|
+
}), /* @__PURE__ */ v(T, { children: "Begin a new piece — it enters the editorial lifecycle as a draft you can refine and publish later." })] }),
|
|
170
|
+
/* @__PURE__ */ y("div", {
|
|
170
171
|
className: "flex max-h-[64vh] flex-col gap-5 overflow-y-auto py-2",
|
|
171
172
|
children: [
|
|
172
|
-
/* @__PURE__ */
|
|
173
|
+
/* @__PURE__ */ y("div", {
|
|
173
174
|
className: "grid gap-1.5",
|
|
174
|
-
children: [/* @__PURE__ */
|
|
175
|
-
coverFileId:
|
|
176
|
-
onUploaded:
|
|
177
|
-
onCleared: () =>
|
|
178
|
-
},
|
|
175
|
+
children: [/* @__PURE__ */ v(S, { children: "Cover image" }), /* @__PURE__ */ v(ae, {
|
|
176
|
+
coverFileId: ce,
|
|
177
|
+
onUploaded: X,
|
|
178
|
+
onCleared: () => X(null)
|
|
179
|
+
}, le)]
|
|
179
180
|
}),
|
|
180
|
-
/* @__PURE__ */
|
|
181
|
+
/* @__PURE__ */ y("div", {
|
|
181
182
|
className: "grid gap-4 sm:grid-cols-2",
|
|
182
|
-
children: [/* @__PURE__ */
|
|
183
|
+
children: [/* @__PURE__ */ y("div", {
|
|
183
184
|
className: "grid gap-1.5",
|
|
184
|
-
children: [/* @__PURE__ */
|
|
185
|
+
children: [/* @__PURE__ */ v(S, {
|
|
185
186
|
htmlFor: "story-title",
|
|
186
187
|
children: "Title"
|
|
187
|
-
}), /* @__PURE__ */
|
|
188
|
+
}), /* @__PURE__ */ v(x, {
|
|
188
189
|
id: "story-title",
|
|
189
|
-
value:
|
|
190
|
+
value: g,
|
|
190
191
|
onChange: (e) => N(e.target.value),
|
|
191
192
|
placeholder: "e.g. The Weavers of the Coromandel Coast"
|
|
192
193
|
})]
|
|
193
|
-
}), /* @__PURE__ */
|
|
194
|
+
}), /* @__PURE__ */ y("div", {
|
|
194
195
|
className: "grid gap-1.5",
|
|
195
196
|
children: [
|
|
196
|
-
/* @__PURE__ */
|
|
197
|
+
/* @__PURE__ */ v(S, {
|
|
197
198
|
htmlFor: "story-slug",
|
|
198
199
|
children: "URL slug"
|
|
199
200
|
}),
|
|
200
|
-
/* @__PURE__ */
|
|
201
|
+
/* @__PURE__ */ y("div", {
|
|
201
202
|
className: "relative",
|
|
202
|
-
children: [/* @__PURE__ */
|
|
203
|
+
children: [/* @__PURE__ */ v(x, {
|
|
203
204
|
id: "story-slug",
|
|
204
205
|
value: $,
|
|
205
206
|
onChange: (e) => {
|
|
206
|
-
I(!0), F(
|
|
207
|
+
I(!0), F(s(e.target.value));
|
|
207
208
|
},
|
|
208
209
|
placeholder: "the-weavers-of-the-coromandel-coast",
|
|
209
210
|
className: $ ? "pr-9" : void 0
|
|
210
|
-
}), $ && /* @__PURE__ */
|
|
211
|
+
}), $ && /* @__PURE__ */ v(f, {
|
|
211
212
|
className: "pointer-events-none absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 text-status-success-text",
|
|
212
213
|
"aria-hidden": "true"
|
|
213
214
|
})]
|
|
214
215
|
}),
|
|
215
|
-
/* @__PURE__ */
|
|
216
|
+
/* @__PURE__ */ v("p", {
|
|
216
217
|
className: "text-xs text-text-tertiary",
|
|
217
218
|
children: "Auto-derived from the title — used in the story’s URL, so keep it unique."
|
|
218
219
|
})
|
|
219
220
|
]
|
|
220
221
|
})]
|
|
221
222
|
}),
|
|
222
|
-
/* @__PURE__ */
|
|
223
|
+
/* @__PURE__ */ y("div", {
|
|
223
224
|
className: "grid gap-4 sm:grid-cols-2",
|
|
224
|
-
children: [/* @__PURE__ */
|
|
225
|
+
children: [/* @__PURE__ */ y("div", {
|
|
225
226
|
className: "grid gap-1.5",
|
|
226
|
-
children: [/* @__PURE__ */
|
|
227
|
+
children: [/* @__PURE__ */ v(S, { children: "Format" }), /* @__PURE__ */ y(k, {
|
|
227
228
|
value: V,
|
|
228
|
-
onValueChange: (e) =>
|
|
229
|
-
children: [/* @__PURE__ */
|
|
229
|
+
onValueChange: (e) => H(e),
|
|
230
|
+
children: [/* @__PURE__ */ v(re, { children: /* @__PURE__ */ v(A, {}) }), /* @__PURE__ */ v(te, { children: ie.map((e) => /* @__PURE__ */ v(ne, {
|
|
230
231
|
value: e,
|
|
231
|
-
children:
|
|
232
|
+
children: c(e)
|
|
232
233
|
}, e)) })]
|
|
233
234
|
})]
|
|
234
|
-
}), /* @__PURE__ */
|
|
235
|
+
}), /* @__PURE__ */ y("div", {
|
|
235
236
|
className: "grid gap-1.5",
|
|
236
|
-
children: [/* @__PURE__ */
|
|
237
|
+
children: [/* @__PURE__ */ v(S, {
|
|
237
238
|
htmlFor: "story-reading",
|
|
238
239
|
children: "Reading time (min)"
|
|
239
|
-
}), /* @__PURE__ */
|
|
240
|
+
}), /* @__PURE__ */ v(x, {
|
|
240
241
|
id: "story-reading",
|
|
241
242
|
type: "number",
|
|
242
243
|
min: 0,
|
|
243
|
-
value:
|
|
244
|
-
onChange: (e) =>
|
|
244
|
+
value: Y,
|
|
245
|
+
onChange: (e) => se(e.target.value),
|
|
245
246
|
placeholder: "Optional"
|
|
246
247
|
})]
|
|
247
248
|
})]
|
|
248
249
|
}),
|
|
249
|
-
/* @__PURE__ */
|
|
250
|
+
/* @__PURE__ */ y("div", {
|
|
250
251
|
className: "grid gap-1.5",
|
|
251
|
-
children: [/* @__PURE__ */
|
|
252
|
-
value:
|
|
253
|
-
onValueChange:
|
|
254
|
-
children: [/* @__PURE__ */
|
|
252
|
+
children: [/* @__PURE__ */ v(S, { children: "Topic" }), /* @__PURE__ */ y(k, {
|
|
253
|
+
value: U,
|
|
254
|
+
onValueChange: W,
|
|
255
|
+
children: [/* @__PURE__ */ v(re, { children: /* @__PURE__ */ v(A, { placeholder: "Choose a topic (optional)" }) }), /* @__PURE__ */ v(te, { children: (h.data?.items ?? []).map((e) => /* @__PURE__ */ v(ne, {
|
|
255
256
|
value: e.id,
|
|
256
257
|
children: e.name
|
|
257
258
|
}, e.id)) })]
|
|
258
259
|
})]
|
|
259
260
|
}),
|
|
260
|
-
/* @__PURE__ */
|
|
261
|
+
/* @__PURE__ */ y("div", {
|
|
261
262
|
className: "grid gap-1.5",
|
|
262
|
-
children: [/* @__PURE__ */
|
|
263
|
+
children: [/* @__PURE__ */ y("div", {
|
|
263
264
|
className: "flex items-center justify-between gap-2",
|
|
264
|
-
children: [/* @__PURE__ */
|
|
265
|
+
children: [/* @__PURE__ */ v(S, {
|
|
265
266
|
htmlFor: "story-summary",
|
|
266
267
|
children: "Summary"
|
|
267
|
-
}), /* @__PURE__ */
|
|
268
|
+
}), /* @__PURE__ */ y("span", {
|
|
268
269
|
className: "text-xs tabular-nums text-text-tertiary",
|
|
269
270
|
children: [
|
|
270
271
|
L.length,
|
|
@@ -272,7 +273,7 @@ function P({ open: t, onOpenChange: n, topicId: r, onCreated: u }) {
|
|
|
272
273
|
M
|
|
273
274
|
]
|
|
274
275
|
})]
|
|
275
|
-
}), /* @__PURE__ */
|
|
276
|
+
}), /* @__PURE__ */ v(j, {
|
|
276
277
|
id: "story-summary",
|
|
277
278
|
value: L,
|
|
278
279
|
onChange: (e) => R(e.target.value.slice(0, M)),
|
|
@@ -281,14 +282,15 @@ function P({ open: t, onOpenChange: n, topicId: r, onCreated: u }) {
|
|
|
281
282
|
rows: 2
|
|
282
283
|
})]
|
|
283
284
|
}),
|
|
284
|
-
/* @__PURE__ */
|
|
285
|
+
/* @__PURE__ */ v(e, {}),
|
|
286
|
+
/* @__PURE__ */ y("div", {
|
|
285
287
|
className: "grid gap-1.5",
|
|
286
|
-
children: [/* @__PURE__ */
|
|
288
|
+
children: [/* @__PURE__ */ y("div", {
|
|
287
289
|
className: "flex items-center justify-between gap-2",
|
|
288
|
-
children: [/* @__PURE__ */
|
|
290
|
+
children: [/* @__PURE__ */ v(S, {
|
|
289
291
|
htmlFor: "story-body",
|
|
290
292
|
children: "Body"
|
|
291
|
-
}), /* @__PURE__ */
|
|
293
|
+
}), /* @__PURE__ */ y("span", {
|
|
292
294
|
className: "text-xs tabular-nums text-text-tertiary",
|
|
293
295
|
children: [
|
|
294
296
|
z.length,
|
|
@@ -296,7 +298,7 @@ function P({ open: t, onOpenChange: n, topicId: r, onCreated: u }) {
|
|
|
296
298
|
z.length === 1 ? "character" : "characters"
|
|
297
299
|
]
|
|
298
300
|
})]
|
|
299
|
-
}), /* @__PURE__ */
|
|
301
|
+
}), /* @__PURE__ */ v(j, {
|
|
300
302
|
id: "story-body",
|
|
301
303
|
value: z,
|
|
302
304
|
onChange: (e) => B(e.target.value),
|
|
@@ -304,68 +306,68 @@ function P({ open: t, onOpenChange: n, topicId: r, onCreated: u }) {
|
|
|
304
306
|
rows: 5
|
|
305
307
|
})]
|
|
306
308
|
}),
|
|
307
|
-
/* @__PURE__ */
|
|
309
|
+
/* @__PURE__ */ y("div", {
|
|
308
310
|
className: "grid gap-4 sm:grid-cols-2",
|
|
309
|
-
children: [/* @__PURE__ */
|
|
311
|
+
children: [/* @__PURE__ */ y("div", {
|
|
310
312
|
className: "grid gap-1.5",
|
|
311
|
-
children: [/* @__PURE__ */
|
|
313
|
+
children: [/* @__PURE__ */ v(S, {
|
|
312
314
|
htmlFor: "story-langs",
|
|
313
315
|
children: "Languages"
|
|
314
|
-
}), /* @__PURE__ */
|
|
316
|
+
}), /* @__PURE__ */ v(r, {
|
|
315
317
|
id: "story-langs",
|
|
316
|
-
value:
|
|
317
|
-
onChange:
|
|
318
|
+
value: G,
|
|
319
|
+
onChange: K,
|
|
318
320
|
placeholder: "e.g. English, Tamil…",
|
|
319
321
|
preserveCase: !0
|
|
320
322
|
})]
|
|
321
|
-
}), /* @__PURE__ */
|
|
323
|
+
}), /* @__PURE__ */ y("div", {
|
|
322
324
|
className: "grid gap-1.5",
|
|
323
|
-
children: [/* @__PURE__ */
|
|
325
|
+
children: [/* @__PURE__ */ v(S, {
|
|
324
326
|
htmlFor: "story-tags",
|
|
325
327
|
children: "Tags"
|
|
326
|
-
}), /* @__PURE__ */
|
|
328
|
+
}), /* @__PURE__ */ v(r, {
|
|
327
329
|
id: "story-tags",
|
|
328
|
-
value:
|
|
329
|
-
onChange:
|
|
330
|
+
value: q,
|
|
331
|
+
onChange: J,
|
|
330
332
|
placeholder: "Add tags…"
|
|
331
333
|
})]
|
|
332
334
|
})]
|
|
333
335
|
}),
|
|
334
|
-
|
|
336
|
+
Z && /* @__PURE__ */ v("p", {
|
|
335
337
|
className: "text-sm text-status-error-text",
|
|
336
|
-
children:
|
|
338
|
+
children: Z
|
|
337
339
|
})
|
|
338
340
|
]
|
|
339
341
|
}),
|
|
340
|
-
/* @__PURE__ */
|
|
342
|
+
/* @__PURE__ */ y(E, { children: [/* @__PURE__ */ v(b, {
|
|
341
343
|
variant: "outline",
|
|
342
344
|
onClick: () => n(!1),
|
|
343
345
|
children: "Cancel"
|
|
344
|
-
}), /* @__PURE__ */
|
|
346
|
+
}), /* @__PURE__ */ v(b, {
|
|
345
347
|
onClick: async () => {
|
|
346
|
-
if (!
|
|
348
|
+
if (!g.trim()) Q("A title is required.");
|
|
347
349
|
else if (!$) Q("A URL slug is required.");
|
|
348
350
|
else try {
|
|
349
351
|
let e = await p.mutateAsync({
|
|
350
|
-
title:
|
|
352
|
+
title: g.trim(),
|
|
351
353
|
slug: $,
|
|
352
354
|
summary: L.trim() || null,
|
|
353
355
|
body: z.trim() || null,
|
|
354
356
|
format: V,
|
|
355
|
-
topicId:
|
|
356
|
-
languages:
|
|
357
|
-
tags:
|
|
358
|
-
readingMins:
|
|
359
|
-
coverFileId:
|
|
357
|
+
topicId: U || null,
|
|
358
|
+
languages: G.length ? G : null,
|
|
359
|
+
tags: q.length ? q : null,
|
|
360
|
+
readingMins: Y ? Number(Y) : null,
|
|
361
|
+
coverFileId: ce
|
|
360
362
|
});
|
|
361
|
-
l.success("Story created", e.title), n(!1),
|
|
363
|
+
l.success("Story created", e.title), n(!1), de(), u?.(e);
|
|
362
364
|
} catch (e) {
|
|
363
|
-
let t =
|
|
365
|
+
let t = ee(e);
|
|
364
366
|
Q(t), l.error("Could not create the story", t);
|
|
365
367
|
}
|
|
366
368
|
},
|
|
367
369
|
disabled: p.isPending,
|
|
368
|
-
children: p.isPending ? /* @__PURE__ */ _
|
|
370
|
+
children: p.isPending ? /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v(m, {
|
|
369
371
|
className: "mr-1.5 h-4 w-4 animate-spin",
|
|
370
372
|
"aria-hidden": "true"
|
|
371
373
|
}), " Creating…"] }) : "Create story"
|