36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
import Image from "next/image";
|
|
import { Button } from "./ui/button";
|
|
import login from "@/app/actions/login";
|
|
import { getCurrentUser } from "@/lib/user";
|
|
import logout from "@/app/actions/logout";
|
|
import Link from "next/link";
|
|
|
|
export default async function Header() {
|
|
const user = await getCurrentUser();
|
|
|
|
return (
|
|
<header className="relative flex items-center justify-between w-full h-16 px-8 bg-gray-100">
|
|
<div />
|
|
<Link href="/" className="absolute left-1/2 -translate-x-1/2 flex items-center gap-4">
|
|
<Image
|
|
src="/emblem.png"
|
|
width={28}
|
|
height={28}
|
|
alt="Emblem of the European Federation"
|
|
/>
|
|
<h3>European Federation</h3>
|
|
</Link>
|
|
{
|
|
user ? (
|
|
<form action={logout}>
|
|
<Button size="lg" type="submit">{`Logout from ${user.firstName} ${user.secondName}`}</Button>
|
|
</form>
|
|
) : (
|
|
<form action={login}>
|
|
<Button size="lg" type="submit">Sign in with Kotosoft ID</Button>
|
|
</form>
|
|
)
|
|
}
|
|
</header>
|
|
)
|
|
} |