"use client"; import { useState } from "react"; import Link from "next/link"; import { usePathname, useRouter } from "next/navigation"; import { Home, Heart, Compass, Search, Bell, MessageCircle, PawPrint, ChevronDown, Plus, Ticket, } from "lucide-react"; import { PostTypeSheet } from "@/components/post-creation/PostTypeSheet"; import { NotificationBell } from "@/components/notifications/NotificationBell"; import { UserButton } from "@clerk/nextjs"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"; import { Badge } from "@/components/ui/badge"; import { useActivePet } from "@/context/ActivePetContext"; import { getAvatarUrl } from "@/lib/avatar-url"; type Pet = { id: string; name: string; avatarKey: string | null; species: { name: string }; }; type SidebarProps = { pets: Pet[]; }; const navLinks = [ { href: "/feed", label: "Home", icon: Home, active: true, special: false }, { href: "/pets", label: "My Pets", icon: Heart, active: true, special: false }, { href: "/explore", label: "Explore", icon: Compass, active: true, special: false }, { href: "/search", label: "Search", icon: Search, active: true, special: false }, { href: "/notifications", label: "Notifications", icon: Bell, active: true, special: true }, { href: "/messages", label: "Messages", icon: MessageCircle, active: true, special: false }, { href: "/invite", label: "Einladen", icon: Ticket, active: true, special: false }, ]; /** * Desktop sidebar — 240px fixed left nav visible at lg: breakpoint. * * UI-SPEC: Navigation (App Shell) — Desktop sidebar * - OnlyPets wordmark + paw icon (orange-500) * - Active pet switcher using useActivePet() context * - Nav links: Home, My Pets (active in Phase 1); Explore/Notifications/Messages (placeholders) * - Bottom: Clerk UserButton * * Security (T-2-03): receives pets already scoped by pets.list (ownership-scoped) — no * cross-owner data is possible because the server layout enforces ownership via ctx.userId. * * Deviation notes: * - shadcn base-nova uses @base-ui/react/menu which does not support asChild on * DropdownMenuTrigger or DropdownMenuItem. Using onClick+useRouter for navigation. * - Clerk 7 UserButton no longer accepts afterSignOutUrl (removed from UserButtonProps). */ export function Sidebar({ pets }: SidebarProps) { const pathname = usePathname(); const router = useRouter(); const { activePetId, setActivePet } = useActivePet(); const activePet = pets.find((p) => p.id === activePetId) ?? pets[0]; const [postTypeSheetOpen, setPostTypeSheetOpen] = useState(false); return ( ); }