feat: show Friends nav link only when logged in
This commit is contained in:
@@ -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 ? (
|
||||||
|
|||||||
@@ -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>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user