summaryrefslogtreecommitdiff
path: root/src-migrate/modules/product-detail/components/ProductDetail.tsx
diff options
context:
space:
mode:
authorFIN-IT_AndriFP <andrifebriyadiputra@gmail.com>2026-01-30 09:28:19 +0700
committerFIN-IT_AndriFP <andrifebriyadiputra@gmail.com>2026-01-30 09:28:19 +0700
commit0df8e2dc0771853eac3e3db2a3716042681c876e (patch)
tree38d8794ad57de6c470f31376f68658d3e21cc26f /src-migrate/modules/product-detail/components/ProductDetail.tsx
parent4bb444b880d7677ba60f163c78440c2357fb16a4 (diff)
parentec7ab4c654fc5b29b277d42ad84986f4c1220134 (diff)
fix merge
Diffstat (limited to 'src-migrate/modules/product-detail/components/ProductDetail.tsx')
-rw-r--r--src-migrate/modules/product-detail/components/ProductDetail.tsx21
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();