init
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import Link from "next/link";
|
||||
import { Activity, Dumbbell, LayoutDashboard, Settings } from "lucide-react";
|
||||
import { auth, signOut } from "@/auth";
|
||||
import { SignOutButton } from "./sign-out-button";
|
||||
|
||||
const links = [
|
||||
{ href: "/", label: "Panel", icon: LayoutDashboard },
|
||||
@@ -8,7 +10,14 @@ const links = [
|
||||
{ href: "/settings", label: "Ustawienia", icon: Settings },
|
||||
];
|
||||
|
||||
export function Nav() {
|
||||
export async function Nav() {
|
||||
const session = await auth();
|
||||
|
||||
const signOutAction = async () => {
|
||||
"use server";
|
||||
await signOut({ redirectTo: "/login" });
|
||||
};
|
||||
|
||||
return (
|
||||
<header className="border-b border-muted/40 bg-surface">
|
||||
<div className="mx-auto flex max-w-5xl items-center justify-between px-4 py-3 sm:px-6">
|
||||
@@ -39,6 +48,12 @@ export function Nav() {
|
||||
<span className="hidden sm:inline">{label}</span>
|
||||
</Link>
|
||||
))}
|
||||
{session?.user?.name && (
|
||||
<span className="hidden px-2 text-xs text-fg/40 sm:inline">
|
||||
{session.user.name}
|
||||
</span>
|
||||
)}
|
||||
<SignOutButton action={signOutAction} />
|
||||
</nav>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
Reference in New Issue
Block a user