Files
wr.do/app/(protected)/admin/page.tsx
2024-07-26 22:08:57 +08:00

37 lines
1.0 KiB
TypeScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { redirect } from "next/navigation";
import { getCurrentUser } from "@/lib/session";
import { constructMetadata } from "@/lib/utils";
import { DashboardHeader } from "@/components/dashboard/header";
import InfoCard from "@/components/dashboard/info-card";
import TransactionsList from "@/components/dashboard/transactions-list";
export const metadata = constructMetadata({
title: "Admin  Next Template",
description: "Admin page for only admin management.",
});
export default async function AdminPage() {
const user = await getCurrentUser();
if (!user || user.role !== "ADMIN") redirect("/login");
return (
<>
<DashboardHeader
heading="Admin Panel"
text="Access only for users with ADMIN role."
/>
<div className="flex flex-col gap-5">
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-4">
<InfoCard />
<InfoCard />
<InfoCard />
<InfoCard />
</div>
<TransactionsList />
<TransactionsList />
</div>
</>
);
}