diff options
| author | Miqdad <ahmadmiqdad27@gmail.com> | 2025-11-12 16:12:21 +0700 |
|---|---|---|
| committer | Miqdad <ahmadmiqdad27@gmail.com> | 2025-11-12 16:12:21 +0700 |
| commit | cd51b64b48b0c898c6ff901c1bfa23c70cd9cf1a (patch) | |
| tree | 2ce0178f645fb77d5f17238460efa9c6b62d8a90 /src-migrate | |
| parent | 9cbbe5e12f97af023e2f53e4add4c5e5fd9b4667 (diff) | |
<MIqdad> sementara
Diffstat (limited to 'src-migrate')
| -rw-r--r-- | src-migrate/modules/product-detail/components/AddToCart.tsx | 9 | ||||
| -rw-r--r-- | src-migrate/modules/product-detail/components/PriceAction.tsx | 1 | ||||
| -rw-r--r-- | src-migrate/pages/shop/product/[slug].tsx | 2 |
3 files changed, 10 insertions, 2 deletions
diff --git a/src-migrate/modules/product-detail/components/AddToCart.tsx b/src-migrate/modules/product-detail/components/AddToCart.tsx index 147fd6d2..0dc39c1c 100644 --- a/src-migrate/modules/product-detail/components/AddToCart.tsx +++ b/src-migrate/modules/product-detail/components/AddToCart.tsx @@ -66,6 +66,8 @@ const AddToCart = ({ weight: '', isFlashSale: false, }); + const hasPrice = + !!product?.lowest_price && Number(product.lowest_price.price) > 0; useEffect(() => { const fetchData = async () => { @@ -183,6 +185,7 @@ const AddToCart = ({ colorScheme={btnConfig[source].colorScheme} variant={btnConfig[source].variant} className='w-full' + isDisabled={!hasPrice || status === 'loading'} > {btnConfig[source].text} </Button> @@ -194,6 +197,7 @@ const AddToCart = ({ colorScheme={btnConfig[source].colorScheme} variant={btnConfig[source].variant} className='w-full' + isDisabled={!hasPrice || status === 'loading'} > {btnConfig[source].text} </Button> @@ -208,7 +212,10 @@ const AddToCart = ({ {/* ===== MOBILE LAYOUT: konten scroll + footer fixed di dalam popup ===== */} <div className='md:hidden flex flex-col max-h-[75vh]'> {/* area scroll */} - <div className='flex-1 overflow-y-auto' style={{ scrollbarWidth: 'none' }}> + <div + className='flex-1 overflow-y-auto' + style={{ scrollbarWidth: 'none' }} + > {/* HEADER ITEM */} <div className='flex mt-4'> <div className='w-[25%]'> diff --git a/src-migrate/modules/product-detail/components/PriceAction.tsx b/src-migrate/modules/product-detail/components/PriceAction.tsx index ffc9ba40..a329d2cc 100644 --- a/src-migrate/modules/product-detail/components/PriceAction.tsx +++ b/src-migrate/modules/product-detail/components/PriceAction.tsx @@ -37,6 +37,7 @@ const PriceAction = ({ product }: Props) => { } = useProductDetail(); const [qtyPickUp, setQtyPickUp] = useState(0); const { isDesktop, isMobile } = useDevice(); + useEffect(() => { setActive(selectedVariant); if (product.variants.length > 2 && product.variants[0].price.price === 0) { diff --git a/src-migrate/pages/shop/product/[slug].tsx b/src-migrate/pages/shop/product/[slug].tsx index 058e4832..8d6558b1 100644 --- a/src-migrate/pages/shop/product/[slug].tsx +++ b/src-migrate/pages/shop/product/[slug].tsx @@ -49,7 +49,7 @@ export const getServerSideProps: GetServerSideProps<PageProps> = async ( Array.isArray(product.variants) && product.variants.some((v) => (v?.price?.price ?? 0) > 0); - if (!hasValidVariant) return { notFound: true }; + // if (!hasValidVariant) return { notFound: true }; // bikin canonical path yang BERSIH dan KONSISTEN dari data produk, // bukan dari URL request user (jadi gak ikut ?utm_source, ?ref=, dsb) |
