diff --git a/app/components/cart/CartItem.tsx b/app/components/cart/CartItem.tsx index ea5273d..44f66be 100644 --- a/app/components/cart/CartItem.tsx +++ b/app/components/cart/CartItem.tsx @@ -1,4 +1,4 @@ -import { Check, Trash } from "lucide-react"; +import { Trash } from "lucide-react"; import { memo, useMemo } from "react"; import { QuantityControl } from "./QuantityControl"; import { formatPrice } from "../../utils/helpers"; @@ -34,145 +34,113 @@ export const CartItem = memo(function CartItem({ ); }, [item.productVariant?.discountPrice, item.productVariant?.price]); - // Memoize video check const isVideoMedia = useMemo( () => isVideo(item.productVariant?.productImage || ""), [item.productVariant?.productImage] ); + + const color = + item.productVariant?.color?.value !== "UNSELECTED" + ? item.productVariant?.color?.info?.detail || "" + : ""; + const size = + item.productVariant?.size?.value !== "UNSELECTED" + ? item.productVariant?.size?.info?.detail || "" + : ""; + + const effectivePrice = + item.productVariant?.discountPrice || item.productVariant?.price || ""; + const inStock = + !!item?.productVariant?.stock && item.productVariant.stock > 0; + return ( -
- {item.productVariant?.productTitle || ""} -
-- کد کالا: {item.productVariant?.id || ""} -
-قیمت واحد :
-- {formatPrice(item.productVariant?.price || "")} تومان -
-مقدار تخفیف :
-- {formatPrice( - ( - Number(item.productVariant?.price) - - Number(item.productVariant?.discountPrice) - ).toString() - )}{" "} - تومان -
-محصول در حال حاضر موجود نیست
- -+ در حال حاضر موجود نیست +
+ +رنگ :
-سایز :
-{size}
-{cart.seller?.name}
+ + ارسال جداگانه +{cart.items