Files
Compass/app/Header.tsx
MartinBraquet 6b0e343412 Redirect url
2025-07-27 22:22:46 +02:00

55 lines
1.7 KiB
TypeScript

"use client";
import Link from "next/link";
import {useSession, signOut} from "next-auth/react";
export default function Header() {
const {data: session} = useSession();
console.log(session);
return (
<header className="w-full bg-white shadow-md py-4 px-8">
<nav className="flex justify-between items-center">
<Link href="/" className="text-xl font-bold text-gray-800 hover:text-blue-600 transition-colors">
BayesBond
</Link>
<div className="flex items-center space-x-4">
<Link
href="/profiles"
className="bg-blue-500 text-white px-4 py-2 rounded-lg hover:bg-blue-600 transition"
>
Profiles
</Link>
{session ? (
<>
<div className="flex items-center space-x-4">
<div className="text-sm text-gray-500">
{session.user?.name && <div>{session.user.name}</div>}
<div>{session.user?.email}</div>
</div>
<button
onClick={() => signOut({callbackUrl: "/"})}
className="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition"
>
Sign Out
</button>
</div>
</>
) : (
<>
<Link href="/login" className="bg-blue-500 text-white px-4 py-2 rounded-lg hover:bg-blue-600 transition">
Sign In
</Link>
<Link href="/register"
className="bg-blue-500 text-white px-4 py-2 rounded-lg hover:bg-blue-600 transition">
Sign Up
</Link>
</>
)}
</div>
</nav>
</header>
);
}