This commit is contained in:
Tom Chien (IQ-AS)
2026-09-08 17:46:28 +08:00
commit e25c995560
55 changed files with 6928 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
import { auth, signIn, signOut } from "@/auth";
export default async function TopNav() {
const session = await auth();
const user = session?.user;
return (
<header className="flex h-14 items-center justify-between bg-[#111827] px-6 text-white">
<span className="text-lg font-semibold">Global IT Cost Dashboard</span>
{user ? (
<div className="flex items-center gap-3">
<span className="text-sm text-white/80">{user.name ?? user.email}</span>
<form
action={async () => {
"use server";
await signOut({ redirectTo: "/" });
}}
>
<button
type="submit"
className="rounded-md bg-white/10 px-4 py-1.5 text-sm font-medium hover:bg-white/20"
>
Logout
</button>
</form>
</div>
) : (
<form
action={async () => {
"use server";
await signIn("microsoft-entra-id");
}}
>
<button
type="submit"
className="rounded-md bg-white/10 px-4 py-1.5 text-sm font-medium hover:bg-white/20"
>
Login
</button>
</form>
)}
</header>
);
}