- 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
34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
import { notFound } from "next/navigation"
|
|
import type { Metadata } from "next"
|
|
import type { JSX } from "react"
|
|
import { getTranslations } from "next-intl/server"
|
|
import { requirePermission } from "@/shared/lib/auth-guard"
|
|
import { Permissions } from "@/shared/types/permissions"
|
|
import { getMessageDetailPageData } from "@/modules/messaging/data-access"
|
|
import { MessageDetail } from "@/modules/messaging/components/message-detail"
|
|
|
|
export const dynamic = "force-dynamic"
|
|
|
|
export async function generateMetadata(): Promise<Metadata> {
|
|
const t = await getTranslations("messages")
|
|
return { title: t("title.detail") }
|
|
}
|
|
|
|
export default async function MessageDetailPage({
|
|
params,
|
|
}: {
|
|
params: Promise<{ id: string }>
|
|
}): Promise<JSX.Element> {
|
|
const ctx = await requirePermission(Permissions.MESSAGE_READ)
|
|
const { id } = await params
|
|
|
|
const message = await getMessageDetailPageData(id, ctx.userId)
|
|
if (!message) notFound()
|
|
|
|
return (
|
|
<div className="flex h-full flex-col p-8">
|
|
<MessageDetail message={message} currentUserId={ctx.userId} />
|
|
</div>
|
|
)
|
|
}
|