From 2ce7d2605e3c20963589a19abd5ae3e9f6aae6fe Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 23 Jan 2025 09:28:23 +0700 Subject: set selected varian ke yang is_in_bu = true --- src-migrate/modules/product-detail/components/ProductDetail.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src-migrate/modules') diff --git a/src-migrate/modules/product-detail/components/ProductDetail.tsx b/src-migrate/modules/product-detail/components/ProductDetail.tsx index b036cc2d..f23aa9dc 100644 --- a/src-migrate/modules/product-detail/components/ProductDetail.tsx +++ b/src-migrate/modules/product-detail/components/ProductDetail.tsx @@ -66,7 +66,11 @@ const ProductDetail = ({ product }: Props) => { if (typeof auth === 'object') { setIsApproval(auth?.feature?.soApproval); } - setSelectedVariant(product?.variants[0]) + const selectedVariant = + product?.variants?.find((variant) => variant.is_in_bu) || + product?.variants?.[0]; + setSelectedVariant(selectedVariant); + // setSelectedVariant(product?.variants[0]) }, []); return ( -- cgit v1.2.3 From 679022cd84b158ae957a54b7f2ada152060d7262 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Fri, 7 Feb 2025 09:37:50 +0700 Subject: change default pkp to non pkp on register --- src-migrate/modules/register/components/RegistrasiBisnis.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src-migrate/modules') diff --git a/src-migrate/modules/register/components/RegistrasiBisnis.tsx b/src-migrate/modules/register/components/RegistrasiBisnis.tsx index 332c5358..5933b5f2 100644 --- a/src-migrate/modules/register/components/RegistrasiBisnis.tsx +++ b/src-migrate/modules/register/components/RegistrasiBisnis.tsx @@ -13,11 +13,11 @@ const RegistrasiBisnis: React.FC = ({ chekValid, buttonSubmitClick, }) => { - const [isPKP, setIsPKP] = useState(true); + const [isPKP, setIsPKP] = useState(false); const [isTerdaftar, setIsTerdaftar] = useState(false); const [isDropIndividu, setIsDropIndividu] = useState(true); const [isBisnisClicked, setisBisnisClicked] = useState(true); - const [selectedValue, setSelectedValue] = useState('PKP'); + const [selectedValue, setSelectedValue] = useState('Non-PKP'); const [selectedValueBisnis, setSelectedValueBisnis] = useState('false'); const { validate, updateForm } = useRegisterStore(); -- cgit v1.2.3 From bfa3cf8546e1a45941e8388b251b91975f95bfd3 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 19 Feb 2025 15:28:16 +0700 Subject: update code dari qty_available ke free_bandengan --- src-migrate/modules/cart/components/Item.tsx | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'src-migrate/modules') diff --git a/src-migrate/modules/cart/components/Item.tsx b/src-migrate/modules/cart/components/Item.tsx index ab2e7ce1..86d1dc43 100644 --- a/src-migrate/modules/cart/components/Item.tsx +++ b/src-migrate/modules/cart/components/Item.tsx @@ -1,5 +1,6 @@ import style from '../styles/item.module.css' - +import odooApi from '~/libs/odooApi'; +import { useEffect, useState } from 'react'; import { Skeleton, SkeletonProps, Tooltip } from '@chakra-ui/react' import { InfoIcon } from 'lucide-react' import Image from 'next/image' @@ -22,6 +23,17 @@ type Props = { } const CartItem = ({ item, editable = true, selfPicking}: Props) => { + const [qtyPickUp, setQtyPickUp] = useState(0); + useEffect(() => { + const fetchData = async () => { + const qty_available = await odooApi( + 'GET', + `/api/v1/product_variant/${item.id}/qty_available` + ); + setQtyPickUp(qty_available?.qty); + }; + fetchData(); + }, [item]); return (
{item.cart_type === 'promotion' && ( @@ -54,11 +66,11 @@ const CartItem = ({ item, editable = true, selfPicking}: Props) => {
- {item?.available_quantity > 0 && ( + {qtyPickUp > 0 && (
- {item.quantity <= item?.available_quantity + {item.quantity <= qtyPickUp ? '*Barang ini bisa di pickup maksimal pukul 16.00' - : `*${item?.available_quantity} Barang ini bisa di pickup maksimal pukul 16.00`} + : `*${qtyPickUp} Barang ini bisa di pickup maksimal pukul 16.00`}
)} -- cgit v1.2.3 From a7160110ab082109e96696c3bc2321f28610958c Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 20 Feb 2025 11:25:55 +0700 Subject: add google tag button add to cart --- .../product-detail/components/AddToCart.tsx | 37 +++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'src-migrate/modules') diff --git a/src-migrate/modules/product-detail/components/AddToCart.tsx b/src-migrate/modules/product-detail/components/AddToCart.tsx index 280e4a7a..95bc1d88 100644 --- a/src-migrate/modules/product-detail/components/AddToCart.tsx +++ b/src-migrate/modules/product-detail/components/AddToCart.tsx @@ -15,7 +15,8 @@ import { useProductCartContext } from '@/contexts/ProductCartContext'; import { createSlug } from '~/libs/slug'; import formatCurrency from '~/libs/formatCurrency'; import { useProductDetail } from '../stores/useProductDetail'; - +import { gtagAddToCart } from '@/core/utils/googleTag'; +import axios from 'axios'; type Props = { variantId: number | null; quantity?: number; @@ -50,6 +51,38 @@ const AddToCart = ({ isLoading, setIsloading, } = useProductCartContext(); + const [activeVariant, setActiveVariant] = useState({ + id: 0, + code: '', + name: '', + price: '', + stock: '', + weight: '', + isFlashSale: false, + }); + + useEffect(() => { + const fetchData = async () => { + if (variantId) { + let response = await axios( + `${process.env.NEXT_PUBLIC_SELF_HOST}/api/shop/variant-detail?id=${variantId}` + ); + let productVariant = response.data; + if (productVariant) { + setActiveVariant({ + id: productVariant[0].id, + code: productVariant[0].code, + name: productVariant[0].name, + price: productVariant[0].price.price, + stock: productVariant[0].stockTotal, + weight: productVariant[0].weight, + isFlashSale: productVariant[0].isFlashsale, + }); + } + } + }; + fetchData(); + }, [variantId]); const productSimilarQuery = [ product?.name, @@ -101,6 +134,8 @@ const AddToCart = ({ setRefreshCart(true); setAddCartAlert(true); + gtagAddToCart(activeVariant, quantity); + toast({ title: 'Tambah ke keranjang', description: 'Berhasil menambahkan barang ke keranjang belanja', -- cgit v1.2.3 From 9b22da67a1a397ca43ff80abb8ef4bbefef9b448 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 5 Mar 2025 10:35:33 +0700 Subject: CR renca telepon tempo --- src-migrate/modules/register/stores/usePengajuanTempoStore.ts | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src-migrate/modules') diff --git a/src-migrate/modules/register/stores/usePengajuanTempoStore.ts b/src-migrate/modules/register/stores/usePengajuanTempoStore.ts index 1e086c06..5f6e4974 100644 --- a/src-migrate/modules/register/stores/usePengajuanTempoStore.ts +++ b/src-migrate/modules/register/stores/usePengajuanTempoStore.ts @@ -186,6 +186,8 @@ export const usePengajuanTempoStorePengiriman = create< districtPengiriman: '', subDistrictPengiriman: '', zipPengiriman: '', + PICBarangMobile: '', + invoicePicMobile: '', invoicePicTittle: '', invoicePic: '', isSameAddrees: '', -- cgit v1.2.3 From dc7fcad0885e4cde8ba510817a69b759607524c7 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 6 Mar 2025 11:30:26 +0700 Subject: update code --- .../modules/register/stores/usePengajuanTempoStore.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src-migrate/modules') diff --git a/src-migrate/modules/register/stores/usePengajuanTempoStore.ts b/src-migrate/modules/register/stores/usePengajuanTempoStore.ts index 5f6e4974..79ab3612 100644 --- a/src-migrate/modules/register/stores/usePengajuanTempoStore.ts +++ b/src-migrate/modules/register/stores/usePengajuanTempoStore.ts @@ -171,7 +171,7 @@ type StatePengiriman = { }; type ActionPengiriman = { updateFormPengiriman: (name: string, value: string) => void; - + updateDokumenProsedur: (name: string, format: string, base64: string) => void; validatePengiriman: () => void; }; export const usePengajuanTempoStorePengiriman = create< @@ -204,12 +204,21 @@ export const usePengajuanTempoStorePengiriman = create< dokumenPengirimanInput: '', dokumenKirimInput: '', dokumenPengirimanInvoice: '', + dokumenProsedur: { name: '', format: '', base64: '' }, }, updateFormPengiriman: (name, value) => set((state) => ({ formPengiriman: { ...state.formPengiriman, [name]: value }, })), + updateDokumenProsedur: (name, format, base64) => + set((state) => ({ + formPengiriman: { + ...state.formPengiriman, + dokumenProsedur: { name, format, base64 }, + }, + })), + errorsPengiriman: {}, validatePengiriman: () => { try { @@ -262,6 +271,7 @@ export const usePengajuanTempoStoreDokumen = create< dokumenLaporanKeuangan: { name: '', format: '', base64: '' }, dokumenFotoKantor: { name: '', format: '', base64: '' }, dokumenTempatBekerja: { name: '', format: '', base64: '' }, + dokumenProsedur: { name: '', format: '', base64: '' }, }, // Memperbarui dokumen dengan name, format, dan base64 -- cgit v1.2.3 From d36a21cb0a6e95323fa9dd868a79bf1a318968e3 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Mon, 10 Mar 2025 21:41:38 +0700 Subject: update code variant no pick up --- src-migrate/modules/product-detail/components/PriceAction.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src-migrate/modules') diff --git a/src-migrate/modules/product-detail/components/PriceAction.tsx b/src-migrate/modules/product-detail/components/PriceAction.tsx index 9348bbfb..850c2d9d 100644 --- a/src-migrate/modules/product-detail/components/PriceAction.tsx +++ b/src-migrate/modules/product-detail/components/PriceAction.tsx @@ -163,7 +163,7 @@ const PriceAction = ({ product }: Props) => { */}
- {selectedVariant?.is_in_bu && ( + {qtyPickUp > 0 && ( Date: Thu, 13 Mar 2025 13:29:17 +0700 Subject: CR renca benner --- src-migrate/modules/side-banner/index.tsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src-migrate/modules') diff --git a/src-migrate/modules/side-banner/index.tsx b/src-migrate/modules/side-banner/index.tsx index 878b8e70..23ffc112 100644 --- a/src-migrate/modules/side-banner/index.tsx +++ b/src-migrate/modules/side-banner/index.tsx @@ -5,12 +5,16 @@ import Image from "~/components/ui/image";; import { getBanner } from "~/services/banner"; import { getRandomInt } from '@/utils/getRandomInt'; -const SideBanner = () => { +interface SideBannerProps { + query?: string; // Menentukan bahwa 'query' adalah string (bisa undefined) +} + +const SideBanner: React.FC = ({ query }) => { const fetchSideBanner = useQuery({ - queryKey: 'sideBanner', - queryFn: () => getBanner({ type: 'side-banner-search' }) + queryKey: ["sideBanner", query], + queryFn: () => getBanner({ type: "side-banner-search", keyword: query }), }); - + console.log("fetchSideBanner",fetchSideBanner) const length = useMemo(() => fetchSideBanner.data?.length, [fetchSideBanner.data]); const randomIndex = useMemo(() => getRandomInt(length), [length]); const banner = fetchSideBanner?.data?.[randomIndex] || false; -- cgit v1.2.3 From c02abe580bfdd28392f55704d613dea225428716 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 13 Mar 2025 15:36:46 +0700 Subject: update register bisnis not found --- src-migrate/modules/register/index.tsx | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src-migrate/modules') diff --git a/src-migrate/modules/register/index.tsx b/src-migrate/modules/register/index.tsx index 39f4771c..06f7cbea 100644 --- a/src-migrate/modules/register/index.tsx +++ b/src-migrate/modules/register/index.tsx @@ -101,6 +101,13 @@ const Register = () => { status: 'warning', }); break; + case 'BISNIS_NOT_FOUND': + toast({ + ...toastProps, + title: 'Bisnis tidak ditemukan', + status: 'warning', + }); + break; } }; -- cgit v1.2.3 From e7673474d1257445573358c48cc2ecefdec6cf46 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 19 Mar 2025 13:16:06 +0700 Subject: delete console log --- src-migrate/modules/side-banner/index.tsx | 1 - 1 file changed, 1 deletion(-) (limited to 'src-migrate/modules') diff --git a/src-migrate/modules/side-banner/index.tsx b/src-migrate/modules/side-banner/index.tsx index 23ffc112..7bc5f394 100644 --- a/src-migrate/modules/side-banner/index.tsx +++ b/src-migrate/modules/side-banner/index.tsx @@ -14,7 +14,6 @@ const SideBanner: React.FC = ({ query }) => { queryKey: ["sideBanner", query], queryFn: () => getBanner({ type: "side-banner-search", keyword: query }), }); - console.log("fetchSideBanner",fetchSideBanner) const length = useMemo(() => fetchSideBanner.data?.length, [fetchSideBanner.data]); const randomIndex = useMemo(() => getRandomInt(length), [length]); const banner = fetchSideBanner?.data?.[randomIndex] || false; -- cgit v1.2.3 From 71c0fa812ff0c5e82721754f496501b5a61bf226 Mon Sep 17 00:00:00 2001 From: trisusilo48 Date: Mon, 24 Mar 2025 10:12:27 +0700 Subject: handling desc table --- .../product-detail/components/ProductDetail.tsx | 28 ++++++++++++++-------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'src-migrate/modules') diff --git a/src-migrate/modules/product-detail/components/ProductDetail.tsx b/src-migrate/modules/product-detail/components/ProductDetail.tsx index f23aa9dc..4667e086 100644 --- a/src-migrate/modules/product-detail/components/ProductDetail.tsx +++ b/src-migrate/modules/product-detail/components/ProductDetail.tsx @@ -106,7 +106,12 @@ const ProductDetail = ({ product }: Props) => { )}
- {!!activeVariantId && !isApproval && } + {!!activeVariantId && !isApproval && ( + + )} {/*

@@ -121,15 +126,18 @@ const ProductDetail = ({ product }: Props) => {

Informasi Produk

-

' - ? 'Belum ada deskripsi' - : product.description, - }} - /> +
+

' + ? 'Belum ada deskripsi' + : product.description, + }} + /> +
-- cgit v1.2.3 From 81abbbabd11df17b5fe795e725f5841273fbf125 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Thu, 24 Apr 2025 14:31:48 +0700 Subject: Make Popup Banner show in product detail for non auth user --- src-migrate/modules/popup-information/index.tsx | 34 +++++++++++++++++----- .../product-detail/components/ProductDetail.tsx | 3 ++ 2 files changed, 29 insertions(+), 8 deletions(-) (limited to 'src-migrate/modules') diff --git a/src-migrate/modules/popup-information/index.tsx b/src-migrate/modules/popup-information/index.tsx index d50711cc..5c3bc8fa 100644 --- a/src-migrate/modules/popup-information/index.tsx +++ b/src-migrate/modules/popup-information/index.tsx @@ -10,11 +10,21 @@ import dynamic from 'next/dynamic'; const PagePopupInformation = () => { const router = useRouter(); const isHomePage = router.pathname === '/'; + // Updated to match your URL structure with /shop/product/ + const isProductDetail = router.pathname.includes('/shop/product/'); const auth = getAuth(); const [active, setActive] = useState(false); const [data, setData] = useState(null); const [loading, setLoading] = useState(true); + const [hasClosedPopup, setHasClosedPopup] = useState(false); + useEffect(() => { + // Check if user has closed the popup in this session + const popupClosed = sessionStorage.getItem('popupClosed'); + if (popupClosed) { + setHasClosedPopup(true); + } + }, []); useEffect(() => { const getData = async () => { @@ -26,25 +36,33 @@ const PagePopupInformation = () => { setLoading(false); }; - if (isHomePage && !auth) { + // Show popup if user is on homepage OR product detail page AND not authenticated AND hasn't closed popup + if ((isHomePage || isProductDetail) && !auth && !hasClosedPopup) { setActive(true); getData(); } - }, [isHomePage, auth]); + }, [isHomePage, isProductDetail, auth, hasClosedPopup]); + + const handleClose = () => { + setActive(false); + // Set session storage to remember user closed the popup + sessionStorage.setItem('popupClosed', 'true'); + }; + return (
{data && !loading && ( setActive(false)} + close={handleClose} mode='desktop' > -
setActive(false)} - > - +
+ {data[0]?.name} {
+
-- cgit v1.2.3 From d9dd7fd69d2f895f8e503f8d6becd4be3af18b15 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Thu, 24 Apr 2025 15:16:10 +0700 Subject: Remove session storage --- src-migrate/modules/popup-information/index.tsx | 29 ++++++------------------- 1 file changed, 7 insertions(+), 22 deletions(-) (limited to 'src-migrate/modules') diff --git a/src-migrate/modules/popup-information/index.tsx b/src-migrate/modules/popup-information/index.tsx index 5c3bc8fa..68e0805b 100644 --- a/src-migrate/modules/popup-information/index.tsx +++ b/src-migrate/modules/popup-information/index.tsx @@ -10,21 +10,11 @@ import dynamic from 'next/dynamic'; const PagePopupInformation = () => { const router = useRouter(); const isHomePage = router.pathname === '/'; - // Updated to match your URL structure with /shop/product/ const isProductDetail = router.pathname.includes('/shop/product/'); const auth = getAuth(); const [active, setActive] = useState(false); const [data, setData] = useState(null); const [loading, setLoading] = useState(true); - const [hasClosedPopup, setHasClosedPopup] = useState(false); - - useEffect(() => { - // Check if user has closed the popup in this session - const popupClosed = sessionStorage.getItem('popupClosed'); - if (popupClosed) { - setHasClosedPopup(true); - } - }, []); useEffect(() => { const getData = async () => { @@ -36,29 +26,24 @@ const PagePopupInformation = () => { setLoading(false); }; - // Show popup if user is on homepage OR product detail page AND not authenticated AND hasn't closed popup - if ((isHomePage || isProductDetail) && !auth && !hasClosedPopup) { + if ((isHomePage || isProductDetail) && !auth) { setActive(true); getData(); } - }, [isHomePage, isProductDetail, auth, hasClosedPopup]); - - const handleClose = () => { - setActive(false); - // Set session storage to remember user closed the popup - sessionStorage.setItem('popupClosed', 'true'); - }; - + }, [isHomePage, isProductDetail, auth]); return (
{data && !loading && ( setActive(false)} mode='desktop' > -
+
setActive(false)} + > Date: Tue, 6 May 2025 08:51:52 +0700 Subject: push --- .../product-detail/components/ProductDetail.tsx | 47 +++++++++++++++++++++- 1 file changed, 45 insertions(+), 2 deletions(-) (limited to 'src-migrate/modules') diff --git a/src-migrate/modules/product-detail/components/ProductDetail.tsx b/src-migrate/modules/product-detail/components/ProductDetail.tsx index 4667e086..c26dafde 100644 --- a/src-migrate/modules/product-detail/components/ProductDetail.tsx +++ b/src-migrate/modules/product-detail/components/ProductDetail.tsx @@ -2,7 +2,7 @@ import style from '../styles/product-detail.module.css'; import Link from 'next/link'; import { useRouter } from 'next/router'; -import { useEffect } from 'react'; +import { useEffect, useState } from 'react'; import { Button } from '@chakra-ui/react'; import { MessageCircleIcon, Share2Icon } from 'lucide-react'; @@ -73,6 +73,19 @@ const ProductDetail = ({ product }: Props) => { // setSelectedVariant(product?.variants[0]) }, []); + + + // Gabungkan semua gambar produk (utama + tambahan) + const allImages = product.image_carousel ? [...product.image_carousel] : []; + + + if (product.image) { + allImages.unshift(product.image); // Tambahkan gambar utama di awal array + } + console.log(product); + + const [mainImage, setMainImage] = useState(allImages[0] || ''); + return ( <>
@@ -82,7 +95,37 @@ const ProductDetail = ({ product }: Props) => {
- + + + {/* Carousel horizontal */} + {allImages.length > 0 && ( +
+
+ {allImages.map((img, index) => ( +
setMainImage(img)} + > + {`Thumbnail { + e.target.src = '/path/to/fallback-image.jpg'; // Fallback jika gambar error + }} + /> +
+ ))} +
+
+ )} +
-- cgit v1.2.3 From 9e90f51952deee673c19f11c4498229e81ce29f2 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 6 May 2025 09:31:44 +0700 Subject: fix bug --- src-migrate/modules/product-detail/components/ProductDetail.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src-migrate/modules') diff --git a/src-migrate/modules/product-detail/components/ProductDetail.tsx b/src-migrate/modules/product-detail/components/ProductDetail.tsx index c26dafde..685c107d 100644 --- a/src-migrate/modules/product-detail/components/ProductDetail.tsx +++ b/src-migrate/modules/product-detail/components/ProductDetail.tsx @@ -117,7 +117,7 @@ const ProductDetail = ({ product }: Props) => { className="w-full h-full object-cover rounded-sm" loading="lazy" onError={(e) => { - e.target.src = '/path/to/fallback-image.jpg'; // Fallback jika gambar error + (e.target as HTMLImageElement).src = '/path/to/fallback-image.jpg'; }} />
-- cgit v1.2.3 From 166191e8f7335810cd0073b9aa2436a908a21d34 Mon Sep 17 00:00:00 2001 From: Miqdad Date: Wed, 7 May 2025 09:20:55 +0700 Subject: voucher category --- src-migrate/modules/promo/components/Voucher.tsx | 1 + 1 file changed, 1 insertion(+) (limited to 'src-migrate/modules') diff --git a/src-migrate/modules/promo/components/Voucher.tsx b/src-migrate/modules/promo/components/Voucher.tsx index 034d13e9..0c225c74 100644 --- a/src-migrate/modules/promo/components/Voucher.tsx +++ b/src-migrate/modules/promo/components/Voucher.tsx @@ -18,6 +18,7 @@ interface Voucher { name: string; description: string; code: string; + voucher_category: []; } const VoucherComponent = () => { -- cgit v1.2.3 From 4ca48d5b2b8da512447d04bb7e6540ea2b76294b Mon Sep 17 00:00:00 2001 From: Miqdad Date: Wed, 7 May 2025 09:53:12 +0700 Subject: merge --- src-migrate/modules/popup-information/index.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src-migrate/modules') diff --git a/src-migrate/modules/popup-information/index.tsx b/src-migrate/modules/popup-information/index.tsx index 68e0805b..cae50abf 100644 --- a/src-migrate/modules/popup-information/index.tsx +++ b/src-migrate/modules/popup-information/index.tsx @@ -10,7 +10,6 @@ import dynamic from 'next/dynamic'; const PagePopupInformation = () => { const router = useRouter(); const isHomePage = router.pathname === '/'; - const isProductDetail = router.pathname.includes('/shop/product/'); const auth = getAuth(); const [active, setActive] = useState(false); const [data, setData] = useState(null); @@ -26,11 +25,11 @@ const PagePopupInformation = () => { setLoading(false); }; - if ((isHomePage || isProductDetail) && !auth) { + if (isHomePage && !auth) { setActive(true); getData(); } - }, [isHomePage, isProductDetail, auth]); + }, [isHomePage, auth]); return (
{data && !loading && ( -- cgit v1.2.3 From 89a0e7f37d7537c2d0d3715817453279443d518b Mon Sep 17 00:00:00 2001 From: Miqdad Date: Wed, 7 May 2025 15:06:32 +0700 Subject: Fix conflict --- .../product-detail/components/ProductDetail.tsx | 30 +++++++++------------- 1 file changed, 12 insertions(+), 18 deletions(-) (limited to 'src-migrate/modules') diff --git a/src-migrate/modules/product-detail/components/ProductDetail.tsx b/src-migrate/modules/product-detail/components/ProductDetail.tsx index bd2c895f..0660b9c0 100644 --- a/src-migrate/modules/product-detail/components/ProductDetail.tsx +++ b/src-migrate/modules/product-detail/components/ProductDetail.tsx @@ -23,8 +23,6 @@ import PriceAction from './PriceAction'; import SimilarBottom from './SimilarBottom'; import SimilarSide from './SimilarSide'; -import PagePopupInformation from '~/modules/popup-information'; - import { gtagProductDetail } from '@/core/utils/googleTag'; type Props = { @@ -75,12 +73,9 @@ const ProductDetail = ({ product }: Props) => { // setSelectedVariant(product?.variants[0]) }, []); - - // Gabungkan semua gambar produk (utama + tambahan) const allImages = product.image_carousel ? [...product.image_carousel] : []; - if (product.image) { allImages.unshift(product.image); // Tambahkan gambar utama di awal array } @@ -95,21 +90,20 @@ const ProductDetail = ({ product }: Props) => {
-
- - + + {/* Carousel horizontal */} {allImages.length > 0 && ( -
-
+
+
{allImages.map((img, index) => ( -
setMainImage(img)} @@ -117,10 +111,11 @@ const ProductDetail = ({ product }: Props) => { {`Thumbnail { - (e.target as HTMLImageElement).src = '/path/to/fallback-image.jpg'; + (e.target as HTMLImageElement).src = + '/path/to/fallback-image.jpg'; }} />
@@ -128,7 +123,6 @@ const ProductDetail = ({ product }: Props) => {
)} -
-- cgit v1.2.3