import { UserX } from "lucide-react" import { getStudentClasses, getStudentSchedule } from "@/modules/classes/data-access" import { getCurrentStudentUser } from "@/modules/users/data-access" import { StudentScheduleFilters } from "@/modules/student/components/student-schedule-filters" import { StudentScheduleView } from "@/modules/student/components/student-schedule-view" import { EmptyState } from "@/shared/components/ui/empty-state" export const dynamic = "force-dynamic" type SearchParams = { [key: string]: string | string[] | undefined } export default async function StudentSchedulePage({ searchParams, }: { searchParams: Promise }) { const student = await getCurrentStudentUser() if (!student) { return (

Schedule

Your weekly timetable.

) } const [sp, classes, schedule] = await Promise.all([ searchParams, getStudentClasses(student.id), getStudentSchedule(student.id), ]) const classIdParam = sp.classId const resolveClassId = (param: string | string[] | undefined): string => { if (typeof param === "string") return param if (Array.isArray(param)) return param[0] ?? "all" return "all" } const classId = resolveClassId(classIdParam) const filteredItems = classId !== "all" ? schedule.filter((s) => s.classId === classId) : schedule return (

Schedule

Your weekly timetable.

) }