Add lesson complete button with homework-aware logic
- Show "Отметить как пройденный" button only on lessons without homework - Show static "Пройдено" badge on homework lessons completed via approval - Auto-create LessonProgress when curator/admin approves homework submission - Revalidate student lesson, course, and dashboard pages on approval Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -8,13 +8,24 @@ export function LessonCompleteButton({
|
||||
lessonId,
|
||||
slug,
|
||||
isCompleted,
|
||||
readOnly = false,
|
||||
}: {
|
||||
lessonId: string;
|
||||
slug: string;
|
||||
isCompleted: boolean;
|
||||
readOnly?: boolean;
|
||||
}) {
|
||||
const [pending, startTransition] = useTransition();
|
||||
|
||||
if (readOnly) {
|
||||
return (
|
||||
<div className="btn-aubade btn-aubade-accent flex items-center gap-2 px-5 py-2.5 text-sm cursor-default select-none">
|
||||
<Check size={15} strokeWidth={3} />
|
||||
Пройдено
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<button
|
||||
onClick={() => startTransition(() => toggleLessonProgress(lessonId, slug))}
|
||||
|
||||
Reference in New Issue
Block a user