build fix
This commit is contained in:
@ -13,7 +13,7 @@ interface TopSalesItemProps {
|
|||||||
productId?: string;
|
productId?: string;
|
||||||
onAddToCart?: (e: React.MouseEvent) => void;
|
onAddToCart?: (e: React.MouseEvent) => void;
|
||||||
discount?: string; // Новый пропс для лейбла/скидки
|
discount?: string; // Новый пропс для лейбла/скидки
|
||||||
// isInCart?: boolean; // Удаляем из пропсов
|
isInCart?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const TopSalesItem: React.FC<TopSalesItemProps> = ({
|
const TopSalesItem: React.FC<TopSalesItemProps> = ({
|
||||||
|
@ -23,7 +23,7 @@ const SCROLL_AMOUNT = 340; // px, ширина одной карточки + о
|
|||||||
|
|
||||||
const TopSalesSection: React.FC = () => {
|
const TopSalesSection: React.FC = () => {
|
||||||
const { data, loading, error } = useQuery(GET_TOP_SALES_PRODUCTS);
|
const { data, loading, error } = useQuery(GET_TOP_SALES_PRODUCTS);
|
||||||
const { cartItems = [] } = useCart();
|
const { isInCart: isItemInCart } = useCart();
|
||||||
const scrollRef = useRef<HTMLDivElement>(null);
|
const scrollRef = useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
const scrollLeft = () => {
|
const scrollLeft = () => {
|
||||||
@ -214,7 +214,7 @@ const TopSalesSection: React.FC = () => {
|
|||||||
|
|
||||||
const title = product.name;
|
const title = product.name;
|
||||||
const brand = product.brand || 'Неизвестный бренд';
|
const brand = product.brand || 'Неизвестный бренд';
|
||||||
const isInCart = cartItems.some(cartItem => cartItem.productId === product.id);
|
const isInCart = isItemInCart(product.id, undefined, product.article, brand);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TopSalesItem
|
<TopSalesItem
|
||||||
|
Reference in New Issue
Block a user