From 9131adc9635203dcb914e9874effb142247ba2a6 Mon Sep 17 00:00:00 2001 From: hamid zarghami Date: Mon, 27 Oct 2025 14:40:52 +0330 Subject: [PATCH] fix design bug product card --- src/app/product/components/AddComment.tsx | 4 ++-- src/components/ProductCard.tsx | 28 ++++++++++++----------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/app/product/components/AddComment.tsx b/src/app/product/components/AddComment.tsx index 989bace..6e4d642 100644 --- a/src/app/product/components/AddComment.tsx +++ b/src/app/product/components/AddComment.tsx @@ -32,7 +32,7 @@ const AddComment: FC = (props) => { const [disadvantages, setDisadvantages] = useState([]) const [currentAdvantage, setCurrentAdvantage] = useState('') const [currentDisadvantage, setCurrentDisadvantage] = useState('') - const [rating, setRating] = useState(0) + const [rating, setRating] = useState(5) const { mutate: addComment, isPending } = useAddComment() const validationSchema = yup.object({ @@ -56,7 +56,7 @@ const AddComment: FC = (props) => { advantage: [], disAdvantage: [], content: '', - rate: 0, + rate: 5, productId: productId } }) diff --git a/src/components/ProductCard.tsx b/src/components/ProductCard.tsx index 2c119cd..ee967be 100644 --- a/src/components/ProductCard.tsx +++ b/src/components/ProductCard.tsx @@ -40,7 +40,7 @@ const ProductCard: FC = ({ item }) => { if (item) return ( -
+
= ({ item }) => { {item.title_fa} -
+
{item?.default_variant?.price?.selling_price && item.default_variant.price.selling_price > 0 ? `${NumberFormat(item.default_variant.price.selling_price)} تومان` - : 'بدون قیمت' + : '۰ تومان' }
{((item?.default_variant?.price?.discount_percent > 0 && item.default_variant.price.selling_price > 0) || @@ -69,15 +69,17 @@ const ProductCard: FC = ({ item }) => {
)}
- {((item?.default_variant?.price?.discount_percent > 0 && item.default_variant.price.selling_price > 0) || - (item?.default_variant?.price?.is_specialSale && item.default_variant.price.selling_price > 0)) && ( -
- {item.default_variant.price.discount_percent > 0 - ? `${item.default_variant.price.discount_percent}%` - : 'فروش ویژه' - } -
- )} +
+ {((item?.default_variant?.price?.discount_percent > 0 && item.default_variant.price.selling_price > 0) || + (item?.default_variant?.price?.is_specialSale && item.default_variant.price.selling_price > 0)) && ( +
+ {item.default_variant.price.discount_percent > 0 + ? `${item.default_variant.price.discount_percent}%` + : 'فروش ویژه' + } +
+ )} +
@@ -87,7 +89,7 @@ const ProductCard: FC = ({ item }) => { ) return (
-
+