"use client";
/**
* ProfileSidebar — the navigation rail for /u/me.
*
* • Desktop (md+): permanent left column, ~240px wide, sticky below the
* SiteHeader so it stays in view while content scrolls.
* • Mobile: a hamburger button reveals the same nav as a left drawer.
*
* Items are intentionally just three (Profile / Collections / Bookmarks) to
* keep the surface focused; "Log out" sits as a footer action separated by
* a divider.
*/
import { useState } from "react";
import Link from "next/link";
import { usePathname, useRouter } from "next/navigation";
import { User as UserIcon, FolderOpen, Bookmark, LogOut, Menu } from "lucide-react";
import { UserAvatar } from "@/components/ui/user-avatar";
import {
Drawer,
DrawerContent,
DrawerDescription,
DrawerHeader,
DrawerTitle,
DrawerTrigger,
} from "@/components/ui/drawer";
import { useAuth } from "@/components/auth/auth-provider";
import type { User } from "@/lib/auth";
import { cn } from "@/lib/utils";
type NavItem = {
href: string;
label: string;
icon: typeof UserIcon;
/** Match only when pathname === href; otherwise startsWith is used. */
exact?: boolean;
};
const ITEMS: NavItem[] = [
{ href: "/u/me", label: "Profile", icon: UserIcon, exact: true },
{ href: "/u/me/collections", label: "Collections", icon: FolderOpen },
{ href: "/u/me/bookmarks", label: "Bookmarks", icon: Bookmark },
];
export function ProfileSidebar({ user }: { user: User }) {
return (
<>
{/* Desktop rail — always visible on md+ */}
{/* Mobile trigger + drawer */}
{user.name}
@{user.handle}