aboutsummaryrefslogtreecommitdiffstats
path: root/apps/web/app/dashboard/admin/page.tsx
blob: cf97698b56d30fd867515f5d481011b4a69b8636 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { redirect } from "next/navigation";
import AdminActions from "@/components/dashboard/admin/AdminActions";
import { AdminCard } from "@/components/dashboard/admin/AdminCard";
import { AdminNotices } from "@/components/dashboard/admin/AdminNotices";
import ServerStats from "@/components/dashboard/admin/ServerStats";
import UserList from "@/components/dashboard/admin/UserList";
import { getServerAuthSession } from "@/server/auth";

export default async function AdminPage() {
  const session = await getServerAuthSession();
  if (!session || session.user.role !== "admin") {
    redirect("/");
  }
  return (
    <div className="flex flex-col gap-4">
      <AdminNotices />
      <AdminCard>
        <ServerStats />
        <AdminActions />
      </AdminCard>
      <AdminCard>
        <UserList />
      </AdminCard>
    </div>
  );
}