"use client"; import Image from "next/image"; import PersianNumber from "plugins/PersianNumber"; import React, { useContext, useState } from "react"; import p1 from "../../../public/images/product/1.png"; import AppContext from "@ctx/AppContext"; import Link from "next/link"; const CardCategoriesMobile = ({ data }) => { const CTX = useContext(AppContext); const cart = CTX.state.cart; console.log("data ", data, cart); return (

{data?.persianName}

{data?.hasDiscount && (

{" "} 3 عدد موجود انبار

)}
{/*{cart.find(e=>id)}*/} {!cart.find((item) => item.id === data.id) ? (
CTX.AddItemToCart(data.id, data.persianName, data.cost) } >
) : (
CTX.AddItemToCart(data.id, data.persianName, data.cost) } >

+

item.id === data.id).count} />

CTX.RemoveItemFromCart(data.id)} >

-

)}
{data?.hasDiscount ? (

{" "}

تومان
) : (
{" "}

تومان
)}
); }; export default CardCategoriesMobile;