44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
import { redirect } from "next/navigation";
|
|
|
|
import { getSession } from "@/lib/auth";
|
|
import { ShellPage } from "@/components/page-templates";
|
|
import { SectionCard } from "@/components/ui";
|
|
|
|
function roleLabel(role: string) {
|
|
if (role === "admin_client") {
|
|
return "Admin Client";
|
|
}
|
|
|
|
if (role === "agent") {
|
|
return "Agent";
|
|
}
|
|
|
|
return "Super Admin";
|
|
}
|
|
|
|
export default async function ProfilePage() {
|
|
const session = await getSession();
|
|
if (!session) {
|
|
redirect("/login");
|
|
}
|
|
|
|
const shell = session.role === "agent" ? "agent" : session.role === "super_admin" ? "super-admin" : "admin";
|
|
|
|
return (
|
|
<ShellPage
|
|
shell={shell}
|
|
title="My Profile"
|
|
description="Informasi akun dasar yang nantinya terhubung ke session dan role."
|
|
>
|
|
<SectionCard title="Profile summary">
|
|
<div className="grid gap-3 text-sm text-on-surface-variant md:grid-cols-2">
|
|
<p>Full name: {session.fullName}</p>
|
|
<p>Email: {session.email}</p>
|
|
<p>Role: {roleLabel(session.role)}</p>
|
|
<p>Tenant: {session.tenantName}</p>
|
|
</div>
|
|
</SectionCard>
|
|
</ShellPage>
|
|
);
|
|
}
|