"use client"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { useEffect, useState } from "react"; import { signIn, signOut, useSession } from "next-auth/react"; export default function NavBar() { const { data } = useSession(); const pathname = usePathname(); const isAdmin = data?.user?.role === "ADMIN" || data?.user?.role === "SUPERADMIN"; const isSuperAdmin = data?.user?.role === "SUPERADMIN"; const [logoUrl, setLogoUrl] = useState(null); const linkClass = (href: string) => pathname === href ? "rounded-full bg-slate-900 px-3 py-1 text-white" : "rounded-full px-3 py-1 text-slate-700 hover:bg-slate-100"; useEffect(() => { const loadLogo = async () => { try { const response = await fetch("/api/branding/logo", { method: "HEAD", cache: "no-store" }); if (response.ok) { setLogoUrl(`/api/branding/logo?ts=${Date.now()}`); } else { setLogoUrl(null); } } catch { setLogoUrl(null); } }; loadLogo(); }, []); return (
{logoUrl && ( Vereinskalender Logo setLogoUrl(null)} /> )} Vereinskalender
); }