@nivaro/react 0.3.17 → 0.3.19
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/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +54 -1
- package/dist/index.js +243 -240
- package/dist/shared/components/CollectionBrowserView.js +439 -438
- package/dist/shared/components/ItemEditForm.js +3758 -3708
- package/dist/shared/components/ProfileView.js +38 -23
- package/dist/shared/components/RecordReadView.js +452 -430
- package/dist/shared/components/bulk/BulkActionButtons.js +113 -106
- package/dist/shared/components/chat/ChannelArchive.js +16 -17
- package/dist/shared/components/chat/ChatPanel.js +992 -930
- package/dist/shared/components/chat/Composer.js +307 -303
- package/dist/shared/components/chat/chat-core.js +8 -4
- package/dist/shared/components/chat/chat-drafts.js +60 -43
- package/dist/shared/components/help-videos/api.js +3 -0
- package/dist/shared/components/help-videos/library/HelpVideoLibrary.js +225 -177
- package/dist/shared/components/item-edit/InlineTableField.js +159 -158
- package/dist/shared/components/item-edit/RecordLiveSync.js +169 -155
- package/dist/shared/components/item-edit/RelationCombobox.js +274 -247
- package/dist/shared/components/item-edit/RowHistorySheet.js +62 -62
- package/dist/shared/components/item-edit/picker-search.js +28 -0
- package/dist/shared/components/panels/RevisionsPanel.js +268 -260
- package/dist/shared/components/profile/BrowserPushCard.js +135 -89
- package/dist/shared/components/profile/push-failure.js +76 -0
- package/dist/shared/lib/display-prefs.js +90 -0
- package/dist/shared/lib/theme-accents.js +21 -16
- package/package.json +1 -1
|
@@ -1,120 +1,138 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { Search as
|
|
4
|
-
import { useId as
|
|
5
|
-
import { toast as
|
|
6
|
-
import { useNivaroClient as
|
|
7
|
-
import { Button as
|
|
8
|
-
import { Input as
|
|
9
|
-
import { modalHostOf as
|
|
10
|
-
import { useHelpVideoLibrary as
|
|
11
|
-
import { HelpVideoEditor as
|
|
12
|
-
import { canRecord as
|
|
13
|
-
import { useHelpVideoRecording as
|
|
14
|
-
import { useHelpVideoUpload as
|
|
15
|
-
import { emptyCopy as
|
|
16
|
-
import { HelpVideoSheet as
|
|
17
|
-
import { momentFromParams as
|
|
18
|
-
import { LearningPathsPanel as
|
|
19
|
-
import { PurgeVideoDialog as
|
|
20
|
-
import { RECORD_UNSUPPORTED as
|
|
21
|
-
const
|
|
1
|
+
import { jsx as t, jsxs as a } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as _e } from "@tanstack/react-query";
|
|
3
|
+
import { Search as Pe, Upload as Te, Plus as ne, History as de, Pencil as Ee, EyeOff as Ae, Send as Re, Archive as Ve, Trash2 as Ie } from "lucide-react";
|
|
4
|
+
import { useId as Le, useState as c, useRef as k, useEffect as U } from "react";
|
|
5
|
+
import { toast as E } from "sonner";
|
|
6
|
+
import { useNivaroClient as Oe, useApiFetchConfig as Ue, useItemEditAuth as He } from "../../../context.js";
|
|
7
|
+
import { Button as n } from "../../ui/button.js";
|
|
8
|
+
import { Input as qe } from "../../ui/input.js";
|
|
9
|
+
import { modalHostOf as ze } from "../../ui/popover.js";
|
|
10
|
+
import { useHelpVideoLibrary as Be, helpVideoApi as C, helpVideoKeys as y, helpVideoError as ce } from "../api.js";
|
|
11
|
+
import { HelpVideoEditor as Fe } from "../editor/HelpVideoEditor.js";
|
|
12
|
+
import { canRecord as Ke } from "../recorder/HelpVideoRecorder.js";
|
|
13
|
+
import { useHelpVideoRecording as Qe, RECORDING_BUSY as je } from "../recorder/HelpVideoRecordingProvider.js";
|
|
14
|
+
import { useHelpVideoUpload as Ge } from "../upload/HelpVideoUpload.js";
|
|
15
|
+
import { emptyCopy as ue, progressLabel as Me, isGettingReady as Ye, formatDuration as Je, showingLabel as he } from "../viewer/format.js";
|
|
16
|
+
import { HelpVideoSheet as Xe } from "../viewer/HelpVideoSheet.js";
|
|
17
|
+
import { momentFromParams as Ze } from "../viewer/moments.js";
|
|
18
|
+
import { LearningPathsPanel as We } from "./LearningPathsPanel.js";
|
|
19
|
+
import { PurgeVideoDialog as et } from "./PurgeVideoDialog.js";
|
|
20
|
+
import { RECORD_UNSUPPORTED as tt } from "../recorder/RecorderStatus.js";
|
|
21
|
+
const at = {
|
|
22
22
|
published: "Published",
|
|
23
23
|
draft: "Drafts",
|
|
24
24
|
archived: "Archived",
|
|
25
25
|
paths: "Paths"
|
|
26
|
-
},
|
|
27
|
-
function
|
|
28
|
-
watchId:
|
|
29
|
-
editId:
|
|
30
|
-
onWatch:
|
|
31
|
-
onEdit:
|
|
26
|
+
}, H = "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan motion-reduce:transition-none";
|
|
27
|
+
function kt({
|
|
28
|
+
watchId: q,
|
|
29
|
+
editId: z,
|
|
30
|
+
onWatch: B,
|
|
31
|
+
onEdit: f,
|
|
32
32
|
headerExtra: me,
|
|
33
|
-
watchAt:
|
|
34
|
-
watchChapter:
|
|
33
|
+
watchAt: pe = null,
|
|
34
|
+
watchChapter: fe = null
|
|
35
35
|
}) {
|
|
36
|
-
var
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
const e = window.setTimeout(() =>
|
|
36
|
+
var te, ae, re, se, ie, le, oe;
|
|
37
|
+
const N = Oe(), b = _e(), { apiBase: be } = Ue(), ge = be.replace(/\/api$/, ""), $ = Ke(), F = Ze(pe, fe), K = Le(), [A, xe] = c(""), [S, ye] = c(""), [g, Ne] = c(), [w, we] = c("published"), D = Qe(), R = Ge({ onDone: (e) => f(e.id) }), [ve, Q] = c(!1), [j, h] = c(null), [v, _] = c(() => /* @__PURE__ */ new Set()), { isAdmin: ke } = He(), [V, I] = c(null), [G, M] = c(() => /* @__PURE__ */ new Set()), P = k(null), x = k(null), Y = k(null), J = k(null), m = k(null);
|
|
38
|
+
U(() => {
|
|
39
|
+
const e = window.setTimeout(() => ye(A.trim()), 300);
|
|
40
40
|
return () => window.clearTimeout(e);
|
|
41
|
-
}, [
|
|
42
|
-
const
|
|
43
|
-
if (
|
|
41
|
+
}, [A]);
|
|
42
|
+
const T = w === "paths", L = T ? "published" : w, i = Be({ search: S || void 0, category: g, status: L }), u = !!((te = i.data) != null && te.can_author), X = ((ae = i.data) == null ? void 0 : ae.data.length) ?? 0, Z = ((re = i.data) == null ? void 0 : re.total) ?? 0, Ce = (((se = i.data) == null ? void 0 : se.data) ?? []).map((e) => e.id).join(",");
|
|
43
|
+
if (U(() => {
|
|
44
44
|
W();
|
|
45
|
-
}, [
|
|
46
|
-
|
|
47
|
-
}, [
|
|
48
|
-
return /* @__PURE__ */ t("div", { className: "flex min-h-0 flex-1 flex-col", children: /* @__PURE__ */ t(
|
|
45
|
+
}, [Ce]), U(() => {
|
|
46
|
+
h(null);
|
|
47
|
+
}, [S, g, w]), z)
|
|
48
|
+
return /* @__PURE__ */ t("div", { className: "flex min-h-0 flex-1 flex-col", children: /* @__PURE__ */ t(Fe, { videoId: z, onClose: () => f(null) }) });
|
|
49
49
|
function W() {
|
|
50
|
-
var
|
|
51
|
-
const e =
|
|
50
|
+
var r;
|
|
51
|
+
const e = x.current;
|
|
52
52
|
if (!e || !m.current || m.current.querySelector(`[data-hv-card="${e.gone}"]`)) return;
|
|
53
|
-
|
|
53
|
+
x.current = null, (r = (e.next ? m.current.querySelector(`[data-hv-purge="${e.next}"]`) : null) ?? Y.current) == null || r.focus();
|
|
54
54
|
}
|
|
55
|
-
const
|
|
56
|
-
var
|
|
57
|
-
const
|
|
55
|
+
const $e = async (e) => {
|
|
56
|
+
var p;
|
|
57
|
+
const s = ((p = i.data) == null ? void 0 : p.data) ?? [], r = s.findIndex((d) => d.id === e.id), l = s[r + 1] ?? s[r - 1];
|
|
58
58
|
try {
|
|
59
|
-
await
|
|
60
|
-
} catch (
|
|
61
|
-
const o =
|
|
59
|
+
await C(N).purge(e.id), E.success(`"${e.title}" deleted`);
|
|
60
|
+
} catch (d) {
|
|
61
|
+
const o = ce(d);
|
|
62
62
|
if (!((o == null ? void 0 : o.status) === 404 && o.code === "HELP_VIDEO_NOT_FOUND"))
|
|
63
|
-
return (o == null ? void 0 : o.code) === "HELP_VIDEO_NOT_ARCHIVED" &&
|
|
63
|
+
return (o == null ? void 0 : o.code) === "HELP_VIDEO_NOT_ARCHIVED" && b.invalidateQueries({ queryKey: y.all }), { ok: !1, message: `It could not be deleted. ${d.message}` };
|
|
64
64
|
}
|
|
65
|
-
return
|
|
65
|
+
return x.current = { gone: e.id, next: (l == null ? void 0 : l.id) ?? null }, I(null), b.invalidateQueries({ queryKey: y.all }).then(
|
|
66
66
|
() => window.setTimeout(() => {
|
|
67
|
-
var
|
|
68
|
-
|
|
67
|
+
var d;
|
|
68
|
+
x.current && (x.current = null, (d = P.current) != null && d.isConnected && P.current.focus());
|
|
69
69
|
}, 0)
|
|
70
70
|
), { ok: !0 };
|
|
71
|
-
},
|
|
72
|
-
var
|
|
71
|
+
}, Se = async (e) => {
|
|
72
|
+
var s;
|
|
73
73
|
if (!G.has(e.id)) {
|
|
74
|
-
|
|
74
|
+
h(null), M((r) => new Set(r).add(e.id));
|
|
75
75
|
try {
|
|
76
|
-
await
|
|
77
|
-
} catch (
|
|
78
|
-
((
|
|
76
|
+
await C(N).dismissStale(e.id), E.success(`The note on "${e.title}" was dismissed`), b.invalidateQueries({ queryKey: y.all });
|
|
77
|
+
} catch (r) {
|
|
78
|
+
((s = ce(r)) == null ? void 0 : s.code) === "HELP_VIDEO_NOT_STALE" ? b.invalidateQueries({ queryKey: y.all }) : h(`The note on "${e.title}" could not be dismissed. ${r.message}`);
|
|
79
79
|
} finally {
|
|
80
|
-
M((
|
|
81
|
-
const l = new Set(
|
|
80
|
+
M((r) => {
|
|
81
|
+
const l = new Set(r);
|
|
82
82
|
return l.delete(e.id), l;
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
-
},
|
|
87
|
-
if (
|
|
88
|
-
|
|
86
|
+
}, ee = async (e, s) => {
|
|
87
|
+
if (v.has(e.id)) return;
|
|
88
|
+
h(null), _((l) => new Set(l).add(e.id));
|
|
89
|
+
const r = e.title || "Untitled video";
|
|
90
|
+
try {
|
|
91
|
+
s === "draft" ? await C(N).unpublish(e.id) : await C(N).publish(e.id, !1), E.success(
|
|
92
|
+
s === "draft" ? `"${r}" is back in Drafts — viewers no longer see it` : `"${r}" is published again`
|
|
93
|
+
), b.invalidateQueries({ queryKey: y.all });
|
|
94
|
+
} catch (l) {
|
|
95
|
+
h(
|
|
96
|
+
`"${r}" could not be ${s === "draft" ? "unpublished" : "published again"}. ${l.message}`
|
|
97
|
+
);
|
|
98
|
+
} finally {
|
|
99
|
+
_((l) => {
|
|
100
|
+
const p = new Set(l);
|
|
101
|
+
return p.delete(e.id), p;
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}, De = async (e) => {
|
|
105
|
+
if (!v.has(e.id)) {
|
|
106
|
+
h(null), _((s) => new Set(s).add(e.id));
|
|
89
107
|
try {
|
|
90
|
-
await
|
|
91
|
-
} catch (
|
|
92
|
-
|
|
108
|
+
await C(N).archive(e.id), E.success(`"${e.title}" archived`), b.invalidateQueries({ queryKey: y.all });
|
|
109
|
+
} catch (s) {
|
|
110
|
+
h(`"${e.title}" could not be archived. ${s.message}`);
|
|
93
111
|
} finally {
|
|
94
|
-
|
|
95
|
-
const
|
|
96
|
-
return
|
|
112
|
+
_((s) => {
|
|
113
|
+
const r = new Set(s);
|
|
114
|
+
return r.delete(e.id), r;
|
|
97
115
|
});
|
|
98
116
|
}
|
|
99
117
|
}
|
|
100
118
|
};
|
|
101
|
-
return /* @__PURE__ */
|
|
102
|
-
/* @__PURE__ */
|
|
119
|
+
return /* @__PURE__ */ a("div", { ref: m, className: "flex min-h-0 flex-1 flex-col", "data-hv-library": !0, children: [
|
|
120
|
+
/* @__PURE__ */ a("header", { className: "flex shrink-0 flex-wrap items-center gap-3 border-b border-border px-5 py-3", children: [
|
|
103
121
|
/* @__PURE__ */ t("h1", { className: "text-[16px] font-semibold", children: "Videos" }),
|
|
104
|
-
/* @__PURE__ */
|
|
122
|
+
/* @__PURE__ */ a("div", { className: "relative min-w-[180px] flex-1 basis-full sm:basis-auto sm:max-w-[320px]", children: [
|
|
105
123
|
/* @__PURE__ */ t(
|
|
106
|
-
|
|
124
|
+
Pe,
|
|
107
125
|
{
|
|
108
126
|
"aria-hidden": "true",
|
|
109
127
|
className: "pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"
|
|
110
128
|
}
|
|
111
129
|
),
|
|
112
130
|
/* @__PURE__ */ t(
|
|
113
|
-
|
|
131
|
+
qe,
|
|
114
132
|
{
|
|
115
133
|
type: "search",
|
|
116
|
-
value:
|
|
117
|
-
onChange: (e) =>
|
|
134
|
+
value: A,
|
|
135
|
+
onChange: (e) => xe(e.target.value),
|
|
118
136
|
placeholder: "Search videos",
|
|
119
137
|
"aria-label": "Search videos",
|
|
120
138
|
className: "h-8 pl-8 text-[13px]",
|
|
@@ -122,51 +140,51 @@ function Nt({
|
|
|
122
140
|
}
|
|
123
141
|
)
|
|
124
142
|
] }),
|
|
125
|
-
|
|
143
|
+
u && /* @__PURE__ */ a("fieldset", { className: "m-0 flex min-w-0 gap-1 border-0 p-0", children: [
|
|
126
144
|
/* @__PURE__ */ t("legend", { className: "sr-only", children: "Show" }),
|
|
127
145
|
["published", "draft", "archived", "paths"].map((e) => /* @__PURE__ */ t(
|
|
128
146
|
"button",
|
|
129
147
|
{
|
|
130
148
|
type: "button",
|
|
131
|
-
"aria-pressed":
|
|
132
|
-
onClick: () =>
|
|
133
|
-
className: `rounded-md px-2.5 py-1 text-[12.5px] transition-colors ${
|
|
149
|
+
"aria-pressed": w === e,
|
|
150
|
+
onClick: () => we(e),
|
|
151
|
+
className: `rounded-md px-2.5 py-1 text-[12.5px] transition-colors ${H} ${w === e ? "bg-nvr-cyan/10 font-medium" : "hover:bg-muted"}`,
|
|
134
152
|
"data-hv-status-tab": e,
|
|
135
|
-
children:
|
|
153
|
+
children: at[e]
|
|
136
154
|
},
|
|
137
155
|
e
|
|
138
156
|
))
|
|
139
157
|
] }),
|
|
140
|
-
/* @__PURE__ */
|
|
158
|
+
/* @__PURE__ */ a("div", { className: "ml-auto flex items-center gap-2", children: [
|
|
141
159
|
me,
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
/* @__PURE__ */
|
|
145
|
-
|
|
160
|
+
u && /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
|
|
161
|
+
!$ && /* @__PURE__ */ t("p", { id: K, className: "max-w-[260px] text-[12px] text-muted-foreground", children: tt }),
|
|
162
|
+
/* @__PURE__ */ a(
|
|
163
|
+
n,
|
|
146
164
|
{
|
|
147
165
|
size: "sm",
|
|
148
166
|
variant: "outline",
|
|
149
|
-
onClick:
|
|
150
|
-
disabled:
|
|
167
|
+
onClick: R.pick,
|
|
168
|
+
disabled: R.busy,
|
|
151
169
|
"data-hv-upload": !0,
|
|
152
170
|
children: [
|
|
153
|
-
/* @__PURE__ */ t(
|
|
171
|
+
/* @__PURE__ */ t(Te, { className: "h-4 w-4" }),
|
|
154
172
|
" Upload a video"
|
|
155
173
|
]
|
|
156
174
|
}
|
|
157
175
|
),
|
|
158
|
-
/* @__PURE__ */
|
|
159
|
-
|
|
176
|
+
/* @__PURE__ */ a(
|
|
177
|
+
n,
|
|
160
178
|
{
|
|
161
179
|
size: "sm",
|
|
162
|
-
onClick: () =>
|
|
163
|
-
!
|
|
180
|
+
onClick: () => Q(
|
|
181
|
+
!D.start({ onDone: (e) => f(e.id), from: m.current })
|
|
164
182
|
),
|
|
165
|
-
disabled:
|
|
166
|
-
"aria-describedby":
|
|
183
|
+
disabled: !$,
|
|
184
|
+
"aria-describedby": $ ? void 0 : K,
|
|
167
185
|
"data-hv-record": !0,
|
|
168
186
|
children: [
|
|
169
|
-
/* @__PURE__ */ t(
|
|
187
|
+
/* @__PURE__ */ t(ne, { className: "h-4 w-4" }),
|
|
170
188
|
" Record a video"
|
|
171
189
|
]
|
|
172
190
|
}
|
|
@@ -174,90 +192,90 @@ function Nt({
|
|
|
174
192
|
] })
|
|
175
193
|
] })
|
|
176
194
|
] }),
|
|
177
|
-
|
|
195
|
+
!T && !!((ie = i.data) != null && ie.categories.length) && /* @__PURE__ */ t("div", { className: "flex shrink-0 flex-wrap gap-1 px-5 pt-3", children: [void 0, ...i.data.categories].map((e) => /* @__PURE__ */ t(
|
|
178
196
|
"button",
|
|
179
197
|
{
|
|
180
198
|
type: "button",
|
|
181
|
-
"aria-pressed":
|
|
182
|
-
onClick: () =>
|
|
183
|
-
className: `rounded-full border px-2.5 py-0.5 text-[12px] transition-colors ${
|
|
199
|
+
"aria-pressed": g === e,
|
|
200
|
+
onClick: () => Ne(e),
|
|
201
|
+
className: `rounded-full border px-2.5 py-0.5 text-[12px] transition-colors ${H} ${g === e ? "border-nvr-cyan bg-nvr-cyan/10" : "border-border hover:bg-muted"}`,
|
|
184
202
|
children: e ?? "All"
|
|
185
203
|
},
|
|
186
204
|
e ?? "all"
|
|
187
205
|
)) }),
|
|
188
|
-
ve &&
|
|
189
|
-
|
|
206
|
+
ve && D.active && /* @__PURE__ */ t("p", { role: "status", className: "mx-5 mt-3 text-[13px] text-rose-700 dark:text-rose-300", children: je }),
|
|
207
|
+
j && /* @__PURE__ */ t(
|
|
190
208
|
"p",
|
|
191
209
|
{
|
|
192
210
|
role: "alert",
|
|
193
211
|
className: "mx-5 mt-3 rounded-md border border-rose-200 bg-rose-50 px-3 py-2 text-[13px] text-rose-800 dark:border-rose-500/30 dark:bg-rose-500/10 dark:text-rose-200",
|
|
194
212
|
"data-hv-archive-error": !0,
|
|
195
|
-
children:
|
|
213
|
+
children: j
|
|
196
214
|
}
|
|
197
215
|
),
|
|
198
|
-
|
|
199
|
-
/* @__PURE__ */
|
|
216
|
+
T && u && /* @__PURE__ */ t("div", { className: "min-h-0 flex-1 overflow-y-auto p-5", children: /* @__PURE__ */ t(We, {}) }),
|
|
217
|
+
/* @__PURE__ */ a(
|
|
200
218
|
"div",
|
|
201
219
|
{
|
|
202
220
|
ref: Y,
|
|
203
221
|
tabIndex: -1,
|
|
204
222
|
className: "min-h-0 flex-1 overflow-y-auto p-5 focus:outline-none",
|
|
205
223
|
"data-hv-list": !0,
|
|
206
|
-
hidden:
|
|
224
|
+
hidden: T && u,
|
|
207
225
|
children: [
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
/* @__PURE__ */ t("p", { className: "text-[13px] text-muted-foreground", children:
|
|
212
|
-
|
|
213
|
-
|
|
226
|
+
i.isLoading && /* @__PURE__ */ t("p", { className: "text-[13px] text-muted-foreground", children: "Loading…" }),
|
|
227
|
+
i.isError && /* @__PURE__ */ t("p", { role: "alert", className: "mb-3 text-[13px] text-rose-700 dark:text-rose-300", children: "Videos could not be loaded. Try again in a moment." }),
|
|
228
|
+
i.data && !i.data.data.length && !i.isError && /* @__PURE__ */ a("div", { className: "space-y-2", "data-hv-empty": !0, children: [
|
|
229
|
+
/* @__PURE__ */ t("p", { className: "text-[13px] text-muted-foreground", children: ue({ search: S, category: g, status: L, canAuthor: u }).text }),
|
|
230
|
+
ue({ search: S, category: g, status: L, canAuthor: u }).offerRecord && $ && /* @__PURE__ */ a(
|
|
231
|
+
n,
|
|
214
232
|
{
|
|
215
233
|
size: "sm",
|
|
216
234
|
variant: "outline",
|
|
217
|
-
onClick: () =>
|
|
218
|
-
!
|
|
235
|
+
onClick: () => Q(
|
|
236
|
+
!D.start({ onDone: (e) => f(e.id), from: m.current })
|
|
219
237
|
),
|
|
220
238
|
children: [
|
|
221
|
-
/* @__PURE__ */ t(
|
|
239
|
+
/* @__PURE__ */ t(ne, { className: "h-4 w-4" }),
|
|
222
240
|
" Record one"
|
|
223
241
|
]
|
|
224
242
|
}
|
|
225
243
|
)
|
|
226
244
|
] }),
|
|
227
|
-
/* @__PURE__ */ t("ul", { className: "grid gap-4 [grid-template-columns:repeat(auto-fill,minmax(240px,1fr))]", children: (((
|
|
245
|
+
/* @__PURE__ */ t("ul", { className: "grid gap-4 [grid-template-columns:repeat(auto-fill,minmax(240px,1fr))]", children: (((le = i.data) == null ? void 0 : le.data) ?? []).map((e) => {
|
|
228
246
|
var o;
|
|
229
|
-
const
|
|
247
|
+
const s = Me(e), r = Ye(e), l = ((o = e.published) == null ? void 0 : o.edits.chapters.length) ?? 0, p = !!e.published && e.required && !s.done && !r, d = [
|
|
230
248
|
e.category,
|
|
231
249
|
l > 1 ? `${l} chapters` : null,
|
|
232
|
-
e.published ?
|
|
250
|
+
e.published ? e.status === "draft" ? "Unpublished" : r ? "Getting ready" : s.text : "Draft"
|
|
233
251
|
].filter(Boolean).join(" · ");
|
|
234
|
-
return /* @__PURE__ */
|
|
252
|
+
return /* @__PURE__ */ a(
|
|
235
253
|
"li",
|
|
236
254
|
{
|
|
237
255
|
className: "group overflow-hidden rounded-lg border border-border bg-card",
|
|
238
256
|
"data-hv-card": e.id,
|
|
239
257
|
children: [
|
|
240
|
-
/* @__PURE__ */
|
|
258
|
+
/* @__PURE__ */ a(
|
|
241
259
|
"button",
|
|
242
260
|
{
|
|
243
261
|
type: "button",
|
|
244
|
-
className: `block w-full text-left ${
|
|
245
|
-
onClick: (
|
|
246
|
-
J.current =
|
|
262
|
+
className: `block w-full text-left ${H}`,
|
|
263
|
+
onClick: (O) => {
|
|
264
|
+
J.current = O.currentTarget, e.published ? B(e.id) : f(e.id);
|
|
247
265
|
},
|
|
248
266
|
children: [
|
|
249
|
-
/* @__PURE__ */
|
|
267
|
+
/* @__PURE__ */ a("div", { className: "relative aspect-video bg-slate-100 dark:bg-slate-800", children: [
|
|
250
268
|
e.poster_url && /* @__PURE__ */ t(
|
|
251
269
|
"img",
|
|
252
270
|
{
|
|
253
|
-
src: `${
|
|
271
|
+
src: `${ge}${e.poster_url}`,
|
|
254
272
|
alt: "",
|
|
255
273
|
className: "h-full w-full object-cover",
|
|
256
274
|
loading: "lazy"
|
|
257
275
|
}
|
|
258
276
|
),
|
|
259
|
-
!
|
|
260
|
-
e.my_progress && !
|
|
277
|
+
!r && e.published && /* @__PURE__ */ t("span", { className: "absolute bottom-1.5 right-1.5 rounded bg-[#0f172a]/80 px-1.5 py-0.5 text-[11px] tabular-nums text-white", children: Je(e.duration_ms) }),
|
|
278
|
+
e.my_progress && !s.done && e.my_progress.percent > 0 && /* @__PURE__ */ t("span", { className: "absolute inset-x-0 bottom-0 h-1 bg-black/20", children: /* @__PURE__ */ t(
|
|
261
279
|
"span",
|
|
262
280
|
{
|
|
263
281
|
className: "block h-full bg-[#2563eb]",
|
|
@@ -265,26 +283,26 @@ function Nt({
|
|
|
265
283
|
}
|
|
266
284
|
) })
|
|
267
285
|
] }),
|
|
268
|
-
/* @__PURE__ */
|
|
286
|
+
/* @__PURE__ */ a("div", { className: "space-y-0.5 p-2.5", children: [
|
|
269
287
|
/* @__PURE__ */ t("p", { className: "line-clamp-2 text-[13px] font-medium", children: e.title || "Untitled video" }),
|
|
270
288
|
/* @__PURE__ */ t(
|
|
271
289
|
"p",
|
|
272
290
|
{
|
|
273
|
-
className: `text-[12px] ${
|
|
274
|
-
children:
|
|
291
|
+
className: `text-[12px] ${p ? "text-rose-700 dark:text-rose-300" : "text-muted-foreground"}`,
|
|
292
|
+
children: d
|
|
275
293
|
}
|
|
276
294
|
),
|
|
277
|
-
e.stale && /* @__PURE__ */
|
|
295
|
+
e.stale && /* @__PURE__ */ a(
|
|
278
296
|
"p",
|
|
279
297
|
{
|
|
280
298
|
className: "flex items-start gap-1 text-[12px] text-amber-800 dark:text-amber-200",
|
|
281
299
|
title: e.stale.detail,
|
|
282
300
|
"data-hv-stale": e.stale.kind,
|
|
283
301
|
children: [
|
|
284
|
-
/* @__PURE__ */ t(
|
|
285
|
-
/* @__PURE__ */
|
|
302
|
+
/* @__PURE__ */ t(de, { className: "mt-px h-3.5 w-3.5 shrink-0", "aria-hidden": !0 }),
|
|
303
|
+
/* @__PURE__ */ a("span", { className: "line-clamp-2", children: [
|
|
286
304
|
"May be out of date",
|
|
287
|
-
|
|
305
|
+
u ? `: ${e.stale.detail}` : ""
|
|
288
306
|
] })
|
|
289
307
|
]
|
|
290
308
|
}
|
|
@@ -293,62 +311,92 @@ function Nt({
|
|
|
293
311
|
]
|
|
294
312
|
}
|
|
295
313
|
),
|
|
296
|
-
|
|
297
|
-
e.stale && /* @__PURE__ */
|
|
298
|
-
|
|
314
|
+
u && /* @__PURE__ */ a("div", { className: "flex flex-wrap gap-1 border-t border-border px-1.5 py-1", children: [
|
|
315
|
+
e.stale && /* @__PURE__ */ a(
|
|
316
|
+
n,
|
|
299
317
|
{
|
|
300
318
|
size: "sm",
|
|
301
319
|
variant: "ghost",
|
|
302
|
-
onClick: () => void
|
|
320
|
+
onClick: () => void Se(e),
|
|
303
321
|
disabled: G.has(e.id),
|
|
304
322
|
"aria-label": `Dismiss the out-of-date note on ${e.title || "Untitled video"}`,
|
|
305
323
|
"data-hv-stale-dismiss": e.id,
|
|
306
324
|
children: [
|
|
307
|
-
/* @__PURE__ */ t(
|
|
325
|
+
/* @__PURE__ */ t(de, { className: "h-3.5 w-3.5" }),
|
|
308
326
|
" Dismiss"
|
|
309
327
|
]
|
|
310
328
|
}
|
|
311
329
|
),
|
|
312
|
-
/* @__PURE__ */
|
|
313
|
-
|
|
330
|
+
/* @__PURE__ */ a(
|
|
331
|
+
n,
|
|
314
332
|
{
|
|
315
333
|
size: "sm",
|
|
316
334
|
variant: "ghost",
|
|
317
|
-
onClick: () =>
|
|
335
|
+
onClick: () => f(e.id),
|
|
318
336
|
"data-hv-edit": e.id,
|
|
319
337
|
children: [
|
|
320
|
-
/* @__PURE__ */ t(
|
|
338
|
+
/* @__PURE__ */ t(Ee, { className: "h-3.5 w-3.5" }),
|
|
321
339
|
" Edit"
|
|
322
340
|
]
|
|
323
341
|
}
|
|
324
342
|
),
|
|
325
|
-
e.status
|
|
326
|
-
|
|
343
|
+
e.status === "published" && /* @__PURE__ */ a(
|
|
344
|
+
n,
|
|
327
345
|
{
|
|
328
346
|
size: "sm",
|
|
329
347
|
variant: "ghost",
|
|
330
|
-
onClick: () => void
|
|
331
|
-
disabled:
|
|
332
|
-
"data-
|
|
348
|
+
onClick: () => void ee(e, "draft"),
|
|
349
|
+
disabled: v.has(e.id),
|
|
350
|
+
"data-tip": "Back to Drafts: viewers stop seeing it until you publish it again",
|
|
351
|
+
"data-hv-unpublish": e.id,
|
|
333
352
|
children: [
|
|
334
353
|
/* @__PURE__ */ t(Ae, { className: "h-3.5 w-3.5" }),
|
|
354
|
+
" Unpublish"
|
|
355
|
+
]
|
|
356
|
+
}
|
|
357
|
+
),
|
|
358
|
+
e.status === "draft" && !!e.published && (!e.draft || e.draft_matches_published) && /* @__PURE__ */ a(
|
|
359
|
+
n,
|
|
360
|
+
{
|
|
361
|
+
size: "sm",
|
|
362
|
+
variant: "ghost",
|
|
363
|
+
onClick: () => void ee(e, "published"),
|
|
364
|
+
disabled: v.has(e.id),
|
|
365
|
+
"data-tip": "Put the last published version back for viewers",
|
|
366
|
+
"data-hv-republish": e.id,
|
|
367
|
+
children: [
|
|
368
|
+
/* @__PURE__ */ t(Re, { className: "h-3.5 w-3.5" }),
|
|
369
|
+
" Publish again"
|
|
370
|
+
]
|
|
371
|
+
}
|
|
372
|
+
),
|
|
373
|
+
e.status !== "archived" && /* @__PURE__ */ a(
|
|
374
|
+
n,
|
|
375
|
+
{
|
|
376
|
+
size: "sm",
|
|
377
|
+
variant: "ghost",
|
|
378
|
+
onClick: () => void De(e),
|
|
379
|
+
disabled: v.has(e.id),
|
|
380
|
+
"data-hv-archive": e.id,
|
|
381
|
+
children: [
|
|
382
|
+
/* @__PURE__ */ t(Ve, { className: "h-3.5 w-3.5" }),
|
|
335
383
|
" Archive"
|
|
336
384
|
]
|
|
337
385
|
}
|
|
338
386
|
),
|
|
339
|
-
|
|
340
|
-
|
|
387
|
+
ke && e.status === "archived" && /* @__PURE__ */ a(
|
|
388
|
+
n,
|
|
341
389
|
{
|
|
342
390
|
size: "sm",
|
|
343
391
|
variant: "ghost",
|
|
344
392
|
className: "text-rose-700 hover:text-rose-800 dark:text-rose-300 dark:hover:text-rose-200",
|
|
345
|
-
onClick: (
|
|
346
|
-
|
|
393
|
+
onClick: (O) => {
|
|
394
|
+
P.current = O.currentTarget, I(e);
|
|
347
395
|
},
|
|
348
396
|
"aria-label": `Delete permanently: ${e.title || "Untitled video"}`,
|
|
349
397
|
"data-hv-purge": e.id,
|
|
350
398
|
children: [
|
|
351
|
-
/* @__PURE__ */ t(
|
|
399
|
+
/* @__PURE__ */ t(Ie, { className: "h-3.5 w-3.5" }),
|
|
352
400
|
" Delete permanently"
|
|
353
401
|
]
|
|
354
402
|
}
|
|
@@ -359,51 +407,51 @@ function Nt({
|
|
|
359
407
|
e.id
|
|
360
408
|
);
|
|
361
409
|
}) }),
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
410
|
+
i.data && i.data.data.length > 0 && /* @__PURE__ */ a("div", { className: "mt-5 flex items-center gap-3", "data-hv-more": !0, children: [
|
|
411
|
+
i.hasNextPage && /* @__PURE__ */ t(
|
|
412
|
+
n,
|
|
365
413
|
{
|
|
366
414
|
size: "sm",
|
|
367
415
|
variant: "outline",
|
|
368
|
-
onClick: () => void
|
|
369
|
-
disabled:
|
|
416
|
+
onClick: () => void i.fetchNextPage(),
|
|
417
|
+
disabled: i.isFetchingNextPage,
|
|
370
418
|
"data-hv-show-more": !0,
|
|
371
|
-
children:
|
|
419
|
+
children: i.isFetchingNextPage ? "Loading…" : "Show more"
|
|
372
420
|
}
|
|
373
421
|
),
|
|
374
|
-
|
|
422
|
+
he(X, Z) && /* @__PURE__ */ t("p", { className: "text-[12px] text-muted-foreground", "aria-live": "polite", children: he(X, Z) })
|
|
375
423
|
] })
|
|
376
424
|
]
|
|
377
425
|
}
|
|
378
426
|
),
|
|
379
|
-
|
|
380
|
-
|
|
427
|
+
V && /* @__PURE__ */ t(
|
|
428
|
+
et,
|
|
381
429
|
{
|
|
382
|
-
title:
|
|
383
|
-
container:
|
|
384
|
-
onConfirm: () =>
|
|
385
|
-
onClose: () =>
|
|
430
|
+
title: V.title || "Untitled video",
|
|
431
|
+
container: ze((oe = m.current) == null ? void 0 : oe.firstElementChild),
|
|
432
|
+
onConfirm: () => $e(V),
|
|
433
|
+
onClose: () => I(null),
|
|
386
434
|
restoreFocus: () => {
|
|
387
435
|
var e;
|
|
388
|
-
|
|
436
|
+
x.current ? W() : (e = P.current) == null || e.focus();
|
|
389
437
|
}
|
|
390
438
|
}
|
|
391
439
|
),
|
|
392
440
|
/* @__PURE__ */ t(
|
|
393
|
-
|
|
441
|
+
Xe,
|
|
394
442
|
{
|
|
395
|
-
videoId:
|
|
396
|
-
open: !!
|
|
397
|
-
onOpenChange: (e) => !e &&
|
|
443
|
+
videoId: q,
|
|
444
|
+
open: !!q,
|
|
445
|
+
onOpenChange: (e) => !e && B(null),
|
|
398
446
|
returnFocusRef: J,
|
|
399
|
-
startAtMs:
|
|
400
|
-
startChapterId:
|
|
447
|
+
startAtMs: F.atMs,
|
|
448
|
+
startChapterId: F.chapterId
|
|
401
449
|
}
|
|
402
450
|
),
|
|
403
|
-
|
|
404
|
-
|
|
451
|
+
D.fallback,
|
|
452
|
+
R.ui
|
|
405
453
|
] });
|
|
406
454
|
}
|
|
407
455
|
export {
|
|
408
|
-
|
|
456
|
+
kt as HelpVideoLibrary
|
|
409
457
|
};
|