"use client" import type React from "react" import Link from "next/link" import { User, Truck, Heart, ShoppingCart } from "lucide-react" import { Button } from "@/components/ui/button" import { Badge } from "@/components/ui/badge" import { useCart, useFavorites, useOrders } from "@/lib/hooks" import { Skeleton } from "@/components/ui/skeleton" interface ActionButtonsProps { isAuthenticated: boolean onAuthClick: () => void translations: { profile: string login: string orders: string favorites: string cart: string } } interface ActionButtonData { icon: React.ReactNode label: string href?: string onClick?: () => void badgeCount?: number isLoading?: boolean } export default function ActionButtons({ isAuthenticated, onAuthClick, translations: t }: ActionButtonsProps) { const { data: cartData, isLoading: cartLoading } = useCart() const { data: favoritesData, isLoading: favoritesLoading } = useFavorites() const { data: ordersData, isLoading: ordersLoading } = useOrders() const buttons: ActionButtonData[] = [ { icon: , label: isAuthenticated ? t.profile : t.login, onClick: onAuthClick, }, { icon: , label: t.orders, href: "/orders", badgeCount: ordersData?.length || 0, isLoading: ordersLoading, }, { icon: , label: t.favorites, href: "/favorites", badgeCount: favoritesData?.length || 0, isLoading: favoritesLoading, }, { icon: , label: t.cart, href: "/cart", badgeCount: cartData?.count || 0, isLoading: cartLoading, }, ] return (
{buttons.map((button, index) => ( ))}
) } function ActionButton({ icon, label, href, onClick, badgeCount, isLoading }: ActionButtonData) { const buttonContent = ( ) if (href) { return {buttonContent} } return buttonContent }