mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
fix more
This commit is contained in:
@@ -48,7 +48,6 @@ const lessonSchema = z.object({
|
||||
z.object({ value: z.string().min(1, "Objective cannot be empty.") })
|
||||
).optional(),
|
||||
blocks: z.array(z.any()).optional(),
|
||||
requirements: z.array(z.any()).optional(),
|
||||
});
|
||||
|
||||
const schema = z.object({
|
||||
@@ -198,7 +197,7 @@ function StepLessons({ control, register, errors }) {
|
||||
type="button"
|
||||
variant="outline"
|
||||
className="w-full"
|
||||
onClick={() => append({ title: "", description: "", objectives: [], blocks: [], requirements: [] })}
|
||||
onClick={() => append({ title: "", description: "", objectives: [], blocks: [] })}
|
||||
>
|
||||
<Plus className="h-4 w-4 mr-1" /> Add Lesson
|
||||
</Button>
|
||||
@@ -243,9 +242,6 @@ function StepPageBuilder({ control, setValue }) {
|
||||
return next;
|
||||
});
|
||||
|
||||
const requirements = activeLesson?.requirements ?? [];
|
||||
const setRequirements = (next) => setValue(`lessons.${activeIndex}.requirements`, next, { shouldDirty: true });
|
||||
|
||||
return (
|
||||
<div className="space-y-3">
|
||||
{lessons.map((l, i) => (
|
||||
@@ -254,7 +250,6 @@ function StepPageBuilder({ control, setValue }) {
|
||||
<p className="text-sm font-medium">{l.title || `Lesson ${i + 1}`}</p>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
{(l.blocks?.length ?? 0)} block{(l.blocks?.length ?? 0) !== 1 ? "s" : ""}
|
||||
{(l.requirements?.length ?? 0) > 0 && ` · ${l.requirements.length} requirement${l.requirements.length !== 1 ? "s" : ""}`}
|
||||
</p>
|
||||
</div>
|
||||
<Button
|
||||
@@ -321,21 +316,6 @@ function StepPageBuilder({ control, setValue }) {
|
||||
</PreviewChrome>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="mt-6 pt-4 border-t space-y-3">
|
||||
<div>
|
||||
<p className="text-sm font-medium">Completion Requirements — {activeLesson?.title || `Lesson ${activeIndex + 1}`}</p>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
What this specific lesson's blocks unlock — e.g. a video block above makes "Finish Watching the Full Video" available.
|
||||
</p>
|
||||
</div>
|
||||
<DraftRequirementsEditor
|
||||
entityType="lesson"
|
||||
items={requirements}
|
||||
onChange={setRequirements}
|
||||
blockTypes={blocks.map((b) => b.type)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<DrawerFooter className="border-t flex-row justify-end">
|
||||
@@ -387,7 +367,7 @@ function StepReview({ data, tierCategories, requirements }) {
|
||||
<div key={i} className="flex items-center justify-between text-sm border-t border-border pt-2 first:border-t-0 first:pt-0">
|
||||
<span>{i + 1}. {l.title}</span>
|
||||
<span className="text-muted-foreground text-xs">
|
||||
{(l.objectives ?? []).filter((o) => o.value).length} objective(s) · {(l.blocks ?? []).length} block(s) · {(l.requirements ?? []).length} requirement(s)
|
||||
{(l.objectives ?? []).filter((o) => o.value).length} objective(s) · {(l.blocks ?? []).length} block(s)
|
||||
</span>
|
||||
</div>
|
||||
))}
|
||||
@@ -468,7 +448,6 @@ export default function AddLibraryUnit() {
|
||||
description: l.description || null,
|
||||
objectives: (l.objectives ?? []).map((o) => o.value).filter(Boolean),
|
||||
blocks: l.blocks ?? [],
|
||||
requirements: (l.requirements ?? []).map(({ _key, ...r }) => r),
|
||||
})),
|
||||
createdBy: user?.user_id,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user