feat: show Friends nav link only when logged in

This commit is contained in:
2026-05-28 22:47:53 +02:00
parent a73e7deeff
commit 2ffdd5e269
2 changed files with 17 additions and 2 deletions

View File

@@ -27,7 +27,7 @@ export function Header() {
</span> </span>
</Link> </Link>
<MainNav /> <MainNav isLoggedIn={!!token} />
<div className="flex flex-1 items-center justify-end space-x-2"> <div className="flex flex-1 items-center justify-end space-x-2">
{token ? ( {token ? (

View File

@@ -5,7 +5,11 @@ import { usePathname } from "next/navigation";
import { cn } from "@/lib/utils"; import { cn } from "@/lib/utils";
import { SearchInput } from "./search-input"; import { SearchInput } from "./search-input";
export function MainNav() { interface MainNavProps {
isLoggedIn?: boolean;
}
export function MainNav({ isLoggedIn }: MainNavProps) {
const pathname = usePathname(); const pathname = usePathname();
return ( return (
<nav className="inline-flex md:flex items-center space-x-6 text-sm font-medium"> <nav className="inline-flex md:flex items-center space-x-6 text-sm font-medium">
@@ -27,6 +31,17 @@ export function MainNav() {
> >
Fediverse Fediverse
</Link> </Link>
{isLoggedIn && (
<Link
href="/friends"
className={cn(
"transition-colors hover:text-foreground/80",
pathname === "/friends" ? "text-foreground" : "text-foreground/60"
)}
>
Friends
</Link>
)}
<SearchInput /> <SearchInput />
</nav> </nav>
); );