added new requirements and fix UI bugs

This commit is contained in:
rgrgogu
2026-07-15 16:26:59 +08:00
parent 95987edd22
commit 5a9c0390e6
27 changed files with 1423 additions and 232 deletions
@@ -24,7 +24,7 @@ function LessonSkeleton() {
* when the caller already renders its own lesson header
* above (e.g. LessonDetails), to avoid showing it twice.
*/
const LessonBlock = ({ lesson, loading = false, showHeader = true }) => {
const LessonBlock = ({ lesson, loading = false, showHeader = true, onWatchProgress }) => {
if (!lesson && !loading) {
return (
<div className="h-full w-full flex items-center justify-center text-muted-foreground py-20">
@@ -45,6 +45,7 @@ const LessonBlock = ({ lesson, loading = false, showHeader = true }) => {
blocks={lesson.blocks ?? []}
empty="No content blocks yet."
showHeader={showHeader}
onWatchProgress={onWatchProgress}
/>
</div>
</PreviewChrome>
@@ -0,0 +1,35 @@
import { useState } from "react";
import { CheckCircle2 } from "lucide-react";
import { Button } from "@/components/ui/button";
/**
* Explicit self-report completion button, backing the manual_complete
* completion requirement type. Renders as already-completed (disabled,
* checkmark) once the lesson is marked done.
*/
export default function MarkCompleteButton({ label, completed, onMarkComplete }) {
const [saving, setSaving] = useState(false);
const handleClick = async () => {
if (completed || saving) return;
setSaving(true);
await onMarkComplete?.();
setSaving(false);
};
return (
<div className="flex justify-center py-6">
<Button
type="button"
size="lg"
variant={completed ? "outline" : "default"}
disabled={completed || saving}
onClick={handleClick}
className="gap-2"
>
<CheckCircle2 className="size-4" />
{completed ? "Completed" : saving ? "Marking complete…" : (label || "Mark Complete")}
</Button>
</div>
);
}