feat(app): add error/loading boundaries across all dashboard routes and new routes
- Add error.tsx and loading.tsx boundaries for admin, parent, student, teacher routes - Add admin announcements edit, audit-logs overview, curriculum-map, invitation-codes, permissions, questions, roles routes - Add admin elective detail and components, files, course-plans, users, scheduling boundaries - Add messages group-compose route - Add parent course-plans, elective, grades report-card, practice routes - Add student course-plans, elective detail, error-book dialogs, grades report-card, learning study-path, leave, schedule boundaries - Add teacher attendance report, classes boundaries, course-plans boundaries, elective, exams analytics/edit-rich/all/create/new, grades report-card, homework boundaries, leave, lesson-plans calendar - Add auth loading, onboarding loading, api cron
This commit is contained in:
@@ -15,6 +15,7 @@ import { GradeDistributionPanel } from "@/modules/school/components/grade-dashbo
|
||||
import { GradeHomeworkPanel } from "@/modules/school/components/grade-dashboard/grade-homework-panel"
|
||||
import { GradeExamsPanel } from "@/modules/school/components/grade-dashboard/grade-exams-panel"
|
||||
import { GradeProgressPanel } from "@/modules/school/components/grade-dashboard/grade-progress-panel"
|
||||
import { SchoolErrorBoundary } from "@/modules/school/components/school-error-boundary"
|
||||
import { EmptyState } from "@/shared/components/ui/empty-state"
|
||||
import { ChipNav } from "@/shared/components/ui/chip-nav"
|
||||
import { BarChart3 } from "lucide-react"
|
||||
@@ -125,54 +126,56 @@ export default async function GradeDashboardPage({
|
||||
<p className="text-muted-foreground">{t("grades.gradeDashboard.description")}</p>
|
||||
</div>
|
||||
|
||||
<GradeInsightsFilters
|
||||
grades={grades.map((g) => ({ id: g.id, name: g.name, schoolName: g.school.name }))}
|
||||
currentGradeId={selected || "all"}
|
||||
buildHref={buildHref}
|
||||
/>
|
||||
|
||||
{!selected ? (
|
||||
<EmptyState
|
||||
icon={BarChart3}
|
||||
title={t("grades.gradeDashboard.selectToView")}
|
||||
description={t("grades.gradeDashboard.selectToViewDescription")}
|
||||
className="h-[360px] bg-card"
|
||||
<SchoolErrorBoundary>
|
||||
<GradeInsightsFilters
|
||||
grades={grades.map((g) => ({ id: g.id, name: g.name, schoolName: g.school.name }))}
|
||||
currentGradeId={selected || "all"}
|
||||
buildHref={buildHref}
|
||||
/>
|
||||
) : (
|
||||
<div className="space-y-6">
|
||||
<ChipNav
|
||||
options={tabOptions}
|
||||
currentId={tab}
|
||||
buildHref={buildTabHref}
|
||||
|
||||
{!selected ? (
|
||||
<EmptyState
|
||||
icon={BarChart3}
|
||||
title={t("grades.gradeDashboard.selectToView")}
|
||||
description={t("grades.gradeDashboard.selectToViewDescription")}
|
||||
className="h-[360px] bg-card"
|
||||
/>
|
||||
|
||||
{tab === "distribution" && distributionData && (
|
||||
<GradeDistributionPanel data={distributionData} />
|
||||
)}
|
||||
{tab === "homework" && homeworkData && (
|
||||
<GradeHomeworkPanel data={homeworkData} />
|
||||
)}
|
||||
{tab === "exams" && examsData && (
|
||||
<GradeExamsPanel data={examsData} />
|
||||
)}
|
||||
{tab === "progress" && progressData && (
|
||||
<GradeProgressPanel data={progressData} />
|
||||
)}
|
||||
|
||||
{/* Fallback: data was null (e.g. homework insights returned null) */}
|
||||
{((tab === "distribution" && !distributionData) ||
|
||||
(tab === "homework" && !homeworkData) ||
|
||||
(tab === "exams" && !examsData) ||
|
||||
(tab === "progress" && !progressData)) && (
|
||||
<EmptyState
|
||||
icon={BarChart3}
|
||||
title={t("grades.gradeDashboard.noData")}
|
||||
description={t("grades.gradeDashboard.noDataDescription")}
|
||||
className="h-[360px] bg-card"
|
||||
) : (
|
||||
<div className="space-y-6">
|
||||
<ChipNav
|
||||
options={tabOptions}
|
||||
currentId={tab}
|
||||
buildHref={buildTabHref}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{tab === "distribution" && distributionData && (
|
||||
<GradeDistributionPanel data={distributionData} />
|
||||
)}
|
||||
{tab === "homework" && homeworkData && (
|
||||
<GradeHomeworkPanel data={homeworkData} />
|
||||
)}
|
||||
{tab === "exams" && examsData && (
|
||||
<GradeExamsPanel data={examsData} />
|
||||
)}
|
||||
{tab === "progress" && progressData && (
|
||||
<GradeProgressPanel data={progressData} />
|
||||
)}
|
||||
|
||||
{/* Fallback: data was null (e.g. homework insights returned null) */}
|
||||
{((tab === "distribution" && !distributionData) ||
|
||||
(tab === "homework" && !homeworkData) ||
|
||||
(tab === "exams" && !examsData) ||
|
||||
(tab === "progress" && !progressData)) && (
|
||||
<EmptyState
|
||||
icon={BarChart3}
|
||||
title={t("grades.gradeDashboard.noData")}
|
||||
description={t("grades.gradeDashboard.noDataDescription")}
|
||||
className="h-[360px] bg-card"
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</SchoolErrorBoundary>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user