import { prisma } from "@/lib/prisma"; import { notFound } from "next/navigation"; import Link from "next/link"; import { CourseEditForm } from "@/components/admin/course-edit-form"; import { SortableModules } from "@/components/admin/sortable-modules"; import { EnrollmentManager } from "@/components/admin/enrollment-manager"; interface Props { params: Promise<{ courseId: string }>; } export default async function CourseDetailPage({ params }: Props) { const { courseId } = await params; const [course, allStudents, categories] = await Promise.all([ prisma.course.findUnique({ where: { id: courseId }, include: { modules: { orderBy: { order: "asc" }, include: { _count: { select: { lessons: true } } }, }, enrollments: { select: { userId: true, expiresAt: true }, }, accessLogs: { orderBy: { createdAt: "desc" }, take: 50, include: { user: { select: { name: true } }, grantedBy: { select: { name: true } }, }, }, }, }), prisma.user.findMany({ where: { role: "student" }, select: { id: true, name: true, email: true }, orderBy: { name: "asc" }, }), prisma.category.findMany({ orderBy: { order: "asc" } }), ]); if (!course) notFound(); return (
{/* Breadcrumb */} {/* Course metadata */}

Основная информация

{/* Modules */}

Модули

{course.modules.length} модулей
{/* Access management */}

Управление доступом

); }