diff options
Diffstat (limited to 'src/lib/product')
| -rw-r--r-- | src/lib/product/components/Product/ProductDesktop.jsx | 46 |
1 files changed, 17 insertions, 29 deletions
diff --git a/src/lib/product/components/Product/ProductDesktop.jsx b/src/lib/product/components/Product/ProductDesktop.jsx index 0866bffa..c7554242 100644 --- a/src/lib/product/components/Product/ProductDesktop.jsx +++ b/src/lib/product/components/Product/ProductDesktop.jsx @@ -8,7 +8,6 @@ import LazyLoad from 'react-lazy-load' import ProductSimilar from '../ProductSimilar' import { toast } from 'react-hot-toast' import { updateItemCart } from '@/core/utils/cart' -import useVariantPrice from '@/lib/variant/hooks/useVariantPrice' import useProductPrice from '../../hooks/useProductPrice' import PriceSkeleton from '@/core/components/elements/Skeleton/PriceSkeleton' import { useRouter } from 'next/router' @@ -193,7 +192,23 @@ const ProductDesktop = ({ product, wishlist, toggleWishlist }) => { <td>{variant.code}</td> <td>{variant.attributes.join(', ') || '-'}</td> <td> - <VariantPrice id={variant.id} /> + {variant.price.discountPercentage > 0 && variant.price.priceDiscount > 0 && ( + <> + <div className='line-through text-caption-1 text-gray_r-11 mb-1'> + {currencyFormat(variant.price.price)} + </div>{' '} + </> + )} + <div> + {variant.price.priceDiscount > 0 ? ( + currencyFormat(variant.price.priceDiscount) + ) : ( + <a href='https://wa.me/' className='text-red_r-11'> + Call for price + </a> + )} + </div> + {/* <VariantPrice id={variant.id} /> */} </td> <td> <input @@ -269,33 +284,6 @@ const ProductDesktop = ({ product, wishlist, toggleWishlist }) => { ) } -const VariantPrice = ({ id }) => { - const { variantPrice } = useVariantPrice({ id }) - - if (variantPrice.isLoading) return <PriceSkeleton /> - - return ( - <> - {variantPrice?.data?.discount > 0 && variantPrice?.data?.priceExcludeAfterDiscount > 0 && ( - <> - <div className='line-through text-caption-1 text-gray_r-11 mb-1'> - {currencyFormat(variantPrice?.data?.priceExclude)} - </div>{' '} - </> - )} - <div> - {variantPrice?.data?.priceExcludeAfterDiscount > 0 ? ( - currencyFormat(variantPrice?.data?.priceExcludeAfterDiscount) - ) : ( - <a href='https://wa.me/' className='text-red_r-11'> - Call for price - </a> - )} - </div> - </> - ) -} - const informationTabOptions = [ { value: 'description', label: 'Deskripsi' }, { value: 'information', label: 'Info Penting' } |
