@burdenoff/microfe-buildmyiq 2026.720.4 → 2026.720.5
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/buildmyiq/hooks/useBuiPermissions.d.ts +2 -0
- package/dist/buildmyiq/hooks/useBuiPermissions.d.ts.map +1 -1
- package/dist/buildmyiq/hooks/useBuildmyiqApi.d.ts +12 -0
- package/dist/buildmyiq/hooks/useBuildmyiqApi.d.ts.map +1 -1
- package/dist/buildmyiq/hooks/useBuildmyiqApi.js +25 -17
- package/dist/buildmyiq/hooks/useBuildmyiqApi.js.map +1 -1
- package/dist/buildmyiq/pages/assessments/AssessmentDetailPage.d.ts.map +1 -1
- package/dist/buildmyiq/pages/assessments/AssessmentDetailPage.js +251 -204
- package/dist/buildmyiq/pages/assessments/AssessmentDetailPage.js.map +1 -1
- package/package.json +1 -1
|
@@ -5,18 +5,19 @@ import { PageLayout as n } from "../../components/PageLayout.js";
|
|
|
5
5
|
import { formatDuration as r, formatEnumLabel as i } from "../../utils/formatters.js";
|
|
6
6
|
import { StatusBadge as a } from "../../components/StatusBadge.js";
|
|
7
7
|
import { EmptyState as o } from "../../components/EmptyState.js";
|
|
8
|
-
import { ErrorView as ee, LoadingView as
|
|
9
|
-
import { useBuiAssessment as
|
|
8
|
+
import { ErrorView as ee, LoadingView as s, Section as c } from "../../components/StateViews.js";
|
|
9
|
+
import { useBuiArchiveAssessment as te, useBuiAssessment as ne, useBuiCreateQuestion as re, useBuiPublishAssessment as ie } from "../../hooks/useBuildmyiqApi.js";
|
|
10
10
|
import "../../hooks/index.js";
|
|
11
|
+
import { BuiPermissionButton as ae } from "../../components/BuiPermissionButton.js";
|
|
11
12
|
import "../../components/index.js";
|
|
12
|
-
import { QUESTION_TYPES as
|
|
13
|
-
import { useMemo as
|
|
14
|
-
import { ArrowLeft as
|
|
15
|
-
import { useParams as
|
|
16
|
-
import { Fragment as
|
|
17
|
-
import { Button as
|
|
13
|
+
import { QUESTION_TYPES as oe } from "../../types/index.js";
|
|
14
|
+
import { useMemo as l, useState as u } from "react";
|
|
15
|
+
import { Archive as se, ArrowLeft as d, Circle as f, ClipboardCheck as p, ClipboardEdit as ce, Clock as le, Lightbulb as m, Plus as h, Repeat as ue, Send as de, Square as g, Trash2 as fe, Trophy as pe } from "lucide-react";
|
|
16
|
+
import { useParams as me } from "react-router-dom";
|
|
17
|
+
import { Fragment as he, jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
18
|
+
import { Button as y, Checkbox as ge, GlassCard 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 _e, SelectContent as ve, SelectItem as ye, SelectTrigger as be, SelectValue as xe, Textarea as k } from "@burdenoff/fe-libs/ui";
|
|
18
19
|
//#region src/buildmyiq/pages/assessments/AssessmentDetailPage.tsx
|
|
19
|
-
var
|
|
20
|
+
var A = (e) => {
|
|
20
21
|
if (!Array.isArray(e)) return [];
|
|
21
22
|
let t = [];
|
|
22
23
|
for (let n of e) if (n && typeof n == "object" && "label" in n) {
|
|
@@ -30,455 +31,501 @@ var j = (e) => {
|
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
33
|
return t;
|
|
33
|
-
},
|
|
34
|
+
}, j = 1e3, M = new Set(["SINGLE_CHOICE", "MULTIPLE_CHOICE"]), N = (e) => e === "SINGLE_CHOICE" || e === "TRUE_FALSE", P = () => [{
|
|
34
35
|
label: "",
|
|
35
36
|
correct: !1
|
|
36
37
|
}, {
|
|
37
38
|
label: "",
|
|
38
39
|
correct: !1
|
|
39
|
-
}],
|
|
40
|
+
}], Se = () => [{
|
|
40
41
|
label: "True",
|
|
41
42
|
correct: !1
|
|
42
43
|
}, {
|
|
43
44
|
label: "False",
|
|
44
45
|
correct: !1
|
|
45
|
-
}],
|
|
46
|
+
}], F = () => ({
|
|
46
47
|
prompt: "",
|
|
47
48
|
type: "SINGLE_CHOICE",
|
|
48
49
|
points: "1",
|
|
49
50
|
explanation: "",
|
|
50
|
-
options:
|
|
51
|
+
options: P(),
|
|
51
52
|
shortAnswer: ""
|
|
52
|
-
}),
|
|
53
|
-
let { assessmentId: f } =
|
|
54
|
-
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
},
|
|
58
|
-
|
|
53
|
+
}), I = () => {
|
|
54
|
+
let { assessmentId: f } = me(), { navigateTo: m } = e(), g = ne(f), A = ie(), I = te(), R = re(), [we, z] = u(!1), [B, V] = u(F), [H, U] = u(null), [Te, W] = u(!1), [G, K] = u(null), q = g.data ?? null, J = l(() => [...q?.questions ?? []].sort((e, t) => e.position - t.position), [q]), Y = l(() => J.length ? Math.max(...J.map((e) => e.position)) + 1 : 1, [J]), X = l(() => J.reduce((e, t) => e + t.points, 0), [J]), Z = B.type === "TRUE_FALSE" || M.has(B.type), Q = () => {
|
|
55
|
+
V(F()), U(null), z(!0);
|
|
56
|
+
}, $ = () => {
|
|
57
|
+
z(!1), V(F()), U(null);
|
|
58
|
+
}, Ee = (e) => {
|
|
59
|
+
V((t) => {
|
|
59
60
|
let n = t.options;
|
|
60
|
-
return e === "TRUE_FALSE" ? n =
|
|
61
|
+
return e === "TRUE_FALSE" ? n = Se() : M.has(e) && (n = t.options.some((e) => e.label === "True" || e.label === "False") ? P() : t.options), {
|
|
61
62
|
...t,
|
|
62
63
|
type: e,
|
|
63
64
|
options: n
|
|
64
65
|
};
|
|
65
66
|
});
|
|
66
|
-
},
|
|
67
|
-
|
|
67
|
+
}, De = (e, t) => {
|
|
68
|
+
V((n) => ({
|
|
68
69
|
...n,
|
|
69
70
|
options: n.options.map((n, r) => r === e ? {
|
|
70
71
|
...n,
|
|
71
72
|
label: t
|
|
72
73
|
} : n)
|
|
73
74
|
}));
|
|
74
|
-
},
|
|
75
|
-
|
|
75
|
+
}, Oe = (e, t) => {
|
|
76
|
+
V((n) => ({
|
|
76
77
|
...n,
|
|
77
78
|
options: n.options.map((r, i) => i === e ? {
|
|
78
79
|
...r,
|
|
79
80
|
correct: t
|
|
80
|
-
} :
|
|
81
|
+
} : N(n.type) ? {
|
|
81
82
|
...r,
|
|
82
83
|
correct: !1
|
|
83
84
|
} : r)
|
|
84
85
|
}));
|
|
85
|
-
},
|
|
86
|
-
|
|
86
|
+
}, ke = () => {
|
|
87
|
+
V((e) => ({
|
|
87
88
|
...e,
|
|
88
89
|
options: [...e.options, {
|
|
89
90
|
label: "",
|
|
90
91
|
correct: !1
|
|
91
92
|
}]
|
|
92
93
|
}));
|
|
93
|
-
},
|
|
94
|
-
|
|
94
|
+
}, Ae = (e) => {
|
|
95
|
+
V((t) => ({
|
|
95
96
|
...t,
|
|
96
97
|
options: t.options.filter((t, n) => n !== e)
|
|
97
98
|
}));
|
|
98
|
-
},
|
|
99
|
-
if (
|
|
100
|
-
await
|
|
99
|
+
}, je = async () => {
|
|
100
|
+
if (q) try {
|
|
101
|
+
await A.mutateAsync(q.id);
|
|
101
102
|
} catch {}
|
|
102
|
-
},
|
|
103
|
+
}, Me = async () => {
|
|
104
|
+
if (q) {
|
|
105
|
+
K(null);
|
|
106
|
+
try {
|
|
107
|
+
await I.mutateAsync({
|
|
108
|
+
id: q.id,
|
|
109
|
+
courseId: q.courseId
|
|
110
|
+
}), W(!1), m("assessments");
|
|
111
|
+
} catch (e) {
|
|
112
|
+
K(e instanceof Error ? e.message : "Failed to archive this assessment.");
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}, Ne = async () => {
|
|
103
116
|
if (!f) return;
|
|
104
|
-
if (!
|
|
105
|
-
|
|
117
|
+
if (!B.prompt.trim()) {
|
|
118
|
+
U("Question prompt is required.");
|
|
106
119
|
return;
|
|
107
120
|
}
|
|
108
121
|
let e, t;
|
|
109
|
-
if (
|
|
110
|
-
let n =
|
|
122
|
+
if (Z) {
|
|
123
|
+
let n = B.options.map((e) => ({
|
|
111
124
|
label: e.label.trim(),
|
|
112
125
|
correct: e.correct
|
|
113
126
|
})).filter((e) => e.label.length > 0);
|
|
114
|
-
if (
|
|
115
|
-
|
|
127
|
+
if (M.has(B.type) && n.length < 2) {
|
|
128
|
+
U("Add at least two options.");
|
|
116
129
|
return;
|
|
117
130
|
}
|
|
118
131
|
e = n.map((e) => ({ label: e.label }));
|
|
119
132
|
let r = n.filter((e) => e.correct).map((e) => e.label);
|
|
120
133
|
r.length && (t = r);
|
|
121
|
-
} else
|
|
134
|
+
} else B.type === "SHORT_ANSWER" && (t = B.shortAnswer.trim() || void 0);
|
|
122
135
|
try {
|
|
123
136
|
await R.mutateAsync({
|
|
124
137
|
assessmentId: f,
|
|
125
|
-
prompt:
|
|
126
|
-
type:
|
|
127
|
-
points:
|
|
128
|
-
position:
|
|
129
|
-
explanation:
|
|
138
|
+
prompt: B.prompt.trim(),
|
|
139
|
+
type: B.type,
|
|
140
|
+
points: B.points ? Number(B.points) : void 0,
|
|
141
|
+
position: Y,
|
|
142
|
+
explanation: B.explanation.trim() || void 0,
|
|
130
143
|
options: e,
|
|
131
144
|
answerKey: t
|
|
132
|
-
}),
|
|
145
|
+
}), $();
|
|
133
146
|
} catch (e) {
|
|
134
|
-
|
|
147
|
+
U(e instanceof Error ? e.message : "Failed to add question.");
|
|
135
148
|
}
|
|
136
149
|
};
|
|
137
|
-
if (
|
|
150
|
+
if (g.isLoading) return /* @__PURE__ */ _(n, {
|
|
138
151
|
title: "Assessment",
|
|
139
|
-
children: /* @__PURE__ */
|
|
152
|
+
children: /* @__PURE__ */ _(s, { label: "Loading assessment…" })
|
|
140
153
|
});
|
|
141
|
-
if (
|
|
154
|
+
if (g.isError) return /* @__PURE__ */ _(n, {
|
|
142
155
|
title: "Assessment",
|
|
143
|
-
children: /* @__PURE__ */
|
|
156
|
+
children: /* @__PURE__ */ _(ee, {
|
|
144
157
|
message: "Couldn't load this assessment.",
|
|
145
|
-
onRetry: () =>
|
|
158
|
+
onRetry: () => g.refetch()
|
|
146
159
|
})
|
|
147
160
|
});
|
|
148
|
-
if (!
|
|
161
|
+
if (!q) return /* @__PURE__ */ _(n, {
|
|
149
162
|
title: "Assessment",
|
|
150
|
-
children: /* @__PURE__ */
|
|
163
|
+
children: /* @__PURE__ */ _(o, {
|
|
151
164
|
illustration: "empty-search",
|
|
152
165
|
title: "Assessment not found",
|
|
153
166
|
description: "This assessment may have been removed or you don't have access to it.",
|
|
154
|
-
action: /* @__PURE__ */
|
|
155
|
-
onClick: () =>
|
|
167
|
+
action: /* @__PURE__ */ _(y, {
|
|
168
|
+
onClick: () => m("assessments"),
|
|
156
169
|
children: "Back to assessments"
|
|
157
170
|
})
|
|
158
171
|
})
|
|
159
172
|
});
|
|
160
|
-
let
|
|
161
|
-
return /* @__PURE__ */
|
|
162
|
-
title: /* @__PURE__ */
|
|
173
|
+
let Pe = q.status === "DRAFT", Fe = q.status === "ARCHIVED";
|
|
174
|
+
return /* @__PURE__ */ v(n, {
|
|
175
|
+
title: /* @__PURE__ */ v("span", {
|
|
163
176
|
className: "flex min-w-0 items-center gap-3",
|
|
164
|
-
children: [/* @__PURE__ */
|
|
177
|
+
children: [/* @__PURE__ */ _("span", {
|
|
165
178
|
className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-[var(--color-accent-soft)] text-[var(--color-accent-teal)]",
|
|
166
|
-
children: /* @__PURE__ */
|
|
167
|
-
}), /* @__PURE__ */
|
|
179
|
+
children: /* @__PURE__ */ _(ce, { className: "h-5 w-5" })
|
|
180
|
+
}), /* @__PURE__ */ _("span", {
|
|
168
181
|
className: "truncate",
|
|
169
|
-
children:
|
|
182
|
+
children: q.title
|
|
170
183
|
})]
|
|
171
184
|
}),
|
|
172
|
-
description:
|
|
173
|
-
actions: /* @__PURE__ */
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
+
description: q.description ?? void 0,
|
|
186
|
+
actions: /* @__PURE__ */ v(he, { children: [
|
|
187
|
+
/* @__PURE__ */ v(y, {
|
|
188
|
+
variant: "ghost",
|
|
189
|
+
onClick: () => m("submissions"),
|
|
190
|
+
children: [/* @__PURE__ */ _(p, { className: "mr-1.5 h-4 w-4" }), " Submissions"]
|
|
191
|
+
}),
|
|
192
|
+
!Fe && /* @__PURE__ */ _(ae, {
|
|
193
|
+
resource: "buildmyiq-assessment",
|
|
194
|
+
action: "delete",
|
|
195
|
+
deniedBehavior: "hide",
|
|
196
|
+
children: /* @__PURE__ */ v(y, {
|
|
197
|
+
variant: "outline",
|
|
198
|
+
onClick: () => W(!0),
|
|
199
|
+
children: [/* @__PURE__ */ _(se, { className: "mr-1.5 h-4 w-4" }), " Archive"]
|
|
200
|
+
})
|
|
201
|
+
}),
|
|
202
|
+
Pe ? /* @__PURE__ */ v(y, {
|
|
203
|
+
onClick: je,
|
|
204
|
+
disabled: A.isPending,
|
|
205
|
+
children: [/* @__PURE__ */ _(de, { className: "mr-1.5 h-4 w-4" }), A.isPending ? "Publishing…" : "Publish"]
|
|
206
|
+
}) : /* @__PURE__ */ _(a, {
|
|
207
|
+
status: q.status,
|
|
208
|
+
className: "px-3 py-1.5"
|
|
209
|
+
})
|
|
210
|
+
] }),
|
|
185
211
|
children: [
|
|
186
|
-
/* @__PURE__ */
|
|
212
|
+
/* @__PURE__ */ v("button", {
|
|
187
213
|
type: "button",
|
|
188
|
-
onClick: () =>
|
|
214
|
+
onClick: () => m("assessments"),
|
|
189
215
|
className: "mb-4 inline-flex items-center gap-1.5 text-sm text-text-secondary transition-colors hover:text-text-primary",
|
|
190
|
-
children: [/* @__PURE__ */
|
|
216
|
+
children: [/* @__PURE__ */ _(d, { className: "h-4 w-4" }), " All assessments"]
|
|
191
217
|
}),
|
|
192
|
-
/* @__PURE__ */
|
|
218
|
+
G && /* @__PURE__ */ _("p", {
|
|
219
|
+
className: "mb-4 rounded-lg border border-status-error-bg-subtle bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text",
|
|
220
|
+
children: G
|
|
221
|
+
}),
|
|
222
|
+
/* @__PURE__ */ v(b, {
|
|
193
223
|
treatment: "glass",
|
|
194
224
|
className: "mb-6 p-5 sm:p-6",
|
|
195
|
-
children: [/* @__PURE__ */
|
|
225
|
+
children: [/* @__PURE__ */ v("div", {
|
|
196
226
|
className: "mb-5 flex flex-wrap items-center gap-2",
|
|
197
227
|
children: [
|
|
198
|
-
/* @__PURE__ */
|
|
199
|
-
/* @__PURE__ */
|
|
200
|
-
|
|
228
|
+
/* @__PURE__ */ _(a, { status: q.type }),
|
|
229
|
+
/* @__PURE__ */ _(a, { status: q.status }),
|
|
230
|
+
q.isGraded ? /* @__PURE__ */ _(a, { status: "GRADED" }) : /* @__PURE__ */ _("span", {
|
|
201
231
|
className: "inline-flex items-center gap-1.5 rounded-full bg-bg-sunken px-2.5 py-0.5 text-xs font-medium text-text-secondary",
|
|
202
232
|
children: "Not graded"
|
|
203
233
|
})
|
|
204
234
|
]
|
|
205
|
-
}), /* @__PURE__ */
|
|
235
|
+
}), /* @__PURE__ */ v("div", {
|
|
206
236
|
className: "grid grid-cols-2 gap-y-6 sm:grid-cols-4",
|
|
207
237
|
children: [
|
|
208
|
-
/* @__PURE__ */
|
|
209
|
-
icon: /* @__PURE__ */
|
|
238
|
+
/* @__PURE__ */ _(L, {
|
|
239
|
+
icon: /* @__PURE__ */ _(pe, { className: "h-5 w-5" }),
|
|
210
240
|
label: "Passing score",
|
|
211
|
-
value: `${
|
|
241
|
+
value: `${q.passingScore}%`
|
|
212
242
|
}),
|
|
213
|
-
/* @__PURE__ */
|
|
214
|
-
icon: /* @__PURE__ */
|
|
243
|
+
/* @__PURE__ */ _(L, {
|
|
244
|
+
icon: /* @__PURE__ */ _(le, { className: "h-5 w-5" }),
|
|
215
245
|
label: "Time limit",
|
|
216
|
-
value: r(
|
|
246
|
+
value: r(q.timeLimitMin),
|
|
217
247
|
divider: !0
|
|
218
248
|
}),
|
|
219
|
-
/* @__PURE__ */
|
|
220
|
-
icon: /* @__PURE__ */
|
|
249
|
+
/* @__PURE__ */ _(L, {
|
|
250
|
+
icon: /* @__PURE__ */ _(ue, { className: "h-5 w-5" }),
|
|
221
251
|
label: "Max attempts",
|
|
222
|
-
value:
|
|
252
|
+
value: q.maxAttempts,
|
|
223
253
|
divider: !0
|
|
224
254
|
}),
|
|
225
|
-
/* @__PURE__ */
|
|
226
|
-
icon: /* @__PURE__ */
|
|
255
|
+
/* @__PURE__ */ _(L, {
|
|
256
|
+
icon: /* @__PURE__ */ _(p, { className: "h-5 w-5" }),
|
|
227
257
|
label: "Graded",
|
|
228
|
-
value:
|
|
258
|
+
value: q.isGraded ? "Yes" : "No",
|
|
229
259
|
divider: !0
|
|
230
260
|
})
|
|
231
261
|
]
|
|
232
262
|
})]
|
|
233
263
|
}),
|
|
234
|
-
/* @__PURE__ */
|
|
235
|
-
title: `Questions (${
|
|
236
|
-
description:
|
|
237
|
-
action: /* @__PURE__ */
|
|
264
|
+
/* @__PURE__ */ _(c, {
|
|
265
|
+
title: `Questions (${J.length})`,
|
|
266
|
+
description: J.length > 0 ? `${X} point${X === 1 ? "" : "s"} across ${J.length} question${J.length === 1 ? "" : "s"}` : void 0,
|
|
267
|
+
action: /* @__PURE__ */ v(y, {
|
|
238
268
|
variant: "outline",
|
|
239
|
-
onClick:
|
|
240
|
-
children: [/* @__PURE__ */
|
|
269
|
+
onClick: Q,
|
|
270
|
+
children: [/* @__PURE__ */ _(h, { className: "mr-1.5 h-4 w-4" }), " Add question"]
|
|
241
271
|
}),
|
|
242
|
-
children:
|
|
272
|
+
children: J.length === 0 ? /* @__PURE__ */ _(o, {
|
|
243
273
|
illustration: "empty-data",
|
|
244
274
|
title: "No questions yet",
|
|
245
275
|
description: "Build this assessment by adding its first question.",
|
|
246
|
-
action: /* @__PURE__ */
|
|
247
|
-
onClick:
|
|
248
|
-
children: [/* @__PURE__ */
|
|
276
|
+
action: /* @__PURE__ */ v(y, {
|
|
277
|
+
onClick: Q,
|
|
278
|
+
children: [/* @__PURE__ */ _(h, { className: "mr-1.5 h-4 w-4" }), " Add question"]
|
|
249
279
|
})
|
|
250
|
-
}) : /* @__PURE__ */
|
|
280
|
+
}) : /* @__PURE__ */ _("ol", {
|
|
251
281
|
className: "flex flex-col gap-3",
|
|
252
|
-
children:
|
|
282
|
+
children: J.map((e, t) => /* @__PURE__ */ _(Ce, {
|
|
253
283
|
index: t + 1,
|
|
254
284
|
question: e
|
|
255
285
|
}, e.id))
|
|
256
286
|
})
|
|
257
287
|
}),
|
|
258
|
-
/* @__PURE__ */
|
|
259
|
-
open:
|
|
288
|
+
/* @__PURE__ */ _(C, {
|
|
289
|
+
open: we,
|
|
260
290
|
onOpenChange: (e) => {
|
|
261
|
-
e ?
|
|
291
|
+
e ? z(!0) : $();
|
|
262
292
|
},
|
|
263
|
-
children: /* @__PURE__ */
|
|
264
|
-
/* @__PURE__ */
|
|
293
|
+
children: /* @__PURE__ */ v(w, { children: [
|
|
294
|
+
/* @__PURE__ */ v(D, { children: [/* @__PURE__ */ _(O, { children: "Add question" }), /* @__PURE__ */ v(T, { children: [
|
|
265
295
|
"Question ",
|
|
266
|
-
|
|
296
|
+
Y,
|
|
267
297
|
" · pick a type, write the prompt and mark the correct answer(s)."
|
|
268
298
|
] })] }),
|
|
269
|
-
/* @__PURE__ */
|
|
299
|
+
/* @__PURE__ */ v("div", {
|
|
270
300
|
className: "grid gap-4 py-2",
|
|
271
301
|
children: [
|
|
272
|
-
/* @__PURE__ */
|
|
302
|
+
/* @__PURE__ */ v("div", {
|
|
273
303
|
className: "grid gap-1.5",
|
|
274
304
|
children: [
|
|
275
|
-
/* @__PURE__ */
|
|
305
|
+
/* @__PURE__ */ _(S, {
|
|
276
306
|
htmlFor: "prompt",
|
|
277
307
|
children: "Prompt *"
|
|
278
308
|
}),
|
|
279
|
-
/* @__PURE__ */
|
|
309
|
+
/* @__PURE__ */ _(k, {
|
|
280
310
|
id: "prompt",
|
|
281
|
-
value:
|
|
282
|
-
onChange: (e) =>
|
|
283
|
-
...
|
|
284
|
-
prompt: e.target.value.slice(0,
|
|
311
|
+
value: B.prompt,
|
|
312
|
+
onChange: (e) => V({
|
|
313
|
+
...B,
|
|
314
|
+
prompt: e.target.value.slice(0, j)
|
|
285
315
|
}),
|
|
286
316
|
placeholder: "Enter your question prompt…",
|
|
287
317
|
rows: 3,
|
|
288
|
-
maxLength:
|
|
318
|
+
maxLength: j
|
|
289
319
|
}),
|
|
290
|
-
/* @__PURE__ */
|
|
320
|
+
/* @__PURE__ */ v("p", {
|
|
291
321
|
className: "text-right text-xs tabular-nums text-text-secondary",
|
|
292
322
|
children: [
|
|
293
|
-
|
|
323
|
+
B.prompt.length,
|
|
294
324
|
" / ",
|
|
295
|
-
|
|
325
|
+
j
|
|
296
326
|
]
|
|
297
327
|
})
|
|
298
328
|
]
|
|
299
329
|
}),
|
|
300
|
-
/* @__PURE__ */
|
|
330
|
+
/* @__PURE__ */ v("div", {
|
|
301
331
|
className: "grid gap-2 sm:grid-cols-2",
|
|
302
|
-
children: [/* @__PURE__ */
|
|
332
|
+
children: [/* @__PURE__ */ v("div", {
|
|
303
333
|
className: "grid gap-1.5",
|
|
304
|
-
children: [/* @__PURE__ */
|
|
334
|
+
children: [/* @__PURE__ */ _(S, {
|
|
305
335
|
htmlFor: "questionType",
|
|
306
336
|
children: "Type"
|
|
307
|
-
}), /* @__PURE__ */
|
|
308
|
-
value:
|
|
309
|
-
onValueChange: (e) =>
|
|
310
|
-
children: [/* @__PURE__ */
|
|
337
|
+
}), /* @__PURE__ */ v(_e, {
|
|
338
|
+
value: B.type,
|
|
339
|
+
onValueChange: (e) => Ee(e),
|
|
340
|
+
children: [/* @__PURE__ */ _(be, {
|
|
311
341
|
id: "questionType",
|
|
312
|
-
children: /* @__PURE__ */
|
|
313
|
-
}), /* @__PURE__ */
|
|
342
|
+
children: /* @__PURE__ */ _(xe, {})
|
|
343
|
+
}), /* @__PURE__ */ _(ve, { children: oe.map((e) => /* @__PURE__ */ _(ye, {
|
|
314
344
|
value: e,
|
|
315
345
|
children: i(e)
|
|
316
346
|
}, e)) })]
|
|
317
347
|
})]
|
|
318
|
-
}), /* @__PURE__ */
|
|
348
|
+
}), /* @__PURE__ */ v("div", {
|
|
319
349
|
className: "grid gap-1.5",
|
|
320
|
-
children: [/* @__PURE__ */
|
|
350
|
+
children: [/* @__PURE__ */ _(S, {
|
|
321
351
|
htmlFor: "points",
|
|
322
352
|
children: "Points"
|
|
323
|
-
}), /* @__PURE__ */
|
|
353
|
+
}), /* @__PURE__ */ _(x, {
|
|
324
354
|
id: "points",
|
|
325
355
|
type: "number",
|
|
326
356
|
min: "0",
|
|
327
357
|
step: "1",
|
|
328
|
-
value:
|
|
329
|
-
onChange: (e) =>
|
|
330
|
-
...
|
|
358
|
+
value: B.points,
|
|
359
|
+
onChange: (e) => V({
|
|
360
|
+
...B,
|
|
331
361
|
points: e.target.value
|
|
332
362
|
}),
|
|
333
363
|
placeholder: "1"
|
|
334
364
|
})]
|
|
335
365
|
})]
|
|
336
366
|
}),
|
|
337
|
-
|
|
367
|
+
Z && /* @__PURE__ */ v("div", {
|
|
338
368
|
className: "grid gap-2",
|
|
339
369
|
children: [
|
|
340
|
-
/* @__PURE__ */
|
|
341
|
-
/* @__PURE__ */
|
|
370
|
+
/* @__PURE__ */ v(S, { children: ["Options", B.type !== "TRUE_FALSE" && " *"] }),
|
|
371
|
+
/* @__PURE__ */ v("p", {
|
|
342
372
|
className: "-mt-1 text-xs text-text-secondary",
|
|
343
373
|
children: [
|
|
344
374
|
"Tick the ",
|
|
345
|
-
|
|
375
|
+
N(B.type) ? "single correct answer" : "correct answers",
|
|
346
376
|
"."
|
|
347
377
|
]
|
|
348
378
|
}),
|
|
349
|
-
/* @__PURE__ */
|
|
379
|
+
/* @__PURE__ */ _("div", {
|
|
350
380
|
className: "flex flex-col gap-2",
|
|
351
|
-
children:
|
|
381
|
+
children: B.options.map((e, n) => /* @__PURE__ */ v("div", {
|
|
352
382
|
className: t("flex items-center gap-2.5 rounded-lg border px-2.5 py-1.5 transition-colors", e.correct ? "border-status-success-text bg-status-success-bg-subtle" : "border-border-seam bg-bg-surface"),
|
|
353
383
|
children: [
|
|
354
|
-
/* @__PURE__ */
|
|
384
|
+
/* @__PURE__ */ _(ge, {
|
|
355
385
|
checked: e.correct,
|
|
356
|
-
onCheckedChange: (e) =>
|
|
386
|
+
onCheckedChange: (e) => Oe(n, e === !0),
|
|
357
387
|
"aria-label": "Mark option correct"
|
|
358
388
|
}),
|
|
359
|
-
/* @__PURE__ */
|
|
389
|
+
/* @__PURE__ */ _(x, {
|
|
360
390
|
value: e.label,
|
|
361
|
-
readOnly:
|
|
362
|
-
onChange: (e) =>
|
|
391
|
+
readOnly: B.type === "TRUE_FALSE",
|
|
392
|
+
onChange: (e) => De(n, e.target.value),
|
|
363
393
|
placeholder: `Option ${n + 1}`,
|
|
364
394
|
className: "flex-1 border-0 bg-transparent px-1 shadow-none focus-visible:ring-0"
|
|
365
395
|
}),
|
|
366
|
-
e.correct && /* @__PURE__ */
|
|
396
|
+
e.correct && /* @__PURE__ */ _("span", {
|
|
367
397
|
className: "shrink-0 text-xs font-medium text-status-success-text",
|
|
368
398
|
children: "Correct"
|
|
369
399
|
}),
|
|
370
|
-
|
|
400
|
+
B.type !== "TRUE_FALSE" && B.options.length > 2 && /* @__PURE__ */ _(y, {
|
|
371
401
|
type: "button",
|
|
372
402
|
variant: "ghost",
|
|
373
403
|
size: "icon",
|
|
374
|
-
onClick: () =>
|
|
404
|
+
onClick: () => Ae(n),
|
|
375
405
|
"aria-label": "Remove option",
|
|
376
|
-
children: /* @__PURE__ */
|
|
406
|
+
children: /* @__PURE__ */ _(fe, { className: "h-4 w-4" })
|
|
377
407
|
})
|
|
378
408
|
]
|
|
379
409
|
}, n))
|
|
380
410
|
}),
|
|
381
|
-
|
|
411
|
+
B.type !== "TRUE_FALSE" && /* @__PURE__ */ v(y, {
|
|
382
412
|
type: "button",
|
|
383
413
|
variant: "ghost",
|
|
384
414
|
size: "sm",
|
|
385
|
-
onClick:
|
|
386
|
-
children: [/* @__PURE__ */
|
|
415
|
+
onClick: ke,
|
|
416
|
+
children: [/* @__PURE__ */ _(h, { className: "mr-1.5 h-4 w-4" }), " Add option"]
|
|
387
417
|
})
|
|
388
418
|
]
|
|
389
419
|
}),
|
|
390
|
-
|
|
420
|
+
B.type === "SHORT_ANSWER" && /* @__PURE__ */ v("div", {
|
|
391
421
|
className: "grid gap-1.5",
|
|
392
|
-
children: [/* @__PURE__ */
|
|
422
|
+
children: [/* @__PURE__ */ _(S, {
|
|
393
423
|
htmlFor: "shortAnswer",
|
|
394
424
|
children: "Expected answer"
|
|
395
|
-
}), /* @__PURE__ */
|
|
425
|
+
}), /* @__PURE__ */ _(x, {
|
|
396
426
|
id: "shortAnswer",
|
|
397
|
-
value:
|
|
398
|
-
onChange: (e) =>
|
|
399
|
-
...
|
|
427
|
+
value: B.shortAnswer,
|
|
428
|
+
onChange: (e) => V({
|
|
429
|
+
...B,
|
|
400
430
|
shortAnswer: e.target.value
|
|
401
431
|
}),
|
|
402
432
|
placeholder: "The accepted answer (used as the grading key)."
|
|
403
433
|
})]
|
|
404
434
|
}),
|
|
405
|
-
(
|
|
435
|
+
(B.type === "ESSAY" || B.type === "CODE") && /* @__PURE__ */ v("p", {
|
|
406
436
|
className: "rounded-lg bg-bg-sunken px-3 py-2 text-xs text-text-secondary",
|
|
407
|
-
children: [i(
|
|
437
|
+
children: [i(B.type), " responses are graded manually from the Submissions view."]
|
|
408
438
|
}),
|
|
409
|
-
/* @__PURE__ */
|
|
439
|
+
/* @__PURE__ */ v("div", {
|
|
410
440
|
className: "grid gap-1.5",
|
|
411
|
-
children: [/* @__PURE__ */
|
|
441
|
+
children: [/* @__PURE__ */ _(S, {
|
|
412
442
|
htmlFor: "explanation",
|
|
413
443
|
children: "Explanation"
|
|
414
|
-
}), /* @__PURE__ */
|
|
444
|
+
}), /* @__PURE__ */ _(k, {
|
|
415
445
|
id: "explanation",
|
|
416
|
-
value:
|
|
417
|
-
onChange: (e) =>
|
|
418
|
-
...
|
|
446
|
+
value: B.explanation,
|
|
447
|
+
onChange: (e) => V({
|
|
448
|
+
...B,
|
|
419
449
|
explanation: e.target.value
|
|
420
450
|
}),
|
|
421
451
|
placeholder: "Shown to learners after grading (optional).",
|
|
422
452
|
rows: 2
|
|
423
453
|
})]
|
|
424
454
|
}),
|
|
425
|
-
|
|
455
|
+
H && /* @__PURE__ */ _("p", {
|
|
426
456
|
className: "text-sm text-status-error-text",
|
|
427
|
-
children:
|
|
457
|
+
children: H
|
|
428
458
|
})
|
|
429
459
|
]
|
|
430
460
|
}),
|
|
431
|
-
/* @__PURE__ */
|
|
461
|
+
/* @__PURE__ */ v(E, { children: [/* @__PURE__ */ _(y, {
|
|
432
462
|
variant: "outline",
|
|
433
|
-
onClick:
|
|
463
|
+
onClick: $,
|
|
434
464
|
children: "Cancel"
|
|
435
|
-
}), /* @__PURE__ */
|
|
436
|
-
onClick:
|
|
465
|
+
}), /* @__PURE__ */ _(y, {
|
|
466
|
+
onClick: Ne,
|
|
437
467
|
disabled: R.isPending,
|
|
438
468
|
children: R.isPending ? "Adding…" : "Add question"
|
|
439
469
|
})] })
|
|
440
470
|
] })
|
|
471
|
+
}),
|
|
472
|
+
/* @__PURE__ */ _(C, {
|
|
473
|
+
open: Te,
|
|
474
|
+
onOpenChange: (e) => {
|
|
475
|
+
e || W(!1);
|
|
476
|
+
},
|
|
477
|
+
children: /* @__PURE__ */ v(w, { children: [/* @__PURE__ */ v(D, { children: [/* @__PURE__ */ _(O, { children: "Archive this assessment?" }), /* @__PURE__ */ _(T, { children: "Archived assessments are hidden from the catalog and can no longer be submitted to. This frees up its quota slot so you can create a replacement assessment for this course." })] }), /* @__PURE__ */ v(E, { children: [/* @__PURE__ */ _(y, {
|
|
478
|
+
variant: "outline",
|
|
479
|
+
onClick: () => W(!1),
|
|
480
|
+
disabled: I.isPending,
|
|
481
|
+
children: "Cancel"
|
|
482
|
+
}), /* @__PURE__ */ _(y, {
|
|
483
|
+
variant: "destructive",
|
|
484
|
+
onClick: Me,
|
|
485
|
+
disabled: I.isPending,
|
|
486
|
+
children: I.isPending ? "Archiving…" : "Archive assessment"
|
|
487
|
+
})] })] })
|
|
441
488
|
})
|
|
442
489
|
]
|
|
443
490
|
});
|
|
444
|
-
},
|
|
491
|
+
}, L = ({ icon: e, label: n, value: r, divider: i }) => /* @__PURE__ */ v("div", {
|
|
445
492
|
className: t("flex items-center gap-3", i && "sm:border-l sm:border-border-seam sm:pl-5"),
|
|
446
|
-
children: [/* @__PURE__ */
|
|
493
|
+
children: [/* @__PURE__ */ _("span", {
|
|
447
494
|
className: "flex h-11 w-11 shrink-0 items-center justify-center rounded-full bg-[var(--color-accent-soft)] text-[var(--color-accent-teal)]",
|
|
448
495
|
children: e
|
|
449
|
-
}), /* @__PURE__ */
|
|
496
|
+
}), /* @__PURE__ */ v("div", {
|
|
450
497
|
className: "min-w-0",
|
|
451
|
-
children: [/* @__PURE__ */
|
|
498
|
+
children: [/* @__PURE__ */ _("p", {
|
|
452
499
|
className: "text-xs font-medium uppercase tracking-wide text-text-secondary",
|
|
453
500
|
children: n
|
|
454
|
-
}), /* @__PURE__ */
|
|
501
|
+
}), /* @__PURE__ */ _("p", {
|
|
455
502
|
className: "mt-0.5 text-lg font-semibold tabular-nums text-text-primary",
|
|
456
503
|
children: r
|
|
457
504
|
})]
|
|
458
505
|
})]
|
|
459
|
-
}),
|
|
506
|
+
}), R = (e) => {
|
|
460
507
|
switch (e) {
|
|
461
508
|
case "SHORT_ANSWER": return "Learners type a short answer — auto-graded against the answer key.";
|
|
462
509
|
case "ESSAY": return "Open long-form response — graded manually from Submissions.";
|
|
463
510
|
case "CODE": return "Code response — graded manually from Submissions.";
|
|
464
511
|
default: return "Free-text response.";
|
|
465
512
|
}
|
|
466
|
-
},
|
|
467
|
-
let n =
|
|
468
|
-
return /* @__PURE__ */
|
|
513
|
+
}, Ce = ({ index: e, question: t }) => {
|
|
514
|
+
let n = A(t.options), r = M.has(t.type) || t.type === "TRUE_FALSE", i = t.type === "MULTIPLE_CHOICE";
|
|
515
|
+
return /* @__PURE__ */ _("li", { children: /* @__PURE__ */ _(b, {
|
|
469
516
|
treatment: "plain",
|
|
470
517
|
className: "p-4 sm:p-5",
|
|
471
|
-
children: /* @__PURE__ */
|
|
518
|
+
children: /* @__PURE__ */ v("div", {
|
|
472
519
|
className: "flex items-start gap-3.5",
|
|
473
|
-
children: [/* @__PURE__ */
|
|
520
|
+
children: [/* @__PURE__ */ _("span", {
|
|
474
521
|
className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-[var(--color-accent-soft)] text-sm font-bold tabular-nums text-[var(--color-accent-teal)]",
|
|
475
522
|
children: e
|
|
476
|
-
}), /* @__PURE__ */
|
|
523
|
+
}), /* @__PURE__ */ v("div", {
|
|
477
524
|
className: "min-w-0 flex-1",
|
|
478
525
|
children: [
|
|
479
|
-
/* @__PURE__ */
|
|
526
|
+
/* @__PURE__ */ v("div", {
|
|
480
527
|
className: "flex flex-wrap items-center gap-2",
|
|
481
|
-
children: [/* @__PURE__ */
|
|
528
|
+
children: [/* @__PURE__ */ _(a, { status: t.type }), /* @__PURE__ */ v("span", {
|
|
482
529
|
className: "rounded-full bg-bg-sunken px-2 py-0.5 text-xs font-medium tabular-nums text-text-secondary",
|
|
483
530
|
children: [
|
|
484
531
|
t.points,
|
|
@@ -487,27 +534,27 @@ var j = (e) => {
|
|
|
487
534
|
]
|
|
488
535
|
})]
|
|
489
536
|
}),
|
|
490
|
-
/* @__PURE__ */
|
|
537
|
+
/* @__PURE__ */ _("p", {
|
|
491
538
|
className: "mt-2.5 font-medium text-text-primary",
|
|
492
539
|
children: t.prompt
|
|
493
540
|
}),
|
|
494
|
-
r && n.length > 0 && /* @__PURE__ */
|
|
541
|
+
r && n.length > 0 && /* @__PURE__ */ _("ul", {
|
|
495
542
|
className: "mt-3 flex flex-col gap-2",
|
|
496
|
-
children: n.map((e, t) => /* @__PURE__ */
|
|
543
|
+
children: n.map((e, t) => /* @__PURE__ */ v("li", {
|
|
497
544
|
className: "flex items-center gap-2.5 rounded-lg border border-border-seam bg-bg-surface px-3 py-2 text-sm text-text-primary",
|
|
498
|
-
children: [
|
|
545
|
+
children: [_(i ? g : f, { className: "h-4 w-4 shrink-0 text-text-secondary opacity-60" }), /* @__PURE__ */ _("span", {
|
|
499
546
|
className: "min-w-0",
|
|
500
547
|
children: e.label
|
|
501
548
|
})]
|
|
502
549
|
}, e.id ?? `${t}-${e.label}`))
|
|
503
550
|
}),
|
|
504
|
-
!r && /* @__PURE__ */
|
|
551
|
+
!r && /* @__PURE__ */ _("p", {
|
|
505
552
|
className: "mt-3 rounded-lg border border-dashed border-border-seam bg-bg-sunken px-3 py-2 text-xs text-text-secondary",
|
|
506
|
-
children:
|
|
553
|
+
children: R(t.type)
|
|
507
554
|
}),
|
|
508
|
-
t.explanation && /* @__PURE__ */
|
|
555
|
+
t.explanation && /* @__PURE__ */ v("p", {
|
|
509
556
|
className: "mt-3 flex items-start gap-1.5 rounded-lg bg-bg-sunken px-3 py-2 text-xs text-text-secondary",
|
|
510
|
-
children: [/* @__PURE__ */
|
|
557
|
+
children: [/* @__PURE__ */ _(m, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-status-warning-text" }), /* @__PURE__ */ _("span", { children: t.explanation })]
|
|
511
558
|
})
|
|
512
559
|
]
|
|
513
560
|
})]
|
|
@@ -515,6 +562,6 @@ var j = (e) => {
|
|
|
515
562
|
}) });
|
|
516
563
|
};
|
|
517
564
|
//#endregion
|
|
518
|
-
export {
|
|
565
|
+
export { I as AssessmentDetailPage };
|
|
519
566
|
|
|
520
567
|
//# sourceMappingURL=AssessmentDetailPage.js.map
|