This repository has been archived on 2026-08-10. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files

48 lines
1.1 KiB
TypeScript

'use client';
import Link from 'next/link';
import { useEffect, useState } from 'react';
export default function Navbar() {
const [isLoggedIn, setIsLoggedIn] = useState(false);
useEffect(() => {
const hasAuthCookie = document.cookie
.split('; ')
.some((c) => c.startsWith('onlypets-auth=true'));
setIsLoggedIn(hasAuthCookie);
}, []);
return (
<nav
style={{
display: 'flex',
gap: '1.5rem',
padding: '1rem',
borderBottom: '1px solid #eee',
}}
>
{/* 🌱 GAST-NAVIGATION */}
{!isLoggedIn && (
<>
<Link href="/">Home</Link>
<Link href="/login">Login</Link>
<Link href="/register">Registrierung</Link>
</>
)}
{/* 🐾 USER-NAVIGATION */}
{isLoggedIn && (
<>
<Link href="/feed">Feed</Link>
<Link href="/explore">Entdecken</Link>
<Link href="/pets">Meine Tiere</Link>
<Link href="/post/new">Posten</Link>
<Link href="/profile">Profil</Link>
</>
)}
</nav>
);
}