From f4facf146c448ebaf912a439ed795f3b422adf50 Mon Sep 17 00:00:00 2001 From: 54CHA Date: Wed, 30 Jul 2025 15:27:32 +0300 Subject: [PATCH] build fix --- src/components/TopSalesItem.tsx | 2 +- src/components/index/TopSalesSection.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/TopSalesItem.tsx b/src/components/TopSalesItem.tsx index dcce271..4d5996f 100644 --- a/src/components/TopSalesItem.tsx +++ b/src/components/TopSalesItem.tsx @@ -13,7 +13,7 @@ interface TopSalesItemProps { productId?: string; onAddToCart?: (e: React.MouseEvent) => void; discount?: string; // Новый пропс для лейбла/скидки - // isInCart?: boolean; // Удаляем из пропсов + isInCart?: boolean; } const TopSalesItem: React.FC = ({ diff --git a/src/components/index/TopSalesSection.tsx b/src/components/index/TopSalesSection.tsx index ecf7dd6..d40892e 100644 --- a/src/components/index/TopSalesSection.tsx +++ b/src/components/index/TopSalesSection.tsx @@ -23,7 +23,7 @@ const SCROLL_AMOUNT = 340; // px, ширина одной карточки + о const TopSalesSection: React.FC = () => { const { data, loading, error } = useQuery(GET_TOP_SALES_PRODUCTS); - const { cartItems = [] } = useCart(); + const { isInCart: isItemInCart } = useCart(); const scrollRef = useRef(null); const scrollLeft = () => { @@ -214,7 +214,7 @@ const TopSalesSection: React.FC = () => { const title = product.name; const brand = product.brand || 'Неизвестный бренд'; - const isInCart = cartItems.some(cartItem => cartItem.productId === product.id); + const isInCart = isItemInCart(product.id, undefined, product.article, brand); return (