diff --git a/src/app/(student)/courses/[slug]/lessons/[lessonId]/page.tsx b/src/app/(student)/courses/[slug]/lessons/[lessonId]/page.tsx index 9af3191..ef769b5 100644 --- a/src/app/(student)/courses/[slug]/lessons/[lessonId]/page.tsx +++ b/src/app/(student)/courses/[slug]/lessons/[lessonId]/page.tsx @@ -7,6 +7,7 @@ import { KinescopePlayer } from "@/components/player/kinescope-player"; import { LessonContent } from "@/components/student/lesson-content"; import { LessonCompleteButton } from "@/components/student/lesson-complete-button"; import { HomeworkSection } from "@/components/student/homework-section"; +import { QuizSection } from "@/components/student/quiz-section"; import { LessonComments } from "@/components/student/lesson-comments"; import { FileFormatBadge } from "@/components/shared/file-format-badge"; @@ -26,6 +27,9 @@ export default async function LessonPage({ params }: Props) { include: { files: { orderBy: { createdAt: "asc" } }, homework: true, + quiz: { + include: { questions: { orderBy: { order: "asc" } } }, + }, module: { include: { course: { @@ -71,6 +75,12 @@ export default async function LessonPage({ params }: Props) { }) : null; + const quizAttempt = lesson?.quiz && session && !isAdmin + ? await prisma.quizAttempt.findFirst({ + where: { quizId: lesson.quiz.id, userId: session.user.id }, + }) + : null; + if (!lesson || lesson.module.course.slug !== slug) notFound(); const isCompleted = !!progress; @@ -163,6 +173,21 @@ export default async function LessonPage({ params }: Props) { )} + {/* Quiz */} + {lesson.quiz && !isAdmin && ( +
+ Тест +
+Домашнее задание
+ Тест +
++ Вопросов нет +
+ )} + + {questions.map((q, idx) => ( +{q.text}
++ {idx + 1}. {q.text} +
+