Security: Add admin/layout.tsx auth guard; Add requirePermission() to 12 admin pages Dashboard: Fix StudentStatsGrid rendering; Fix teacher greeting; Add loading/error boundaries; Fix col-span; Add metadata Announcements: Fix audience filtering; Add user detail page; Trigger notifications on publish; Pass classes data; Add loading.tsx Messages: Implement soft delete; Add unread badge with polling; Add notification dropdown polling; Add keyword search; Add quiet hours DND Management: Add loading/error for 9 admin routes; Fix admin-classes-view to use Select for school/grade Profile/Settings: Add loading/error; Fix parent role routing; Create ParentSettingsView; Integrate AiProviderSettingsCard; Add Tab URL persistence; Add logout confirm; Add avatar; Fix Progress arbitrary class Schema: Add senderDeletedAt/receiverDeletedAt to messages; Add quietHours to notificationPreferences; Add uniqueIndex import Docs: Update architecture docs 004/005
40 lines
1.2 KiB
TypeScript
40 lines
1.2 KiB
TypeScript
import { requireAuth } from "@/shared/lib/auth-guard"
|
|
import { getParentDashboardData } from "@/modules/parent/data-access"
|
|
import { ParentDashboard } from "@/modules/parent/components/parent-dashboard"
|
|
import { ParentNoChildrenPage } from "@/modules/parent/components/parent-children-data-page"
|
|
import { Users } from "lucide-react"
|
|
|
|
export const dynamic = "force-dynamic"
|
|
|
|
export const metadata = { title: "Dashboard - Next_Edu" }
|
|
|
|
export default async function ParentDashboardPage() {
|
|
const ctx = await requireAuth()
|
|
|
|
// 非 admin 且 dataScope 非 children 类型时,显示空状态
|
|
if (
|
|
ctx.dataScope.type !== "all" &&
|
|
!(ctx.dataScope.type === "children" && ctx.dataScope.childrenIds.length > 0)
|
|
) {
|
|
return (
|
|
<div className="p-6 md:p-8">
|
|
<ParentNoChildrenPage
|
|
title="Parent Dashboard"
|
|
description="Here's an overview of your children."
|
|
icon={Users}
|
|
emptyTitle="No children linked"
|
|
emptyDescription="Your account is not linked to any student accounts yet. Please contact the school administrator."
|
|
/>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
const data = await getParentDashboardData(ctx.userId)
|
|
|
|
return (
|
|
<div className="p-6 md:p-8">
|
|
<ParentDashboard data={data} />
|
|
</div>
|
|
)
|
|
}
|