From 7cf105a01a814c5f76dd6b407df284a44026cabf Mon Sep 17 00:00:00 2001 From: Miqdad Date: Wed, 12 Nov 2025 17:14:37 +0700 Subject: done product detail --- .../product-detail/components/ProductDetail.tsx | 67 +++++++++++++++------- 1 file changed, 45 insertions(+), 22 deletions(-) (limited to 'src-migrate/modules/product-detail/components/ProductDetail.tsx') diff --git a/src-migrate/modules/product-detail/components/ProductDetail.tsx b/src-migrate/modules/product-detail/components/ProductDetail.tsx index f32bb38e..c8c03300 100644 --- a/src-migrate/modules/product-detail/components/ProductDetail.tsx +++ b/src-migrate/modules/product-detail/components/ProductDetail.tsx @@ -5,7 +5,12 @@ import { useRouter } from 'next/router'; import { useEffect, useRef, useState, UIEvent } from 'react'; import { Button } from '@chakra-ui/react'; -import { MessageCircleIcon, Share2Icon } from 'lucide-react'; +import { + AlertCircle, + AlertTriangle, + MessageCircleIcon, + Share2Icon, +} from 'lucide-react'; import { LazyLoadComponent } from 'react-lazy-load-image-component'; import useDevice from '@/core/hooks/useDevice'; @@ -23,7 +28,6 @@ import SimilarBottom from './SimilarBottom'; import SimilarSide from './SimilarSide'; import dynamic from 'next/dynamic'; - import { gtagProductDetail } from '@/core/utils/googleTag'; type Props = { @@ -31,7 +35,7 @@ type Props = { }; const RWebShare = dynamic( - () => import('react-web-share').then(m => m.RWebShare), + () => import('react-web-share').then((m) => m.RWebShare), { ssr: false } ); @@ -42,7 +46,9 @@ const ProductDetail = ({ product }: Props) => { const router = useRouter(); const [auth, setAuth] = useState(null); useEffect(() => { - try { setAuth(getAuth() ?? null); } catch { } + try { + setAuth(getAuth() ?? null); + } catch {} }, []); const canShare = @@ -87,7 +93,6 @@ const ProductDetail = ({ product }: Props) => { setSelectedVariant(selectedVariant); }, []); - const allImages = (() => { const arr: string[] = []; if (product?.image) arr.push(product.image); @@ -95,7 +100,6 @@ const ProductDetail = ({ product }: Props) => { Array.isArray(product?.image_carousel) && product.image_carousel.length ) { - const set = new Set(arr); for (const img of product.image_carousel) { if (!set.has(img)) { @@ -108,15 +112,14 @@ const ProductDetail = ({ product }: Props) => { })(); const [mainImage, setMainImage] = useState(allImages[0] || ''); + const hasPrice = Number(product?.lowest_price?.price) > 0; useEffect(() => { - if (!allImages.includes(mainImage)) { setMainImage(allImages[0] || ''); } }, [allImages]); - const sliderRef = useRef(null); const [currentIdx, setCurrentIdx] = useState(0); @@ -138,7 +141,6 @@ const ProductDetail = ({ product }: Props) => { setMainImage(allImages[i] || ''); }; - return ( <>
@@ -165,7 +167,6 @@ const ProductDetail = ({ product }: Props) => { > {allImages.length > 0 ? ( allImages.map((img, i) => ( -
{ | - +
+ +
| @@ -317,10 +335,17 @@ const ProductDetail = ({ product }: Props) => { data={{ text: 'Check out this product', title: `${product.name} - Indoteknik.com`, - url: (process.env.NEXT_PUBLIC_SELF_HOST || '') + (router?.asPath || '/'), + url: + (process.env.NEXT_PUBLIC_SELF_HOST || '') + + (router?.asPath || '/'), }} > - @@ -350,8 +375,6 @@ const ProductDetail = ({ product }: Props) => {
); - - }; export default ProductDetail; -- cgit v1.2.3 From 0eedef242e76673e6882ec11b87a9371d6ec5164 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Wed, 12 Nov 2025 17:22:46 +0700 Subject: mobile --- src-migrate/modules/product-detail/components/ProductDetail.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src-migrate/modules/product-detail/components/ProductDetail.tsx') diff --git a/src-migrate/modules/product-detail/components/ProductDetail.tsx b/src-migrate/modules/product-detail/components/ProductDetail.tsx index c8c03300..76fa8298 100644 --- a/src-migrate/modules/product-detail/components/ProductDetail.tsx +++ b/src-migrate/modules/product-detail/components/ProductDetail.tsx @@ -252,7 +252,7 @@ const ProductDetail = ({ product }: Props) => { {/* ===== Kolom kanan: info ===== */}
{!hasPrice && ( -
+
Date: Wed, 12 Nov 2025 17:56:28 +0700 Subject: fix label desktop and mobile --- .../product-detail/components/ProductDetail.tsx | 68 ++++++++++++++++------ 1 file changed, 50 insertions(+), 18 deletions(-) (limited to 'src-migrate/modules/product-detail/components/ProductDetail.tsx') diff --git a/src-migrate/modules/product-detail/components/ProductDetail.tsx b/src-migrate/modules/product-detail/components/ProductDetail.tsx index 76fa8298..354889e5 100644 --- a/src-migrate/modules/product-detail/components/ProductDetail.tsx +++ b/src-migrate/modules/product-detail/components/ProductDetail.tsx @@ -143,6 +143,16 @@ const ProductDetail = ({ product }: Props) => { return ( <> + {/* WATERMARK OVERLAY jika produk tidak punya harga */} + {!hasPrice && ( +
+ Produk tidak tersedia +
+ )}
@@ -250,24 +260,46 @@ const ProductDetail = ({ product }: Props) => { {/* <<=== TUTUP kolom kiri */} {/* ===== Kolom kanan: info ===== */} -
- {!hasPrice && ( -
- -

- Maaf untuk saat ini Produk yang anda cari tidak tersedia -

-
- )} -
-

{product.name}

-
- -
-
+ {isDesktop && ( +
+ {!hasPrice && ( +
+ +

+ Maaf untuk saat ini Produk yang anda cari tidak tersedia +

+
+ )} +
+

{product.name}

+
+ +
+
+ )} + {isMobile && ( +
+ {!hasPrice && ( +
+ +

+ Maaf untuk saat ini Produk yang anda cari tidak tersedia +

+
+ )} +
+

{product.name}

+
+ +
+
+ )}
-- cgit v1.2.3 From d292f00640a5b0cf68019eedebcdbb87ecb27270 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Wed, 12 Nov 2025 18:18:03 +0700 Subject: watermark produk tidak tersedia --- .../modules/product-detail/components/ProductDetail.tsx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src-migrate/modules/product-detail/components/ProductDetail.tsx') diff --git a/src-migrate/modules/product-detail/components/ProductDetail.tsx b/src-migrate/modules/product-detail/components/ProductDetail.tsx index 354889e5..388d2248 100644 --- a/src-migrate/modules/product-detail/components/ProductDetail.tsx +++ b/src-migrate/modules/product-detail/components/ProductDetail.tsx @@ -143,16 +143,16 @@ const ProductDetail = ({ product }: Props) => { return ( <> - {/* WATERMARK OVERLAY jika produk tidak punya harga */} - {!hasPrice && ( -
+ {isDesktop && !hasPrice && ( +
Produk tidak tersedia
)} +
@@ -293,7 +293,6 @@ const ProductDetail = ({ product }: Props) => {
)} -

{product.name}

-- cgit v1.2.3 From ff27a8752df545554fcee1beb8acbb24011a040b Mon Sep 17 00:00:00 2001 From: Miqdad Date: Wed, 12 Nov 2025 18:33:30 +0700 Subject: mobile watermark --- src-migrate/modules/product-detail/components/ProductDetail.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src-migrate/modules/product-detail/components/ProductDetail.tsx') diff --git a/src-migrate/modules/product-detail/components/ProductDetail.tsx b/src-migrate/modules/product-detail/components/ProductDetail.tsx index 388d2248..48270dee 100644 --- a/src-migrate/modules/product-detail/components/ProductDetail.tsx +++ b/src-migrate/modules/product-detail/components/ProductDetail.tsx @@ -152,6 +152,15 @@ const ProductDetail = ({ product }: Props) => { />
)} + {isMobile && !hasPrice && ( +
+ Produk tidak tersedia +
+ )}
-- cgit v1.2.3 From 8ed66318c1e94d4c744984f2aab25ff993d5de4d Mon Sep 17 00:00:00 2001 From: Miqdad Date: Thu, 13 Nov 2025 15:59:08 +0700 Subject: cr watermark --- .../product-detail/components/ProductDetail.tsx | 41 ++++++++++++---------- 1 file changed, 23 insertions(+), 18 deletions(-) (limited to 'src-migrate/modules/product-detail/components/ProductDetail.tsx') diff --git a/src-migrate/modules/product-detail/components/ProductDetail.tsx b/src-migrate/modules/product-detail/components/ProductDetail.tsx index 48270dee..e4ba2b2f 100644 --- a/src-migrate/modules/product-detail/components/ProductDetail.tsx +++ b/src-migrate/modules/product-detail/components/ProductDetail.tsx @@ -143,24 +143,29 @@ const ProductDetail = ({ product }: Props) => { return ( <> - {isDesktop && !hasPrice && ( -
- Produk tidak tersedia -
- )} - {isMobile && !hasPrice && ( -
- Produk tidak tersedia -
- )} +
+ {isDesktop && !hasPrice && ( +
+ Produk tidak tersedia +
+ )} +
+ +
+ {isMobile && !hasPrice && ( +
+ Produk tidak tersedia +
+ )} +
-- cgit v1.2.3