From eb46cfeca8da8ea2b40e5576b3789f179d5aff56 Mon Sep 17 00:00:00 2001 From: trisusilo48 Date: Tue, 6 Aug 2024 15:13:31 +0700 Subject: CR no telpon --- src/core/components/elements/Footer/BasicFooter.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/components/elements/Footer/BasicFooter.jsx b/src/core/components/elements/Footer/BasicFooter.jsx index 6129143d..4beea604 100644 --- a/src/core/components/elements/Footer/BasicFooter.jsx +++ b/src/core/components/elements/Footer/BasicFooter.jsx @@ -259,7 +259,7 @@ const InformationCenter = () => (
  • - (021) 2933-8828 / 29 + (021) 2933-8828
  • -- cgit v1.2.3 From cb04d90c8887993f532d582e7cdb1780b86bd4be Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 7 Aug 2024 08:33:38 +0700 Subject: update error code voucher tidak terbaca --- src/lib/product/components/ProductCard.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx index e10241a7..35e2a665 100644 --- a/src/lib/product/components/ProductCard.jsx +++ b/src/lib/product/components/ProductCard.jsx @@ -17,8 +17,8 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { const [discount, setDiscount] = useState(0); let voucherPastiHemat = 0; - - if (product?.voucherPastiHemat.length > 0) { + + if (product?.voucherPastiHemat ? product?.voucherPastiHemat.length : voucherPastiHemat > 0) { const stringVoucher = product?.voucherPastiHemat[0]; const validJsonString = stringVoucher.replace(/'/g, '"'); voucherPastiHemat = JSON.parse(validJsonString); -- cgit v1.2.3 From 6bfa8b7b0c6afaec7eb3d81983d0f012953b07f2 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 7 Aug 2024 11:49:54 +0700 Subject: add pop up semua promo --- .../components/elements/Navbar/NavbarDesktop.jsx | 70 ++++++++++++++++++---- src/core/components/elements/Navbar/TopBanner.jsx | 9 ++- 2 files changed, 65 insertions(+), 14 deletions(-) diff --git a/src/core/components/elements/Navbar/NavbarDesktop.jsx b/src/core/components/elements/Navbar/NavbarDesktop.jsx index 7d9e4264..ff43d4a0 100644 --- a/src/core/components/elements/Navbar/NavbarDesktop.jsx +++ b/src/core/components/elements/Navbar/NavbarDesktop.jsx @@ -10,11 +10,12 @@ import { ChevronDownIcon, DocumentCheckIcon, HeartIcon, + ArrowUpRightIcon, } from '@heroicons/react/24/outline'; import dynamic from 'next/dynamic'; import Image from 'next/image'; import { useRouter } from 'next/router'; -import { useEffect, useState } from 'react'; +import { useCallback, useEffect, useState } from 'react'; import DesktopView from '../../views/DesktopView'; import Link from '../Link/Link'; import NavbarUserDropdown from './NavbarUserDropdown'; @@ -47,6 +48,46 @@ const NavbarDesktop = () => { const { product } = useProductContext(); const { isOpen, onOpen, onClose } = useDisclosure(); + const [showPopup, setShowPopup] = useState(false); + const [isTop, setIsTop] = useState(true); + + const handleTopBannerLoad = useCallback(() => { + const showTimer = setTimeout(() => { + setShowPopup(true); + }, 500); + + const hideTimer = setTimeout(() => { + setShowPopup(false); + }, 9500); + + return () => { + clearTimeout(showTimer); + clearTimeout(hideTimer); + }; + }, []); + + useEffect(() => { + const handleScroll = () => { + setIsTop(window.scrollY < 100); + }; + + window.addEventListener('scroll', handleScroll); + return () => { + window.removeEventListener('scroll', handleScroll); + }; + }, []); + + useEffect(() => { + const handleScroll = () => { + setIsTop(window.scrollY < 100); + }; + + window.addEventListener('scroll', handleScroll); + return () => { + window.removeEventListener('scroll', handleScroll); + }; + }, []); + useEffect(() => { if (router.pathname === '/shop/product/[slug]') { setPayloadWa({ @@ -79,7 +120,7 @@ const NavbarDesktop = () => { return ( - +
    @@ -204,6 +245,7 @@ const NavbarDesktop = () => {
    + { rel="noreferrer" >

    Semua Promo

    - {/*
    - promo -
    */} - + {showPopup && router.pathname === '/' && ( +
    +

    + Penawaran Terbatas +

    +
    + )} + {/* {showPopup && router.pathname === '/' && ( +
    + +
    + )} */} + { +const TopBanner = ({ onLoad }) => { const topBanner = useQuery({ queryKey: 'topBanner', queryFn: async () => await odooApi('GET', '/api/v1/banner?type=top-banner'), @@ -16,6 +17,12 @@ const TopBanner = () => { const hasData = topBanner.data?.length > 0; const data = topBanner.data?.[0] || null; + useEffect(() => { + if (hasData) { + onLoad(); + } + }, [hasData, onLoad]); + return ( Date: Wed, 7 Aug 2024 13:14:27 +0700 Subject: add penwaran terbatas popup --- public/images/penawaran-terbatas.svg | 24 ++++++++++++++++++++++ .../components/elements/Navbar/NavbarDesktop.jsx | 18 +++++++++------- 2 files changed, 35 insertions(+), 7 deletions(-) create mode 100644 public/images/penawaran-terbatas.svg diff --git a/public/images/penawaran-terbatas.svg b/public/images/penawaran-terbatas.svg new file mode 100644 index 00000000..485f01a1 --- /dev/null +++ b/public/images/penawaran-terbatas.svg @@ -0,0 +1,24 @@ + + + + + + + + + Penawaran Terbatas + + + + Penawaran Terbatas + + diff --git a/src/core/components/elements/Navbar/NavbarDesktop.jsx b/src/core/components/elements/Navbar/NavbarDesktop.jsx index ff43d4a0..78e7f54a 100644 --- a/src/core/components/elements/Navbar/NavbarDesktop.jsx +++ b/src/core/components/elements/Navbar/NavbarDesktop.jsx @@ -57,7 +57,7 @@ const NavbarDesktop = () => { }, 500); const hideTimer = setTimeout(() => { - setShowPopup(false); + // setShowPopup(false); }, 9500); return () => { @@ -256,18 +256,22 @@ const NavbarDesktop = () => { >

    Semua Promo

    - {showPopup && router.pathname === '/' && ( + {/* {showPopup && router.pathname === '/' && (

    Penawaran Terbatas

    - )} - {/* {showPopup && router.pathname === '/' && ( -
    - -
    )} */} + {showPopup && router.pathname === '/' && ( + penawaran terbatas + )} Date: Wed, 7 Aug 2024 15:22:39 +0700 Subject: update all promo --- public/images/penawaran-terbatas.jpg | Bin 0 -> 6802 bytes public/images/penawaran-terbatas.svg | 24 -------- .../promo/components/FlashSaleNonDisplay.tsx | 20 +++++++ src-migrate/pages/shop/promo/index.tsx | 4 ++ .../components/elements/Navbar/NavbarDesktop.jsx | 19 +++--- .../flashSale/components/FlashSaleNonDisplay.jsx | 66 +++++++++++++++++++++ 6 files changed, 100 insertions(+), 33 deletions(-) create mode 100644 public/images/penawaran-terbatas.jpg delete mode 100644 public/images/penawaran-terbatas.svg create mode 100644 src-migrate/modules/promo/components/FlashSaleNonDisplay.tsx create mode 100644 src/lib/flashSale/components/FlashSaleNonDisplay.jsx diff --git a/public/images/penawaran-terbatas.jpg b/public/images/penawaran-terbatas.jpg new file mode 100644 index 00000000..e43739fc Binary files /dev/null and b/public/images/penawaran-terbatas.jpg differ diff --git a/public/images/penawaran-terbatas.svg b/public/images/penawaran-terbatas.svg deleted file mode 100644 index 485f01a1..00000000 --- a/public/images/penawaran-terbatas.svg +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - Penawaran Terbatas - - - - Penawaran Terbatas - - diff --git a/src-migrate/modules/promo/components/FlashSaleNonDisplay.tsx b/src-migrate/modules/promo/components/FlashSaleNonDisplay.tsx new file mode 100644 index 00000000..1c5cc86d --- /dev/null +++ b/src-migrate/modules/promo/components/FlashSaleNonDisplay.tsx @@ -0,0 +1,20 @@ +import dynamic from "next/dynamic"; +import React from "react"; +import { FlashSaleSkeleton } from "@/lib/flashSale/skeleton/FlashSaleSkeleton"; + +const FlashSaleNonDisplay = dynamic( + () => import('@/lib/flashSale/components/FlashSaleNonDisplay'), + { + loading: () => , + } + ); + + const FlashSalePromo = ()=> { + return( + <> + + + ) + } + + export default FlashSalePromo \ No newline at end of file diff --git a/src-migrate/pages/shop/promo/index.tsx b/src-migrate/pages/shop/promo/index.tsx index febe31a4..95d8a4d5 100644 --- a/src-migrate/pages/shop/promo/index.tsx +++ b/src-migrate/pages/shop/promo/index.tsx @@ -5,6 +5,7 @@ import Hero from '~/modules/promo/components/Hero' import PromotionProgram from '~/modules/promo/components/PromotinProgram' import Voucher from '~/modules/promo/components/Voucher' import FlashSale from '../../../modules/promo/components/FlashSale' +import FlashSaleNonDisplay from '../../../modules/promo/components/FlashSaleNonDisplay' const PromoList = dynamic(() => import('../../../modules/promo/components/PromoList')); @@ -28,6 +29,9 @@ const PromoPage = () => {

    + + + diff --git a/src/core/components/elements/Navbar/NavbarDesktop.jsx b/src/core/components/elements/Navbar/NavbarDesktop.jsx index 78e7f54a..cc5ea611 100644 --- a/src/core/components/elements/Navbar/NavbarDesktop.jsx +++ b/src/core/components/elements/Navbar/NavbarDesktop.jsx @@ -255,6 +255,16 @@ const NavbarDesktop = () => { rel="noreferrer" >

    Semua Promo

    + {showPopup && ( + penawaran terbatas + )} {/* {showPopup && router.pathname === '/' && (
    @@ -263,15 +273,6 @@ const NavbarDesktop = () => {

    )} */} - {showPopup && router.pathname === '/' && ( - penawaran terbatas - )} { + const [flashSales, setFlashSales] = useState(null); + const [isLoading, setIsLoading] = useState(true); + + useEffect(() => { + const loadFlashSales = async () => { + const dataFlashSales = await flashSaleApi(); + setFlashSales(dataFlashSales); + setIsLoading(false); + }; + loadFlashSales(); + }, []); + + if (isLoading) { + return ; + } + + return ( + flashSales?.length > 0 && ( +
    + {flashSales.map((flashSale, index) => ( +
    +
    +
    + Penawaran Terbatas +
    +
    + +
    + +
    +
    + ))} +
    + ) + ); +}; + +const FlashSaleProduct = ({ flashSaleId }) => { + const [products, setProducts] = useState(null); + + useEffect(() => { + const loadProducts = async () => { + const dataProducts = await productSearchApi({ + query: `fq=-flashsale_id_i:${flashSaleId}&fq=flashsale_price_f:[1 TO *]&limit=500&orderBy=flashsale_discount_f desc`, + operation: 'AND', + }); + setProducts(dataProducts.response); + }; + loadProducts(); + }, [flashSaleId]); + + return ; +}; + +export default FlashSaleNonDisplay; -- cgit v1.2.3 From c08901721ea5bf61aa5dca9ada1abaf480d8a1ee Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 7 Aug 2024 16:06:41 +0700 Subject: update pop up --- .../components/elements/Navbar/NavbarDesktop.jsx | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/core/components/elements/Navbar/NavbarDesktop.jsx b/src/core/components/elements/Navbar/NavbarDesktop.jsx index cc5ea611..a09989a5 100644 --- a/src/core/components/elements/Navbar/NavbarDesktop.jsx +++ b/src/core/components/elements/Navbar/NavbarDesktop.jsx @@ -254,17 +254,20 @@ const NavbarDesktop = () => { target="_blank" rel="noreferrer" > -

    Semua Promo

    {showPopup && ( - penawaran terbatas +
    + penawaran terbatas +
    )} +

    Semua Promo

    {/* {showPopup && router.pathname === '/' && (
    -- cgit v1.2.3 From 0fc1ee076d3a59b406f79716c343f15301c1066a Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 7 Aug 2024 17:06:58 +0700 Subject: update all promotion card flashSale --- public/images/penawaran-terbatas.jpg | Bin 6802 -> 6602 bytes src-migrate/pages/shop/promo/index.tsx | 1 + src/core/components/elements/Navbar/NavbarDesktop.jsx | 2 +- src/lib/flashSale/components/FlashSaleNonDisplay.jsx | 2 +- src/pages/api/shop/search.js | 6 ++++++ 5 files changed, 9 insertions(+), 2 deletions(-) diff --git a/public/images/penawaran-terbatas.jpg b/public/images/penawaran-terbatas.jpg index e43739fc..d07866e6 100644 Binary files a/public/images/penawaran-terbatas.jpg and b/public/images/penawaran-terbatas.jpg differ diff --git a/src-migrate/pages/shop/promo/index.tsx b/src-migrate/pages/shop/promo/index.tsx index 95d8a4d5..7bb5546d 100644 --- a/src-migrate/pages/shop/promo/index.tsx +++ b/src-migrate/pages/shop/promo/index.tsx @@ -32,6 +32,7 @@ const PromoPage = () => { +

    diff --git a/src/core/components/elements/Navbar/NavbarDesktop.jsx b/src/core/components/elements/Navbar/NavbarDesktop.jsx index a09989a5..76012694 100644 --- a/src/core/components/elements/Navbar/NavbarDesktop.jsx +++ b/src/core/components/elements/Navbar/NavbarDesktop.jsx @@ -263,7 +263,7 @@ const NavbarDesktop = () => { height={160} quality={100} // className={`fixed ${isTop ? 'md:top-[145px] lg:top-[160px] ' : 'lg:top-[85px] top-[80px]'} rounded-3xl md:left-1/4 lg:left-1/4 xl:left-1/4 left-2/3 w-40 h-12 p-2 z-50 transition-all duration-300 animate-pulse`} - className={`inline-block relative -top-4 transition-all duration-300 z-20 animate-pulse`} + className={`inline-block relative -top-5 transition-all duration-300 z-20 animate-pulse`} />
    )} diff --git a/src/lib/flashSale/components/FlashSaleNonDisplay.jsx b/src/lib/flashSale/components/FlashSaleNonDisplay.jsx index 85807fad..8dc15b05 100644 --- a/src/lib/flashSale/components/FlashSaleNonDisplay.jsx +++ b/src/lib/flashSale/components/FlashSaleNonDisplay.jsx @@ -52,7 +52,7 @@ const FlashSaleProduct = ({ flashSaleId }) => { useEffect(() => { const loadProducts = async () => { const dataProducts = await productSearchApi({ - query: `fq=-flashsale_id_i:${flashSaleId}&fq=flashsale_price_f:[1 TO *]&limit=500&orderBy=flashsale_discount_f desc`, + query: `fq=-flashsale_id_i:${flashSaleId}&fq=flashsale_price_f:[1 TO *]&limit=500&orderBy=flashsale-discount-desc`, operation: 'AND', }); setProducts(dataProducts.response); diff --git a/src/pages/api/shop/search.js b/src/pages/api/shop/search.js index 29471f7b..8dc72559 100644 --- a/src/pages/api/shop/search.js +++ b/src/pages/api/shop/search.js @@ -3,6 +3,7 @@ import axios from 'axios'; import camelcaseObjectDeep from 'camelcase-object-deep'; export default async function handler(req, res) { + const { q = '*', page = 1, @@ -20,6 +21,9 @@ export default async function handler(req, res) { let paramOrderBy = ''; switch (orderBy) { + case 'flashsale-discount-desc': + paramOrderBy += 'flashsale_discount_f DESC'; + break; case 'price-asc': paramOrderBy += 'price_tier1_v2_f ASC'; break; @@ -59,6 +63,7 @@ export default async function handler(req, res) { `fq=-publish_b:false, product_rating_f:[13 TO *], discount_tier1_v2_f:[1 TO *]`, ]; + if (priceFrom > 0 || priceTo > 0) { parameter.push( `fq=price_tier1_v2_f:[${priceFrom == '' ? '*' : priceFrom} TO ${ @@ -99,6 +104,7 @@ export default async function handler(req, res) { let result = await axios( process.env.SOLR_HOST + '/solr/product/select?' + parameter.join('&') ); + console.log("result",result) try { result.data.response.products = productMappingSolr( result.data.response.docs, -- cgit v1.2.3 From f2e11c985f467cfe28b6f4c8c9ae9c7fabf85d94 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 7 Aug 2024 17:07:59 +0700 Subject: delete console log --- src/pages/api/shop/search.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/api/shop/search.js b/src/pages/api/shop/search.js index 8dc72559..87d7c580 100644 --- a/src/pages/api/shop/search.js +++ b/src/pages/api/shop/search.js @@ -104,7 +104,7 @@ export default async function handler(req, res) { let result = await axios( process.env.SOLR_HOST + '/solr/product/select?' + parameter.join('&') ); - console.log("result",result) + try { result.data.response.products = productMappingSolr( result.data.response.docs, -- cgit v1.2.3 From 718babe0efd96c33ba2b8fd0cb458c57d67abe9c Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 7 Aug 2024 17:15:58 +0700 Subject: update position --- src/core/components/elements/Navbar/NavbarDesktop.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/components/elements/Navbar/NavbarDesktop.jsx b/src/core/components/elements/Navbar/NavbarDesktop.jsx index 76012694..2ddf5efe 100644 --- a/src/core/components/elements/Navbar/NavbarDesktop.jsx +++ b/src/core/components/elements/Navbar/NavbarDesktop.jsx @@ -263,7 +263,7 @@ const NavbarDesktop = () => { height={160} quality={100} // className={`fixed ${isTop ? 'md:top-[145px] lg:top-[160px] ' : 'lg:top-[85px] top-[80px]'} rounded-3xl md:left-1/4 lg:left-1/4 xl:left-1/4 left-2/3 w-40 h-12 p-2 z-50 transition-all duration-300 animate-pulse`} - className={`inline-block relative -top-5 transition-all duration-300 z-20 animate-pulse`} + className={`inline-block relative -top-8 transition-all duration-300 z-20 animate-pulse`} />
    )} -- cgit v1.2.3