"use client" import { useState } from "react" import Link from "next/link" import { useCategories } from "@/lib/hooks" import { Skeleton } from "@/components/ui/skeleton" interface CategoryMenuProps { isOpen: boolean onClose: () => void } export default function CategoryMenu({ isOpen, onClose }: CategoryMenuProps) { const [hoveredCategory, setHoveredCategory] = useState(null) const { data: categories, isLoading } = useCategories() if (!isOpen) return null const categoryList = categories || [] const activeCategory = hoveredCategory !== null ? categoryList[hoveredCategory] : null return (
{activeCategory?.children && }
) } interface CategoryListProps { categories: any[] isLoading: boolean onCategoryHover: (index: number) => void onCategoryClick: () => void } function CategoryList({ categories, isLoading, onCategoryHover, onCategoryClick }: CategoryListProps) { return (
{isLoading ? [1, 2, 3, 4, 5].map((i) => ) : categories.map((category, index) => ( onCategoryHover(index)} className="flex items-center gap-3 px-4 py-3 rounded-xl hover:bg-gray-100 hover:text-primary transition-colors" > {category.icon_class && } {category.name} ))}
) } interface SubcategoryListProps { category: any onSubcategoryClick: () => void } function SubcategoryList({ category, onSubcategoryClick }: SubcategoryListProps) { return (

{category.name}

{category.children?.map((subCategory: any) => ( {subCategory.name} ))}
) }