From 86a715473aca30e277c1857bbcb6e6e9283e13f4 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Wed, 7 Aug 2024 15:22:39 +0700 Subject: update all promo --- .../flashSale/components/FlashSaleNonDisplay.jsx | 66 ++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 src/lib/flashSale/components/FlashSaleNonDisplay.jsx (limited to 'src/lib/flashSale/components') diff --git a/src/lib/flashSale/components/FlashSaleNonDisplay.jsx b/src/lib/flashSale/components/FlashSaleNonDisplay.jsx new file mode 100644 index 00000000..85807fad --- /dev/null +++ b/src/lib/flashSale/components/FlashSaleNonDisplay.jsx @@ -0,0 +1,66 @@ +import Image from 'next/image'; +import { useEffect, useState } from 'react'; + +import CountDown from '@/core/components/elements/CountDown/CountDown'; +import productSearchApi from '@/lib/product/api/productSearchApi'; +import ProductSlider from '@/lib/product/components/ProductSlider'; + +import flashSaleApi from '../api/flashSaleApi'; +import { FlashSaleSkeleton } from '../skeleton/FlashSaleSkeleton'; + +const FlashSaleNonDisplay = () => { + 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 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 --- src/lib/flashSale/components/FlashSaleNonDisplay.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/lib/flashSale/components') 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); -- cgit v1.2.3 From 8f310309ea811d7524f90ffc43db29c1dd291c1a Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Thu, 15 Aug 2024 11:41:13 +0700 Subject: update limit penawaran terbatas to 25 --- src/lib/flashSale/components/FlashSaleNonDisplay.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/lib/flashSale/components') diff --git a/src/lib/flashSale/components/FlashSaleNonDisplay.jsx b/src/lib/flashSale/components/FlashSaleNonDisplay.jsx index 8dc15b05..3218ab35 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-desc`, + query: `fq=-flashsale_id_i:${flashSaleId}&fq=flashsale_price_f:[1 TO *]&limit=25&orderBy=flashsale-discount-desc`, operation: 'AND', }); setProducts(dataProducts.response); -- cgit v1.2.3 From b22c0e52dc08083025330ef0a501e085cbf434df Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Fri, 16 Aug 2024 10:00:38 +0700 Subject: add button lihat semua --- src/lib/flashSale/components/FlashSaleNonDisplay.jsx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/lib/flashSale/components') diff --git a/src/lib/flashSale/components/FlashSaleNonDisplay.jsx b/src/lib/flashSale/components/FlashSaleNonDisplay.jsx index 3218ab35..0068c98d 100644 --- a/src/lib/flashSale/components/FlashSaleNonDisplay.jsx +++ b/src/lib/flashSale/components/FlashSaleNonDisplay.jsx @@ -7,33 +7,46 @@ import ProductSlider from '@/lib/product/components/ProductSlider'; import flashSaleApi from '../api/flashSaleApi'; import { FlashSaleSkeleton } from '../skeleton/FlashSaleSkeleton'; +import Link from 'next/link'; +import { useRouter } from 'next/router' const FlashSaleNonDisplay = () => { const [flashSales, setFlashSales] = useState(null); const [isLoading, setIsLoading] = useState(true); + const [pencarian, setPencarian] = useState(''); + const router = useRouter() useEffect(() => { const loadFlashSales = async () => { const dataFlashSales = await flashSaleApi(); setFlashSales(dataFlashSales); + setPencarian(`fq=-flashsale_id_i:${dataFlashSales[0]?.pricelistId}&fq=flashsale_price_f:[1 TO *]&orderBy=flashsale-discount-desc`) setIsLoading(false); }; loadFlashSales(); }, []); + const handleSubmit = () => { + router.push(`/shop/search?${pencarian}`) + } + if (isLoading) { return ; } + return ( flashSales?.length > 0 && (
{flashSales.map((flashSale, index) => (
-
+
Penawaran Terbatas
+
+ Lihat Semua +
-- cgit v1.2.3 From 6d3b7a1744b6be3474f52ee3e0270963ecadd24b Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Fri, 16 Aug 2024 11:55:50 +0700 Subject: update --- src/lib/flashSale/components/FlashSale.jsx | 63 ++++++++++++++++-------------- 1 file changed, 33 insertions(+), 30 deletions(-) (limited to 'src/lib/flashSale/components') diff --git a/src/lib/flashSale/components/FlashSale.jsx b/src/lib/flashSale/components/FlashSale.jsx index 5be6d4e3..85afb818 100644 --- a/src/lib/flashSale/components/FlashSale.jsx +++ b/src/lib/flashSale/components/FlashSale.jsx @@ -26,38 +26,41 @@ const FlashSale = () => { } return ( - flashSales?.length > 0 && ( -
- {flashSales.map((flashSale, index) => ( -
-
-
- {flashSale.name} +
+ {flashSales?.length > 0 && ( +
+ {flashSales.map((flashSale, index) => ( +
+
+
+ {flashSale.name} +
+ +
+ +
+ {flashSale.name} + {flashSale.name} +
- -
- -
- {flashSale.name} - {flashSale.name} -
-
- ))} -
- ) + ))} +
+ )} + +
); }; -- cgit v1.2.3 From a20fd43f0cafe86444605c3bb8f2a998e1b9dbe6 Mon Sep 17 00:00:00 2001 From: it-fixcomart Date: Mon, 19 Aug 2024 11:03:58 +0700 Subject: update link lihat semua non display voucher --- src/lib/flashSale/components/FlashSaleNonDisplay.jsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/lib/flashSale/components') diff --git a/src/lib/flashSale/components/FlashSaleNonDisplay.jsx b/src/lib/flashSale/components/FlashSaleNonDisplay.jsx index 0068c98d..6e379500 100644 --- a/src/lib/flashSale/components/FlashSaleNonDisplay.jsx +++ b/src/lib/flashSale/components/FlashSaleNonDisplay.jsx @@ -13,21 +13,19 @@ import { useRouter } from 'next/router' const FlashSaleNonDisplay = () => { const [flashSales, setFlashSales] = useState(null); const [isLoading, setIsLoading] = useState(true); - const [pencarian, setPencarian] = useState(''); const router = useRouter() useEffect(() => { const loadFlashSales = async () => { const dataFlashSales = await flashSaleApi(); setFlashSales(dataFlashSales); - setPencarian(`fq=-flashsale_id_i:${dataFlashSales[0]?.pricelistId}&fq=flashsale_price_f:[1 TO *]&orderBy=flashsale-discount-desc`) setIsLoading(false); }; loadFlashSales(); }, []); const handleSubmit = () => { - router.push(`/shop/search?${pencarian}`) + router.push(`/shop/search?penawaran=${flashSales[0]?.pricelistId}`) } if (isLoading) { -- cgit v1.2.3