diff --git a/app/(auth)/error.tsx b/app/(auth)/error.tsx index b1ced88..629541d 100644 --- a/app/(auth)/error.tsx +++ b/app/(auth)/error.tsx @@ -3,10 +3,10 @@ export default function AuthError({ error, reset, -}: { +}: Readonly<{ error: Error & { digest?: string }; reset: () => void; -}) { +}>) { return (
diff --git a/app/(auth)/layout.tsx b/app/(auth)/layout.tsx index d68d66c..e51beba 100644 --- a/app/(auth)/layout.tsx +++ b/app/(auth)/layout.tsx @@ -4,9 +4,9 @@ import { getSignedAvatarUrl } from "@/utils/assets/avatars"; export default async function AuthLayout({ children, -}: { +}: Readonly<{ children: React.ReactNode; -}) { +}>) { const supabase = await createClient(); const { data: { user }, @@ -37,7 +37,8 @@ export default async function AuthLayout({ email={user?.email ?? ""} avatarUrl={avatarURL} /> -
{children}
+ {/* Mobile: top padding for hamburger button */} +
{children}
); } diff --git a/app/(auth)/sidebar.tsx b/app/(auth)/sidebar.tsx index 1f92b1a..1c66627 100644 --- a/app/(auth)/sidebar.tsx +++ b/app/(auth)/sidebar.tsx @@ -1,165 +1,316 @@ "use client"; +import { cn } from "@/lib/utils"; +import { ScrollArea } from "@/components/ui/scroll-area"; +import { motion, AnimatePresence } from "framer-motion"; +import { + ChevronsUpDown, + LogOut, + MessagesSquare, + UserCircle, + UserPlus, + X, + Menu, +} from "lucide-react"; +import Image from "next/image"; import Link from "next/link"; import { usePathname } from "next/navigation"; +import { useState, useCallback } from "react"; +import { Button } from "@/components/ui/button"; +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuSeparator, + DropdownMenuTrigger, +} from "@/components/ui/dropdown-menu"; +import { Separator } from "@/components/ui/separator"; import { signOut } from "@/utils/profile/profile"; -import Image from "next/image"; + +const variants = { + open: { + x: 0, + opacity: 1, + transition: { x: { stiffness: 1000, velocity: -100 } }, + }, + closed: { + x: -20, + opacity: 0, + transition: { x: { stiffness: 100 } }, + }, +}; + +const staggerVariants = { + open: { + transition: { staggerChildren: 0.03, delayChildren: 0.02 }, + }, +}; const navItems = [ { label: "Rooms", href: "/rooms", - icon: ( - - - - ), + icon: MessagesSquare, }, { label: "Friends", href: "/friends", - icon: ( - - - - ), + icon: UserPlus, }, { label: "Profile", href: "/profile", - icon: ( - - - - ), + icon: UserCircle, }, ]; +function SidebarContent({ + isCollapsed, + displayName, + email, + avatarUrl, + onNavigate, +}: { + isCollapsed: boolean; + displayName: string; + email: string; + avatarUrl: string; + onNavigate?: () => void; +}) { + const pathname = usePathname(); + + return ( +
+ {/* Header / brand */} +
+ +
+ + {/* Navigation */} +
+
+ + + {navItems.map((item) => { + const active = pathname === item.href; + const Icon = item.icon; + return ( + + + + {!isCollapsed && ( +

{item.label}

+ )} +
+ + ); + })} +
+
+
+ + {/* User section */} +
+ + + +
+
+ {avatarUrl ? ( + + ) : ( +
+ {displayName.charAt(0).toUpperCase()} +
+ )} +
+ + {!isCollapsed && ( + <> +

+ {displayName} +

+ + + )} +
+
+
+ +
+
+ {avatarUrl ? ( + + ) : ( +
+ {displayName.charAt(0).toUpperCase()} +
+ )} +
+
+ {displayName} + + {email} + +
+
+ + + + Profile + + + e.preventDefault()} + > +
+ +
+
+
+
+
+
+
+ ); +} + export function Sidebar({ displayName, email, avatarUrl, -}: { +}: Readonly<{ displayName: string; email: string; avatarUrl: string; -}) { - const pathname = usePathname(); +}>) { + const [mobileOpen, setMobileOpen] = useState(false); + + const closeMobile = useCallback(() => setMobileOpen(false), []); + return ( - + ); }