'use client' import { cn } from '@thedaviddias/design-system/lib/utils' import { ExternalLink, Home as HomeIcon, Trophy, X } from 'lucide-react' import Link from 'next/link' import { usePathname } from 'next/navigation' import { useEffect } from 'react' import { FavoritesLink } from '@/components/ui/favorites-link' import { categories } from '@/lib/categories' import { getRoute } from '@/lib/routes' import { tools } from '@/lib/tools' interface MobileDrawerProps { isOpen: boolean onClose: () => void featuredCount?: number } /** * Mobile navigation drawer component */ export function MobileDrawer({ isOpen, onClose, featuredCount }: MobileDrawerProps) { const pathname = usePathname() // Close drawer when route changes useEffect(() => { if (isOpen) { onClose() } }, [pathname]) // eslint-disable-line react-hooks/exhaustive-deps // Prevent body scroll when drawer is open useEffect(() => { if (isOpen) { document.body.style.overflow = 'hidden' } else { document.body.style.overflow = '' } return () => { document.body.style.overflow = '' } }, [isOpen]) // Handle escape key useEffect(() => { /** * Handles escape key press */ const handleEscape = (e: KeyboardEvent) => { if (e.key === 'Escape' && isOpen) { onClose() } } document.addEventListener('keydown', handleEscape) return () => document.removeEventListener('keydown', handleEscape) }, [isOpen, onClose]) const isHomePage = pathname === '/' /** * Checks if current page is a category page */ const isCategoryPage = (slug: string) => pathname === `/category/${slug}` return ( <> {/* Backdrop */} {/* Drawer Content */}
{/* Main Navigation */}

Navigation

{/* My Collection Section */}

My Collection

{/* Categories */}

Categories

{/* Tools */}

Tools

) }