diff options
| author | FIN-IT_AndriFP <andrifebriyadiputra@gmail.com> | 2026-01-30 09:28:19 +0700 |
|---|---|---|
| committer | FIN-IT_AndriFP <andrifebriyadiputra@gmail.com> | 2026-01-30 09:28:19 +0700 |
| commit | 0df8e2dc0771853eac3e3db2a3716042681c876e (patch) | |
| tree | 38d8794ad57de6c470f31376f68658d3e21cc26f /src-migrate/modules/product-detail/components/ProductDetail.tsx | |
| parent | 4bb444b880d7677ba60f163c78440c2357fb16a4 (diff) | |
| parent | ec7ab4c654fc5b29b277d42ad84986f4c1220134 (diff) | |
fix merge
Diffstat (limited to 'src-migrate/modules/product-detail/components/ProductDetail.tsx')
| -rw-r--r-- | src-migrate/modules/product-detail/components/ProductDetail.tsx | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src-migrate/modules/product-detail/components/ProductDetail.tsx b/src-migrate/modules/product-detail/components/ProductDetail.tsx index 03089afa..b6db3f69 100644 --- a/src-migrate/modules/product-detail/components/ProductDetail.tsx +++ b/src-migrate/modules/product-detail/components/ProductDetail.tsx @@ -156,9 +156,19 @@ const ProductDetail = ({ product }: Props) => { setAskAdminUrl(createdAskUrl); }, [router.asPath, product.manufacture.name, product.name, setAskAdminUrl]); - // ========================================================================= + // useEffect(() => { + // if (!product?.variants?.length) return; + + // setIsApproval(auth?.feature?.soApproval); + + // setSelectedVariant((prev: any) => { + // if (prev) return prev; + + // return product.variants[0]; + // }); + // }, [product?.id]); + // 1. LOGIC INISIALISASI VARIANT - // ========================================================================= useEffect(() => { if (typeof auth === 'object') { setIsApproval(auth?.feature?.soApproval); @@ -175,9 +185,8 @@ const ProductDetail = ({ product }: Props) => { }, [product, auth]); - // ========================================================================= + // 2. LOGIC FETCH DATA - // ========================================================================= useEffect(() => { const fetchMagentoData = async () => { const allVariantIds = product.variants.map(v => v.id); @@ -247,9 +256,7 @@ const ProductDetail = ({ product }: Props) => { }, [product.id]); - // ========================================================================= // HELPER 1: GROUPING DATA BY LABEL - // ========================================================================= const processMatrixData = (rawMatrix: any[]) => { const groups: any = {}; const result: any[] = []; @@ -283,9 +290,7 @@ const ProductDetail = ({ product }: Props) => { }; - // ========================================================================= // HELPER 2: RENDER SPEC VALUE - // ========================================================================= const renderSpecValue = (val: any) => { if (!val) return '-'; const strVal = String(val).trim(); |
