"use client"; import { useState } from "react"; import Link from "next/link"; import { usePathname, useRouter } from "next/navigation"; import { Home, Compass, Plus, Bell, User, ChevronDown, } from "lucide-react"; import { PostTypeSheet } from "@/components/post-creation/PostTypeSheet"; 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 MobileNavProps = { pets: Pet[]; }; /** * Mobile bottom tab bar — visible below lg: breakpoint. * * UI-SPEC: Navigation (App Shell) — Mobile * - Fixed bottom bar (h-16) with bg-card border-top * - 5 tabs: Home, Explore (placeholder), Post (center, orange-500), Notifications (placeholder), Profile * - Top active pet switcher dropdown above the tab bar * * Explore and Notifications are placeholder tabs (aria-disabled) in Phase 1. * Post tab (center) links to /pets in Phase 1 — full post creation in Phase 2. * * Deviation notes: * - shadcn base-nova uses @base-ui/react/menu which does not support asChild on * DropdownMenuTrigger or DropdownMenuItem. Using onClick+useRouter for navigation items. */ export function MobileNav({ pets }: MobileNavProps) { 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); // D-05: Home → /feed; also highlight when on / (which redirects to /feed) const isHomePage = pathname === "/feed" || pathname === "/"; const isPetsPage = pathname.startsWith("/pets"); return (
{/* Active pet switcher bar — shown above tab bar on mobile */} {activePet && (
{activePet.avatarKey && ( )} {activePet.name.slice(0, 2).toUpperCase()} {activePet.name} {pets.map((pet) => ( setActivePet(pet.id)} className="flex items-center gap-2 cursor-pointer" > {pet.avatarKey && ( )} {pet.name.slice(0, 2).toUpperCase()} {pet.name} {pet.species.name} {pet.id === activePetId && ( )} ))} router.push("/onboarding/pet")} className="flex items-center gap-2 cursor-pointer" > + Add Pet
)} {/* Bottom tab bar */} {/* PostTypeSheet — D-01: bottom Sheet with Photo/Story/Milestone choices */}
); }