import { prisma } from "@/lib/prisma"; import { notFound } from "next/navigation"; import Link from "next/link"; import { SortableLessons } from "@/components/admin/sortable-lessons"; interface Props { params: Promise<{ courseId: string; moduleId: string }>; } export default async function ModulePage({ params }: Props) { const { courseId, moduleId } = await params; const [module, allModules] = await Promise.all([ prisma.module.findUnique({ where: { id: moduleId }, include: { course: { select: { title: true } }, lessons: { orderBy: { order: "asc" } }, }, }), prisma.module.findMany({ where: { courseId, NOT: { id: moduleId } }, select: { id: true, title: true }, orderBy: { order: "asc" }, }), ]); if (!module || module.courseId !== courseId) notFound(); return (

{module.title}

{module.lessons.length} {module.lessons.length === 1 ? "урок" : module.lessons.length < 5 ? "урока" : "уроков"}

Уроки модуля

); }