@nivaro/react 0.3.61 → 0.3.63
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 +66 -0
- package/dist/index.js +239 -235
- package/dist/shared/components/CollectionBrowserView.js +424 -420
- package/dist/shared/components/ItemEditForm.js +3576 -3561
- package/dist/shared/components/QualityRulesView.js +212 -138
- package/dist/shared/components/alerts/AlertManagerView.js +341 -335
- package/dist/shared/components/help-videos/library/LearningPathsPanel.js +102 -98
- package/dist/shared/components/help-videos/library/PurgeVideoDialog.js +8 -8
- package/dist/shared/components/import/reimportDiff.js +67 -46
- package/dist/shared/components/imports/CollectionImportPanel.js +273 -247
- package/dist/shared/components/item-edit/QueueReturnChip.js +17 -13
- package/dist/shared/components/item-edit/staged-links.js +21 -21
- package/dist/shared/components/pipeline/PipelineEditorView.js +636 -632
- package/dist/shared/components/pipeline/PipelineStateOwners.js +88 -87
- package/dist/shared/components/queue/QueueWorklist.js +224 -222
- package/dist/shared/lib/batch-gets.js +68 -0
- package/dist/shared/lib/list-page-memory.js +40 -32
- package/dist/shared/lib/request-gate.js +284 -230
- package/package.json +1 -1
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as i, jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import { useQueryClient as j, useQuery as G } from "@tanstack/react-query";
|
|
3
|
-
import { Plus as I, X as A, GripVertical as W, ArrowUp as
|
|
3
|
+
import { Plus as I, X as A, GripVertical as W, ArrowUp as B, ArrowDown as O, Trash2 as H } from "lucide-react";
|
|
4
4
|
import { useState as b, useId as X } from "react";
|
|
5
5
|
import { toast as T } from "sonner";
|
|
6
|
-
import { useNivaroClient as
|
|
6
|
+
import { useNivaroClient as K } from "../../../context.js";
|
|
7
7
|
import { get as J } from "../../../lib/commands.js";
|
|
8
8
|
import { userErrorMessage as z } from "../../../lib/safe-error.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { cn as Y } from "../../../lib/utils.js";
|
|
10
|
+
import { ConfirmButton as Z } from "../../profile/primitives.js";
|
|
11
|
+
import { Button as f, buttonVariants as ee } from "../../ui/button.js";
|
|
12
|
+
import { Input as te } from "../../ui/input.js";
|
|
11
13
|
import { Label as C } from "../../ui/label.js";
|
|
12
14
|
import { Switch as F } from "../../ui/switch.js";
|
|
13
|
-
import { Textarea as
|
|
14
|
-
import { useLearningPaths as
|
|
15
|
-
import { PickerCombo as M, RemovableChip as
|
|
16
|
-
import { formatDuration as
|
|
15
|
+
import { Textarea as ae } from "../../ui/textarea.js";
|
|
16
|
+
import { useLearningPaths as re, learningPathApi as se, helpVideoKeys as $, useHelpVideoLibrary as ie } from "../api.js";
|
|
17
|
+
import { PickerCombo as M, RemovableChip as oe } from "../editor/PickerCombo.js";
|
|
18
|
+
import { formatDuration as V } from "../viewer/format.js";
|
|
17
19
|
import { moveItem as P } from "../viewer/paths.js";
|
|
18
20
|
const q = "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan motion-reduce:transition-none";
|
|
19
|
-
function
|
|
21
|
+
function de(a) {
|
|
20
22
|
return {
|
|
21
23
|
title: (a == null ? void 0 : a.title) ?? "",
|
|
22
24
|
description: (a == null ? void 0 : a.description) ?? "",
|
|
@@ -26,13 +28,13 @@ function ie(a) {
|
|
|
26
28
|
roles: (a == null ? void 0 : a.roles.map((c) => ({ role_id: c.role_id, required: c.required }))) ?? []
|
|
27
29
|
};
|
|
28
30
|
}
|
|
29
|
-
function
|
|
30
|
-
var
|
|
31
|
-
const a =
|
|
32
|
-
return /* @__PURE__ */
|
|
33
|
-
/* @__PURE__ */
|
|
31
|
+
function Pe() {
|
|
32
|
+
var s, N;
|
|
33
|
+
const a = K(), c = j(), m = re(), [d, g] = b(null), u = d && d !== "new" ? ((s = m.data) == null ? void 0 : s.find((o) => o.id === d)) ?? null : null;
|
|
34
|
+
return /* @__PURE__ */ i("div", { className: "space-y-4", "data-hv-paths": !0, children: [
|
|
35
|
+
/* @__PURE__ */ i("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
34
36
|
/* @__PURE__ */ t("p", { className: "text-[13px] text-muted-foreground", children: 'An ordered list of videos for a role — "Getting started as a Workflow Creator". People see it on My Work with their progress and a Continue button; a required path joins their required list until every video in it is watched.' }),
|
|
35
|
-
/* @__PURE__ */
|
|
37
|
+
/* @__PURE__ */ i(f, { size: "sm", className: "ml-auto", onClick: () => g("new"), "data-hv-path-new": !0, children: [
|
|
36
38
|
/* @__PURE__ */ t(I, { className: "h-4 w-4" }),
|
|
37
39
|
" New path"
|
|
38
40
|
] })
|
|
@@ -40,14 +42,14 @@ function _e() {
|
|
|
40
42
|
m.isLoading && /* @__PURE__ */ t("p", { className: "text-[13px] text-muted-foreground", children: "Loading…" }),
|
|
41
43
|
m.isError && /* @__PURE__ */ t("p", { role: "alert", className: "text-[13px] text-rose-700 dark:text-rose-300", children: "Paths could not be loaded. Try again in a moment." }),
|
|
42
44
|
m.data && m.data.length === 0 && d !== "new" && /* @__PURE__ */ t("p", { className: "text-[13px] text-muted-foreground", "data-hv-paths-empty": !0, children: "No learning paths yet." }),
|
|
43
|
-
!!((
|
|
45
|
+
!!((N = m.data) != null && N.length) && /* @__PURE__ */ t("ul", { className: "divide-y divide-border rounded-lg border border-border bg-card", children: m.data.map((o) => /* @__PURE__ */ i(
|
|
44
46
|
"li",
|
|
45
47
|
{
|
|
46
48
|
className: "flex flex-wrap items-center gap-x-3 gap-y-1 px-3 py-2",
|
|
47
49
|
"data-hv-path-row": o.id,
|
|
48
50
|
children: [
|
|
49
51
|
/* @__PURE__ */ t("span", { className: "min-w-[10rem] flex-1 truncate text-[13px] font-medium", children: o.title || "Untitled path" }),
|
|
50
|
-
/* @__PURE__ */
|
|
52
|
+
/* @__PURE__ */ i("span", { className: "text-[12px] text-muted-foreground", children: [
|
|
51
53
|
o.status === "published" ? "Published" : "Draft",
|
|
52
54
|
" · ",
|
|
53
55
|
o.items.length,
|
|
@@ -60,11 +62,11 @@ function _e() {
|
|
|
60
62
|
o.new_user ? " · New users" : ""
|
|
61
63
|
] }),
|
|
62
64
|
/* @__PURE__ */ t(
|
|
63
|
-
|
|
65
|
+
f,
|
|
64
66
|
{
|
|
65
67
|
size: "sm",
|
|
66
68
|
variant: "ghost",
|
|
67
|
-
onClick: () =>
|
|
69
|
+
onClick: () => g(o.id),
|
|
68
70
|
"data-hv-path-edit": o.id,
|
|
69
71
|
children: "Edit"
|
|
70
72
|
}
|
|
@@ -74,30 +76,30 @@ function _e() {
|
|
|
74
76
|
o.id
|
|
75
77
|
)) }),
|
|
76
78
|
d && /* @__PURE__ */ t(
|
|
77
|
-
|
|
79
|
+
le,
|
|
78
80
|
{
|
|
79
81
|
path: u,
|
|
80
|
-
onClose: () =>
|
|
82
|
+
onClose: () => g(null),
|
|
81
83
|
onSaved: (o) => {
|
|
82
|
-
c.invalidateQueries({ queryKey: $.paths }), c.invalidateQueries({ queryKey: $.myPaths }), c.invalidateQueries({ queryKey: $.required }),
|
|
84
|
+
c.invalidateQueries({ queryKey: $.paths }), c.invalidateQueries({ queryKey: $.myPaths }), c.invalidateQueries({ queryKey: $.required }), g(o ? o.id : null);
|
|
83
85
|
},
|
|
84
|
-
api:
|
|
86
|
+
api: se(a)
|
|
85
87
|
},
|
|
86
88
|
d
|
|
87
89
|
)
|
|
88
90
|
] });
|
|
89
91
|
}
|
|
90
|
-
function
|
|
92
|
+
function le({
|
|
91
93
|
path: a,
|
|
92
94
|
onClose: c,
|
|
93
95
|
onSaved: m,
|
|
94
96
|
api: d
|
|
95
97
|
}) {
|
|
96
98
|
var E, R;
|
|
97
|
-
const
|
|
99
|
+
const g = K(), u = X(), [s, N] = b(() => de(a)), [o, w] = b(!1), [D, y] = b(null), [k, L] = b(null), v = G({
|
|
98
100
|
queryKey: ["chat-roles"],
|
|
99
|
-
queryFn: async () => (await
|
|
100
|
-
}), h =
|
|
101
|
+
queryFn: async () => (await g.request(J("/chat/roles"))).data
|
|
102
|
+
}), h = ie({ status: "published" }), x = /* @__PURE__ */ new Map();
|
|
101
103
|
for (const e of ((E = h.data) == null ? void 0 : E.data) ?? []) x.set(e.id.toLowerCase(), e);
|
|
102
104
|
for (const e of (a == null ? void 0 : a.items) ?? [])
|
|
103
105
|
x.has(e.video_id.toLowerCase()) || x.set(e.video_id.toLowerCase(), e);
|
|
@@ -106,58 +108,58 @@ function se({
|
|
|
106
108
|
return ((r = x.get(e.toLowerCase())) == null ? void 0 : r.title) ?? "Unknown video";
|
|
107
109
|
}, U = (e) => {
|
|
108
110
|
var r, n;
|
|
109
|
-
return ((n = (r =
|
|
110
|
-
}, l = (e) =>
|
|
111
|
-
const e =
|
|
111
|
+
return ((n = (r = v.data) == null ? void 0 : r.find((p) => p.id.toUpperCase() === e.toUpperCase())) == null ? void 0 : n.name) ?? (v.isLoading ? "Loading…" : "Unknown role");
|
|
112
|
+
}, l = (e) => N((r) => ({ ...r, ...e })), Q = async () => {
|
|
113
|
+
const e = s.title.trim();
|
|
112
114
|
if (!e) {
|
|
113
115
|
y("Give the path a title.");
|
|
114
116
|
return;
|
|
115
117
|
}
|
|
116
|
-
|
|
118
|
+
w(!0), y(null);
|
|
117
119
|
try {
|
|
118
120
|
const r = {
|
|
119
121
|
title: e,
|
|
120
|
-
description:
|
|
121
|
-
status:
|
|
122
|
-
new_user:
|
|
122
|
+
description: s.description.trim() || null,
|
|
123
|
+
status: s.status,
|
|
124
|
+
new_user: s.new_user
|
|
123
125
|
}, n = a ? await d.update(a.id, r) : await d.create(r);
|
|
124
|
-
await d.setItems(n.id,
|
|
125
|
-
const p = await d.setRoles(n.id,
|
|
126
|
+
await d.setItems(n.id, s.video_ids);
|
|
127
|
+
const p = await d.setRoles(n.id, s.roles);
|
|
126
128
|
T.success(a ? `"${e}" saved` : `"${e}" created`), m(p);
|
|
127
129
|
} catch (r) {
|
|
128
130
|
y(`The path could not be saved. ${z(r, "")}`);
|
|
129
131
|
} finally {
|
|
130
|
-
|
|
132
|
+
w(!1);
|
|
131
133
|
}
|
|
132
|
-
},
|
|
133
|
-
if (a
|
|
134
|
-
|
|
134
|
+
}, S = async () => {
|
|
135
|
+
if (a) {
|
|
136
|
+
w(!0);
|
|
135
137
|
try {
|
|
136
138
|
await d.remove(a.id), T.success(`"${a.title}" deleted`), m(null);
|
|
137
139
|
} catch (e) {
|
|
138
|
-
y(`The path could not be deleted. ${z(e, "")}`),
|
|
140
|
+
y(`The path could not be deleted. ${z(e, "")}`), w(!1);
|
|
139
141
|
}
|
|
140
142
|
}
|
|
141
143
|
};
|
|
142
|
-
return /* @__PURE__ */
|
|
144
|
+
return /* @__PURE__ */ i(
|
|
143
145
|
"section",
|
|
144
146
|
{
|
|
145
147
|
className: "space-y-4 rounded-lg border border-border bg-card p-4",
|
|
146
148
|
"aria-label": a ? `Edit ${a.title}` : "New learning path",
|
|
147
149
|
"data-hv-path-editor": (a == null ? void 0 : a.id) ?? "new",
|
|
148
150
|
children: [
|
|
149
|
-
/* @__PURE__ */
|
|
151
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
|
|
150
152
|
/* @__PURE__ */ t("h2", { className: "text-[14px] font-semibold", children: a ? "Edit path" : "New path" }),
|
|
151
|
-
/* @__PURE__ */ t(
|
|
153
|
+
/* @__PURE__ */ t(f, { size: "sm", variant: "ghost", className: "ml-auto", onClick: c, "aria-label": "Close", children: /* @__PURE__ */ t(A, { className: "h-4 w-4" }) })
|
|
152
154
|
] }),
|
|
153
|
-
/* @__PURE__ */
|
|
154
|
-
/* @__PURE__ */
|
|
155
|
+
/* @__PURE__ */ i("div", { className: "grid gap-3 sm:grid-cols-2", children: [
|
|
156
|
+
/* @__PURE__ */ i("div", { className: "space-y-1", children: [
|
|
155
157
|
/* @__PURE__ */ t(C, { htmlFor: `${u}-title`, className: "text-[12px]", children: "Title" }),
|
|
156
158
|
/* @__PURE__ */ t(
|
|
157
|
-
|
|
159
|
+
te,
|
|
158
160
|
{
|
|
159
161
|
id: `${u}-title`,
|
|
160
|
-
value:
|
|
162
|
+
value: s.title,
|
|
161
163
|
maxLength: 200,
|
|
162
164
|
onChange: (e) => l({ title: e.target.value }),
|
|
163
165
|
placeholder: "Getting started as a Workflow Creator",
|
|
@@ -166,13 +168,13 @@ function se({
|
|
|
166
168
|
}
|
|
167
169
|
)
|
|
168
170
|
] }),
|
|
169
|
-
/* @__PURE__ */
|
|
171
|
+
/* @__PURE__ */ i("div", { className: "space-y-1", children: [
|
|
170
172
|
/* @__PURE__ */ t(C, { htmlFor: `${u}-desc`, className: "text-[12px]", children: "Description" }),
|
|
171
173
|
/* @__PURE__ */ t(
|
|
172
|
-
|
|
174
|
+
ae,
|
|
173
175
|
{
|
|
174
176
|
id: `${u}-desc`,
|
|
175
|
-
value:
|
|
177
|
+
value: s.description,
|
|
176
178
|
maxLength: 2e3,
|
|
177
179
|
rows: 2,
|
|
178
180
|
onChange: (e) => l({ description: e.target.value }),
|
|
@@ -181,46 +183,46 @@ function se({
|
|
|
181
183
|
)
|
|
182
184
|
] })
|
|
183
185
|
] }),
|
|
184
|
-
/* @__PURE__ */
|
|
185
|
-
/* @__PURE__ */
|
|
186
|
+
/* @__PURE__ */ i("div", { className: "flex flex-wrap items-center gap-5", children: [
|
|
187
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
|
|
186
188
|
/* @__PURE__ */ t(
|
|
187
189
|
F,
|
|
188
190
|
{
|
|
189
191
|
id: `${u}-published`,
|
|
190
|
-
checked:
|
|
192
|
+
checked: s.status === "published",
|
|
191
193
|
onCheckedChange: (e) => l({ status: e ? "published" : "draft" }),
|
|
192
|
-
"data-hv-path-published":
|
|
194
|
+
"data-hv-path-published": s.status === "published" ? "on" : "off"
|
|
193
195
|
}
|
|
194
196
|
),
|
|
195
197
|
/* @__PURE__ */ t(C, { htmlFor: `${u}-published`, className: "text-[13px] font-normal", children: "Published" })
|
|
196
198
|
] }),
|
|
197
|
-
/* @__PURE__ */
|
|
199
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
|
|
198
200
|
/* @__PURE__ */ t(
|
|
199
201
|
F,
|
|
200
202
|
{
|
|
201
203
|
id: `${u}-new-user`,
|
|
202
|
-
checked:
|
|
204
|
+
checked: s.new_user,
|
|
203
205
|
onCheckedChange: (e) => l({ new_user: e }),
|
|
204
|
-
"data-hv-path-new-user":
|
|
206
|
+
"data-hv-path-new-user": s.new_user ? "on" : "off"
|
|
205
207
|
}
|
|
206
208
|
),
|
|
207
209
|
/* @__PURE__ */ t(C, { htmlFor: `${u}-new-user`, className: "text-[13px] font-normal", children: "New User path" }),
|
|
208
210
|
/* @__PURE__ */ t("span", { className: "text-[12px] text-muted-foreground", children: "shows to every account in its first week, whatever its role" })
|
|
209
211
|
] })
|
|
210
212
|
] }),
|
|
211
|
-
/* @__PURE__ */
|
|
213
|
+
/* @__PURE__ */ i("div", { className: "space-y-1.5", children: [
|
|
212
214
|
/* @__PURE__ */ t("p", { className: "text-[12px] font-medium", children: "Videos, in order" }),
|
|
213
|
-
|
|
214
|
-
/* @__PURE__ */ t("ol", { className: "space-y-1", "data-hv-path-items": !0, children:
|
|
215
|
+
s.video_ids.length === 0 && /* @__PURE__ */ t("p", { className: "text-[12px] text-muted-foreground", children: "No videos yet — add published videos below." }),
|
|
216
|
+
/* @__PURE__ */ t("ol", { className: "space-y-1", "data-hv-path-items": !0, children: s.video_ids.map((e, r) => {
|
|
215
217
|
var n;
|
|
216
|
-
return /* @__PURE__ */
|
|
218
|
+
return /* @__PURE__ */ i(
|
|
217
219
|
"li",
|
|
218
220
|
{
|
|
219
221
|
draggable: !0,
|
|
220
222
|
onDragStart: () => L(r),
|
|
221
223
|
onDragOver: (p) => p.preventDefault(),
|
|
222
224
|
onDrop: () => {
|
|
223
|
-
k !== null && l({ video_ids: P(
|
|
225
|
+
k !== null && l({ video_ids: P(s.video_ids, k, r) }), L(null);
|
|
224
226
|
},
|
|
225
227
|
onDragEnd: () => L(null),
|
|
226
228
|
className: `flex items-center gap-2 rounded-md border border-border bg-background px-2 py-1 text-[13px] ${k === r ? "opacity-60" : ""}`,
|
|
@@ -233,22 +235,22 @@ function se({
|
|
|
233
235
|
"aria-hidden": !0
|
|
234
236
|
}
|
|
235
237
|
),
|
|
236
|
-
/* @__PURE__ */
|
|
238
|
+
/* @__PURE__ */ i("span", { className: "w-5 shrink-0 text-right tabular-nums text-muted-foreground", children: [
|
|
237
239
|
r + 1,
|
|
238
240
|
"."
|
|
239
241
|
] }),
|
|
240
242
|
/* @__PURE__ */ t("span", { className: "min-w-0 flex-1 truncate", children: _(e) }),
|
|
241
|
-
/* @__PURE__ */ t("span", { className: "shrink-0 text-[12px] text-muted-foreground", children:
|
|
243
|
+
/* @__PURE__ */ t("span", { className: "shrink-0 text-[12px] text-muted-foreground", children: V(((n = x.get(e.toLowerCase())) == null ? void 0 : n.duration_ms) ?? null) }),
|
|
242
244
|
/* @__PURE__ */ t(
|
|
243
245
|
"button",
|
|
244
246
|
{
|
|
245
247
|
type: "button",
|
|
246
248
|
className: `rounded p-0.5 text-muted-foreground hover:text-foreground disabled:opacity-40 ${q}`,
|
|
247
|
-
onClick: () => l({ video_ids: P(
|
|
249
|
+
onClick: () => l({ video_ids: P(s.video_ids, r, r - 1) }),
|
|
248
250
|
disabled: r === 0,
|
|
249
251
|
"aria-label": `Move ${_(e)} up`,
|
|
250
252
|
"data-hv-path-up": e,
|
|
251
|
-
children: /* @__PURE__ */ t(
|
|
253
|
+
children: /* @__PURE__ */ t(B, { className: "h-3.5 w-3.5" })
|
|
252
254
|
}
|
|
253
255
|
),
|
|
254
256
|
/* @__PURE__ */ t(
|
|
@@ -256,11 +258,11 @@ function se({
|
|
|
256
258
|
{
|
|
257
259
|
type: "button",
|
|
258
260
|
className: `rounded p-0.5 text-muted-foreground hover:text-foreground disabled:opacity-40 ${q}`,
|
|
259
|
-
onClick: () => l({ video_ids: P(
|
|
260
|
-
disabled: r ===
|
|
261
|
+
onClick: () => l({ video_ids: P(s.video_ids, r, r + 1) }),
|
|
262
|
+
disabled: r === s.video_ids.length - 1,
|
|
261
263
|
"aria-label": `Move ${_(e)} down`,
|
|
262
264
|
"data-hv-path-down": e,
|
|
263
|
-
children: /* @__PURE__ */ t(
|
|
265
|
+
children: /* @__PURE__ */ t(O, { className: "h-3.5 w-3.5" })
|
|
264
266
|
}
|
|
265
267
|
),
|
|
266
268
|
/* @__PURE__ */ t(
|
|
@@ -268,7 +270,7 @@ function se({
|
|
|
268
270
|
{
|
|
269
271
|
type: "button",
|
|
270
272
|
className: `rounded p-0.5 text-muted-foreground hover:text-foreground ${q}`,
|
|
271
|
-
onClick: () => l({ video_ids:
|
|
273
|
+
onClick: () => l({ video_ids: s.video_ids.filter((p) => p !== e) }),
|
|
272
274
|
"aria-label": `Remove ${_(e)}`,
|
|
273
275
|
"data-hv-path-remove": e,
|
|
274
276
|
children: /* @__PURE__ */ t(A, { className: "h-3.5 w-3.5" })
|
|
@@ -279,23 +281,23 @@ function se({
|
|
|
279
281
|
e
|
|
280
282
|
);
|
|
281
283
|
}) }),
|
|
282
|
-
/* @__PURE__ */
|
|
284
|
+
/* @__PURE__ */ i("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
283
285
|
/* @__PURE__ */ t(
|
|
284
286
|
M,
|
|
285
287
|
{
|
|
286
288
|
ariaLabel: "Add a video",
|
|
287
289
|
placeholder: "Add a video",
|
|
288
290
|
emptyText: h.isLoading ? "Loading…" : h.isError ? "Videos could not be loaded." : "Nothing matches.",
|
|
289
|
-
options: (((R = h.data) == null ? void 0 : R.data) ?? []).filter((e) => !
|
|
291
|
+
options: (((R = h.data) == null ? void 0 : R.data) ?? []).filter((e) => !s.video_ids.some((r) => r.toLowerCase() === e.id.toLowerCase())).map((e) => ({
|
|
290
292
|
value: e.id,
|
|
291
293
|
label: e.title || "Untitled video",
|
|
292
|
-
hint:
|
|
294
|
+
hint: V(e.duration_ms)
|
|
293
295
|
})),
|
|
294
|
-
onPick: (e) => l({ video_ids: [...
|
|
296
|
+
onPick: (e) => l({ video_ids: [...s.video_ids, e] })
|
|
295
297
|
}
|
|
296
298
|
),
|
|
297
299
|
h.hasNextPage && /* @__PURE__ */ t(
|
|
298
|
-
|
|
300
|
+
f,
|
|
299
301
|
{
|
|
300
302
|
size: "sm",
|
|
301
303
|
variant: "ghost",
|
|
@@ -306,26 +308,26 @@ function se({
|
|
|
306
308
|
)
|
|
307
309
|
] })
|
|
308
310
|
] }),
|
|
309
|
-
/* @__PURE__ */
|
|
311
|
+
/* @__PURE__ */ i("div", { className: "space-y-1.5", children: [
|
|
310
312
|
/* @__PURE__ */ t("p", { className: "text-[12px] font-medium", children: "Roles" }),
|
|
311
313
|
/* @__PURE__ */ t("p", { className: "text-[12px] text-muted-foreground", children: "People in these roles get the path on My Work. Required: it joins their required list and they are told when it is published." }),
|
|
312
|
-
/* @__PURE__ */
|
|
313
|
-
|
|
314
|
-
|
|
314
|
+
/* @__PURE__ */ i("div", { className: "flex flex-wrap items-center gap-1.5", "data-hv-path-roles": !0, children: [
|
|
315
|
+
s.roles.map((e) => /* @__PURE__ */ t("span", { className: "inline-flex items-center gap-1", children: /* @__PURE__ */ i(
|
|
316
|
+
oe,
|
|
315
317
|
{
|
|
316
318
|
removeLabel: `Remove ${U(e.role_id)}`,
|
|
317
|
-
onRemove: () => l({ roles:
|
|
319
|
+
onRemove: () => l({ roles: s.roles.filter((r) => r.role_id !== e.role_id) }),
|
|
318
320
|
"data-hv-path-role": e.role_id,
|
|
319
321
|
children: [
|
|
320
322
|
U(e.role_id),
|
|
321
|
-
/* @__PURE__ */
|
|
323
|
+
/* @__PURE__ */ i("label", { className: "ml-1 inline-flex items-center gap-1 text-[11px] text-muted-foreground", children: [
|
|
322
324
|
/* @__PURE__ */ t(
|
|
323
325
|
"input",
|
|
324
326
|
{
|
|
325
327
|
type: "checkbox",
|
|
326
328
|
checked: e.required,
|
|
327
329
|
onChange: (r) => l({
|
|
328
|
-
roles:
|
|
330
|
+
roles: s.roles.map(
|
|
329
331
|
(n) => n.role_id === e.role_id ? { ...n, required: r.target.checked } : n
|
|
330
332
|
)
|
|
331
333
|
}),
|
|
@@ -342,9 +344,9 @@ function se({
|
|
|
342
344
|
{
|
|
343
345
|
ariaLabel: "Add a role",
|
|
344
346
|
placeholder: "Add a role",
|
|
345
|
-
emptyText:
|
|
346
|
-
options: (
|
|
347
|
-
onPick: (e) => l({ roles: [...
|
|
347
|
+
emptyText: v.isLoading ? "Loading…" : v.isError ? "Roles could not be loaded." : "Nothing matches.",
|
|
348
|
+
options: (v.data ?? []).filter((e) => !s.roles.some((r) => r.role_id.toUpperCase() === e.id.toUpperCase())).map((e) => ({ value: e.id, label: e.name })),
|
|
349
|
+
onPick: (e) => l({ roles: [...s.roles, { role_id: e, required: !1 }] })
|
|
348
350
|
}
|
|
349
351
|
)
|
|
350
352
|
] })
|
|
@@ -358,18 +360,20 @@ function se({
|
|
|
358
360
|
children: D
|
|
359
361
|
}
|
|
360
362
|
),
|
|
361
|
-
/* @__PURE__ */
|
|
362
|
-
/* @__PURE__ */ t(
|
|
363
|
-
/* @__PURE__ */ t(
|
|
364
|
-
a && /* @__PURE__ */
|
|
365
|
-
|
|
363
|
+
/* @__PURE__ */ i("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
364
|
+
/* @__PURE__ */ t(f, { size: "sm", onClick: () => void Q(), disabled: o, "data-hv-path-save": !0, children: o ? "Saving…" : a ? "Save" : "Create path" }),
|
|
365
|
+
/* @__PURE__ */ t(f, { size: "sm", variant: "outline", onClick: c, disabled: o, children: "Cancel" }),
|
|
366
|
+
a && /* @__PURE__ */ i(
|
|
367
|
+
Z,
|
|
366
368
|
{
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
369
|
+
className: Y(
|
|
370
|
+
ee({ size: "sm", variant: "ghost" }),
|
|
371
|
+
"ml-auto text-rose-700 hover:text-rose-800 dark:text-rose-300"
|
|
372
|
+
),
|
|
373
|
+
armedClassName: "h-auto min-h-8 whitespace-normal bg-rose-50 text-left text-rose-800 hover:bg-rose-100 dark:bg-rose-500/10 dark:text-rose-300 dark:hover:bg-rose-500/20",
|
|
374
|
+
confirmLabel: `Delete "${a.title || "Untitled path"}"? Nobody's progress is lost.`,
|
|
375
|
+
onConfirm: () => void S(),
|
|
371
376
|
disabled: o,
|
|
372
|
-
"data-hv-path-delete": !0,
|
|
373
377
|
children: [
|
|
374
378
|
/* @__PURE__ */ t(H, { className: "h-3.5 w-3.5" }),
|
|
375
379
|
" Delete path"
|
|
@@ -382,5 +386,5 @@ function se({
|
|
|
382
386
|
);
|
|
383
387
|
}
|
|
384
388
|
export {
|
|
385
|
-
|
|
389
|
+
Pe as LearningPathsPanel
|
|
386
390
|
};
|
|
@@ -12,16 +12,16 @@ const T = [
|
|
|
12
12
|
];
|
|
13
13
|
function I({
|
|
14
14
|
title: n,
|
|
15
|
-
onConfirm:
|
|
15
|
+
onConfirm: g,
|
|
16
16
|
onClose: i,
|
|
17
|
-
container:
|
|
17
|
+
container: h,
|
|
18
18
|
restoreFocus: v
|
|
19
19
|
}) {
|
|
20
|
-
const l = p(null), a = p(!1), [r,
|
|
20
|
+
const l = p(null), a = p(!1), [r, d] = m(!1), [s, c] = m(null), D = async () => {
|
|
21
21
|
if (a.current || r) return;
|
|
22
|
-
a.current = !0,
|
|
23
|
-
const e = await
|
|
24
|
-
a.current = !1,
|
|
22
|
+
a.current = !0, d(!0), c(null);
|
|
23
|
+
const e = await g();
|
|
24
|
+
a.current = !1, d(!1), e.ok || c(e.message);
|
|
25
25
|
};
|
|
26
26
|
return /* @__PURE__ */ t(w, { open: !0, onOpenChange: (e) => !e && !r && i(), children: /* @__PURE__ */ o(
|
|
27
27
|
y,
|
|
@@ -30,7 +30,7 @@ function I({
|
|
|
30
30
|
onEscapeKeyDown: (e) => r && e.preventDefault(),
|
|
31
31
|
onPointerDownOutside: (e) => r && e.preventDefault(),
|
|
32
32
|
onInteractOutside: (e) => r && e.preventDefault(),
|
|
33
|
-
container:
|
|
33
|
+
container: h,
|
|
34
34
|
hideClose: r,
|
|
35
35
|
className: "w-[calc(100vw-2rem)] max-w-[480px] dark:bg-card",
|
|
36
36
|
onOpenAutoFocus: (e) => {
|
|
@@ -54,7 +54,7 @@ function I({
|
|
|
54
54
|
/* @__PURE__ */ t("ul", { className: "list-disc space-y-1 pl-5 text-[13px] marker:text-muted-foreground", children: T.map((e) => /* @__PURE__ */ t("li", { children: e }, e)) }),
|
|
55
55
|
/* @__PURE__ */ t("p", { className: "text-[13px] text-muted-foreground", children: "To keep it but out of the way, leave it in the archive." }),
|
|
56
56
|
/* @__PURE__ */ t("p", { className: "sr-only", role: "status", "aria-live": "polite", "data-hv-purge-status": !0, children: r ? `Deleting “${n}”…` : "" }),
|
|
57
|
-
|
|
57
|
+
s && /* @__PURE__ */ t(O, { "data-hv-purge-error": !0, children: s })
|
|
58
58
|
] }),
|
|
59
59
|
/* @__PURE__ */ o(E, { className: "flex-wrap border-border", children: [
|
|
60
60
|
/* @__PURE__ */ t(
|
|
@@ -1,71 +1,92 @@
|
|
|
1
|
-
const
|
|
2
|
-
function
|
|
1
|
+
const k = "__o2m_";
|
|
2
|
+
function f(n) {
|
|
3
3
|
return String(n ?? "").trim();
|
|
4
4
|
}
|
|
5
|
-
function
|
|
6
|
-
const
|
|
7
|
-
if (
|
|
8
|
-
const o = Number(
|
|
9
|
-
if (Number.isFinite(o) && Number.isFinite(
|
|
10
|
-
return o ===
|
|
5
|
+
function w(n, i) {
|
|
6
|
+
const e = f(n), r = f(i);
|
|
7
|
+
if (e !== "" && r !== "") {
|
|
8
|
+
const o = Number(e), s = Number(r);
|
|
9
|
+
if (Number.isFinite(o) && Number.isFinite(s))
|
|
10
|
+
return o === s;
|
|
11
11
|
}
|
|
12
|
-
return
|
|
12
|
+
return e === r;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
const i =
|
|
14
|
+
function S(n) {
|
|
15
|
+
const i = f(n);
|
|
16
16
|
if (i !== "") {
|
|
17
|
-
const
|
|
18
|
-
if (Number.isFinite(
|
|
17
|
+
const e = Number(i);
|
|
18
|
+
if (Number.isFinite(e)) return String(e);
|
|
19
19
|
}
|
|
20
20
|
return i;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
return i.map((
|
|
22
|
+
function d(n, i) {
|
|
23
|
+
return i.map((e) => S(n[e])).join("\0");
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
const N = d;
|
|
26
|
+
function _(n, i, e, r) {
|
|
27
|
+
if (r.size === 0 || e.length === 0) return [];
|
|
28
|
+
const o = new Set(n.map((c) => d(c, e))), s = [];
|
|
29
|
+
for (const c of i) {
|
|
30
|
+
const a = String(c.id);
|
|
31
|
+
r.has(a) && o.has(d(c, e)) && s.push(a);
|
|
32
|
+
}
|
|
33
|
+
return s;
|
|
34
|
+
}
|
|
35
|
+
function E(n) {
|
|
36
|
+
const { headerDirty: i, pendingRows: e, pendingEdits: r, pendingDeletes: o, restored: s } = n;
|
|
37
|
+
if (!(i || e > 0 || r > 0 || o > 0)) return null;
|
|
38
|
+
const a = ["Your unsaved changes on this record stay in place; the file is applied on top."];
|
|
39
|
+
return s > 0 && a.push(
|
|
40
|
+
s === 1 ? "One line you removed is still in the file, so it comes back." : `${s} lines you removed are still in the file, so they come back.`
|
|
41
|
+
), a.join(" ");
|
|
42
|
+
}
|
|
43
|
+
function v(n, i, e) {
|
|
44
|
+
if (e.lines === "replace")
|
|
27
45
|
return {
|
|
28
|
-
creates: n.map((
|
|
46
|
+
creates: n.map((t) => ({ ...t })),
|
|
29
47
|
updates: [],
|
|
30
|
-
deletes: i.map((
|
|
48
|
+
deletes: i.map((t) => String(t.id)),
|
|
31
49
|
matchedUnchanged: 0
|
|
32
50
|
};
|
|
33
|
-
if (
|
|
51
|
+
if (e.lines === "append")
|
|
34
52
|
return {
|
|
35
|
-
creates: n.map((
|
|
53
|
+
creates: n.map((t) => ({ ...t })),
|
|
36
54
|
updates: [],
|
|
37
55
|
deletes: [],
|
|
38
56
|
matchedUnchanged: 0
|
|
39
57
|
};
|
|
40
|
-
const
|
|
41
|
-
for (const
|
|
42
|
-
const
|
|
43
|
-
if (
|
|
44
|
-
throw new Error(`Duplicate match key among existing lines: ${
|
|
45
|
-
|
|
58
|
+
const r = /* @__PURE__ */ new Map();
|
|
59
|
+
for (const t of i) {
|
|
60
|
+
const u = d(t, e.match_by);
|
|
61
|
+
if (r.has(u))
|
|
62
|
+
throw new Error(`Duplicate match key among existing lines: ${u}`);
|
|
63
|
+
r.set(u, t);
|
|
46
64
|
}
|
|
47
|
-
const o = /* @__PURE__ */ new Set(),
|
|
48
|
-
let
|
|
49
|
-
for (const
|
|
50
|
-
const
|
|
51
|
-
if (o.has(
|
|
52
|
-
throw new Error(`Duplicate match key: ${
|
|
53
|
-
o.add(
|
|
54
|
-
const
|
|
55
|
-
if (!
|
|
56
|
-
|
|
65
|
+
const o = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), c = [], a = [];
|
|
66
|
+
let p = 0;
|
|
67
|
+
for (const t of n) {
|
|
68
|
+
const u = d(t, e.match_by);
|
|
69
|
+
if (o.has(u))
|
|
70
|
+
throw new Error(`Duplicate match key: ${u}`);
|
|
71
|
+
o.add(u);
|
|
72
|
+
const m = r.get(u);
|
|
73
|
+
if (!m) {
|
|
74
|
+
c.push({ ...t });
|
|
57
75
|
continue;
|
|
58
76
|
}
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
const
|
|
62
|
-
for (const [
|
|
63
|
-
|
|
64
|
-
Object.keys(
|
|
77
|
+
const g = String(m.id);
|
|
78
|
+
s.add(g);
|
|
79
|
+
const l = {};
|
|
80
|
+
for (const [h, y] of Object.entries(t))
|
|
81
|
+
h.startsWith(k) || w(y, m[h]) || (l[h] = y);
|
|
82
|
+
Object.keys(l).length > 0 ? a.push({ id: g, changes: l }) : p += 1;
|
|
65
83
|
}
|
|
66
|
-
const
|
|
67
|
-
return { creates:
|
|
84
|
+
const b = e.lines === "upsert_delete" ? i.map((t) => String(t.id)).filter((t) => !s.has(t)) : [];
|
|
85
|
+
return { creates: c, updates: a, deletes: b, matchedUnchanged: p };
|
|
68
86
|
}
|
|
69
87
|
export {
|
|
70
|
-
|
|
88
|
+
v as diffReimportLines,
|
|
89
|
+
N as reimportMatchKey,
|
|
90
|
+
E as reimportPendingNotice,
|
|
91
|
+
_ as reimportRestoredDeletes
|
|
71
92
|
};
|