import { Disclosure, DisclosureButton, DisclosurePanel } from '@headlessui/react'; import { Link, useLocation } from 'react-router'; import NavLinks from './NavLinks'; import UserMenu from './UserMenu'; interface NavbarProps { auth: { username: string; accessToken: string; refreshToken: string; userAccountId: string; } | null; } const Navbar = ({ auth }: NavbarProps) => { const { pathname } = useLocation(); const onAuthRoute = pathname === '/login' || pathname === '/register'; const showAuthActions = !auth && !onAuthRoute; return ( {({ open }) => ( <>
{open ? ( ) : ( )} The Biergarten App
{showAuthActions && ( Register User )} {auth ? ( <> Dashboard ) : ( !onAuthRoute && ( Login ) )}
)}
); }; export default Navbar;