summaryrefslogtreecommitdiff
path: root/src/lib/product
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/product')
-rw-r--r--src/lib/product/components/Product/ProductDesktopVariant.jsx18
-rw-r--r--src/lib/product/components/Product/ProductMobileVariant.jsx18
2 files changed, 18 insertions, 18 deletions
diff --git a/src/lib/product/components/Product/ProductDesktopVariant.jsx b/src/lib/product/components/Product/ProductDesktopVariant.jsx
index 51739bc9..ef61bafd 100644
--- a/src/lib/product/components/Product/ProductDesktopVariant.jsx
+++ b/src/lib/product/components/Product/ProductDesktopVariant.jsx
@@ -140,7 +140,7 @@ const ProductDesktopVariant = ({ product, wishlist, toggleWishlist, isVariant })
<div className='w-full flex flex-wrap'>
<div className='w-5/12'>
<Image
- src={product.parent.image}
+ src={product.image}
alt={product.name}
className='h-[430px] object-contain object-center w-full border border-gray_r-4'
/>
@@ -270,32 +270,32 @@ const ProductDesktopVariant = ({ product, wishlist, toggleWishlist, isVariant })
</div> */}
</div>
<div className='w-[25%]'>
- {product?.flashSale?.remainingTime > 0 ? (
+ {product?.isFlashsale > 0 && product?.price?.discountPercentage > 0? (
<>
<div className='flex gap-x-1 items-center mt-2'>
<div className='badge-solid-red text-caption-1'>
- {lowestPrice?.discountPercentage}%
+ {product?.price?.discountPercentage}%
</div>
<div className='text-gray_r-9 line-through text-caption-1'>
- {currencyFormat(lowestPrice?.price)}
+ {currencyFormat(product?.price?.price)}
</div>
<div className='text-danger-500 font-semibold text-xl'>
- {currencyFormat(lowestPrice?.priceDiscount)}
+ {currencyFormat(product?.price?.priceDiscount)}
</div>
</div>
<div className='text-gray_r-9 text-base font-normal mt-1'>
Termasuk PPN:{' '}
- {currencyFormat(lowestPrice?.priceDiscount * process.env.NEXT_PUBLIC_PPN)}
+ {currencyFormat(product?.price?.priceDiscount * process.env.NEXT_PUBLIC_PPN)}
</div>
</>
) : (
<h3 className='text-danger-500 font-semibold mt-1 text-title-md'>
- {lowestPrice?.price > 0 ? (
+ {product?.price?.price > 0 ? (
<>
- {currencyFormat(lowestPrice?.price)}
+ {currencyFormat(product?.price?.price)}
<div className='text-gray_r-9 text-base font-normal mt-1'>
Termasuk PPN:{' '}
- {currencyFormat(lowestPrice?.price * process.env.NEXT_PUBLIC_PPN)}
+ {currencyFormat(product?.price?.price * process.env.NEXT_PUBLIC_PPN)}
</div>
</>
) : (
diff --git a/src/lib/product/components/Product/ProductMobileVariant.jsx b/src/lib/product/components/Product/ProductMobileVariant.jsx
index 8cdb631f..9888e482 100644
--- a/src/lib/product/components/Product/ProductMobileVariant.jsx
+++ b/src/lib/product/components/Product/ProductMobileVariant.jsx
@@ -29,7 +29,7 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => {
const [isLoadingSLA, setIsLoadingSLA] = useState(true)
const getLowestPrice = () => {
- const lowest = product.price
+ const lowest = product.lowestPrice
return lowest
}
@@ -40,7 +40,7 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => {
price: getLowestPrice(),
stock: product.stockTotal,
weight: product.weight,
- isFlashSale: product.isFlashsale
+ isFlashSale: product.isFlashSale
})
useEffect(() => {
@@ -50,9 +50,9 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => {
code: product.code,
name: product.name,
price: product.price,
- stock: product.stock,
+ stock: product.stockTotal,
weight: product.weight,
- isFlashSale: product.isFlashsale
+ isFlashSale: product.isFlashSale
})
}
}, [selectedVariant, product])
@@ -115,7 +115,7 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => {
return (
<MobileView>
<Image
- src={product.parent.image}
+ src={product.image}
alt={product.name}
className='h-72 object-contain object-center w-full border-b border-gray_r-4'
/>
@@ -141,7 +141,7 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => {
</div>
<h1 className='leading-6 font-medium mb-3'>{activeVariant?.name}</h1>
- {activeVariant.isFlashsale ? (
+ {activeVariant.isFlashSale && activeVariant?.price?.discountPercentage > 0 ? (
<>
<div className='flex gap-x-1 items-center'>
<div className='badge-solid-red'>{activeVariant?.price?.discountPercentage}%</div>
@@ -159,12 +159,12 @@ const ProductMobileVariant = ({ product, wishlist, toggleWishlist }) => {
</>
) : (
<h3 className='text-danger-500 font-semibold mt-1'>
- {activeVariant?.price?.priceDiscount > 0 ? (
+ {activeVariant?.price?.price > 0 ? (
<>
- {currencyFormat(activeVariant?.price?.priceDiscount)}
+ {currencyFormat(activeVariant?.price?.price)}
<div className='text-gray_r-9 text-base font-normal mt-1'>
Termasuk PPN:{' '}
- {currencyFormat(activeVariant?.price.priceDiscount * process.env.NEXT_PUBLIC_PPN)}
+ {currencyFormat(activeVariant?.price.price * process.env.NEXT_PUBLIC_PPN)}
</div>
</>
) : (