feat(app): add error/loading boundaries and update dashboard routes
- Add error.tsx and loading.tsx boundaries for admin, parent, student, teacher routes - Add dashboard-error-fallback and dashboard-loading-skeleton components - Add student/learning page, parent/leave routes, teacher textbook components - Update existing app routes across auth, dashboard, and API endpoints - Update proxy middleware and next-auth type declarations
This commit is contained in:
@@ -5,11 +5,10 @@ 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"
|
||||
import { getParam, type SearchParams } from "@/shared/lib/search-params"
|
||||
|
||||
export const dynamic = "force-dynamic"
|
||||
|
||||
type SearchParams = { [key: string]: string | string[] | undefined }
|
||||
|
||||
export default async function StudentSchedulePage({
|
||||
searchParams,
|
||||
}: {
|
||||
@@ -18,7 +17,7 @@ export default async function StudentSchedulePage({
|
||||
const student = await getCurrentStudentUser()
|
||||
if (!student) {
|
||||
return (
|
||||
<div className="h-full flex-1 flex-col space-y-8 p-8 md:flex">
|
||||
<div className="space-y-8">
|
||||
<div>
|
||||
<h2 className="text-2xl font-bold tracking-tight">Schedule</h2>
|
||||
<p className="text-muted-foreground">Your weekly timetable.</p>
|
||||
@@ -34,18 +33,12 @@ export default async function StudentSchedulePage({
|
||||
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 classId = getParam(sp, "classId") ?? "all"
|
||||
const filteredItems =
|
||||
classId !== "all" ? schedule.filter((s) => s.classId === classId) : schedule
|
||||
|
||||
return (
|
||||
<div className="flex h-full flex-col space-y-8 p-8">
|
||||
<div className="space-y-8">
|
||||
<div className="flex flex-col justify-between gap-4 md:flex-row md:items-center">
|
||||
<div>
|
||||
<h2 className="text-2xl font-bold tracking-tight">Schedule</h2>
|
||||
|
||||
Reference in New Issue
Block a user