import type { Metadata } from "next"
import type { JSX } from "react"
import { getTranslations } from "next-intl/server"

import { AdminDashboardView } from "@/modules/dashboard/components/admin-dashboard/admin-dashboard"
import { getAdminDashboardStreams } from "@/modules/dashboard/streams"

export const dynamic = "force-dynamic"

export async function generateMetadata(): Promise<Metadata> {
  const t = await getTranslations("dashboard")
  return {
    title: t("title.admin"),
    description: t("description.admin"),
  }
}

export default async function AdminDashboardPage(): Promise<JSX.Element> {
  // 权限校验在此完成（阻塞），返回后各分区 Promise 并行执行、独立流式渲染
  const streams = await getAdminDashboardStreams()
  return <AdminDashboardView streams={streams} />
}
