From 9c2c365da1edb2e2835d19303cdee81e53f3deb8 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Mon, 10 Apr 2023 14:43:30 +0700 Subject: fix reset password, register, search, suggest --- src/lib/product/components/Product/ProductDesktop.jsx | 2 +- src/lib/product/components/Product/ProductMobile.jsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/lib/product') diff --git a/src/lib/product/components/Product/ProductDesktop.jsx b/src/lib/product/components/Product/ProductDesktop.jsx index faff375f..37a258a6 100644 --- a/src/lib/product/components/Product/ProductDesktop.jsx +++ b/src/lib/product/components/Product/ProductDesktop.jsx @@ -75,7 +75,7 @@ const ProductDesktop = ({ product, wishlist, toggleWishlist }) => { } const productSimilarQuery = [ - product?.name.replace(/[()/"&]/g, ''), + product?.name, `fq=-product_id_i:${product.id}`, `fq=-manufacture_id_i:${product.manufacture?.id || 0}` ].join('&') diff --git a/src/lib/product/components/Product/ProductMobile.jsx b/src/lib/product/components/Product/ProductMobile.jsx index 493fcbf7..19b4c4b2 100644 --- a/src/lib/product/components/Product/ProductMobile.jsx +++ b/src/lib/product/components/Product/ProductMobile.jsx @@ -96,7 +96,7 @@ const ProductMobile = ({ product, wishlist, toggleWishlist }) => { } const productSimilarQuery = [ - product?.name.replace(/[()/"&]/g, ''), + product?.name, `fq=-product_id_i:${product.id}`, `fq=-manufacture_id_i:${product.manufacture?.id || 0}` ].join('&') -- cgit v1.2.3 From 8dea9e9242aca8bf003a7c2f69c96abafbf77e6d Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Mon, 10 Apr 2023 16:29:48 +0700 Subject: page loader --- src/lib/product/components/ProductCard.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/lib/product') diff --git a/src/lib/product/components/ProductCard.jsx b/src/lib/product/components/ProductCard.jsx index f85a0b03..a1c30d00 100644 --- a/src/lib/product/components/ProductCard.jsx +++ b/src/lib/product/components/ProductCard.jsx @@ -39,8 +39,8 @@ const ProductCard = ({ product, simpleTitle, variant = 'vertical' }) => { )} {product?.name} -- cgit v1.2.3 From 62bebc1d33fd090d7666e18e7a0326ef7ef36897 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Mon, 10 Apr 2023 16:49:16 +0700 Subject: fix --- src/lib/product/components/Product/ProductDesktop.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/lib/product') diff --git a/src/lib/product/components/Product/ProductDesktop.jsx b/src/lib/product/components/Product/ProductDesktop.jsx index 751c0014..f926f171 100644 --- a/src/lib/product/components/Product/ProductDesktop.jsx +++ b/src/lib/product/components/Product/ProductDesktop.jsx @@ -170,7 +170,7 @@ const ProductDesktop = ({ product, wishlist, toggleWishlist }) => { Lihat Varian ) : ( - +
{ > Beli - +
)}
-- cgit v1.2.3 From 92c2a229d9c9b510d71b928978872a8b107e9d5a Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Tue, 11 Apr 2023 09:47:25 +0700 Subject: Documentation and refactor code --- src/lib/product/api/productSearchApi.js | 4 +++- .../product/components/Product/ProductMobile.jsx | 8 +++++--- src/lib/product/components/ProductFilter.jsx | 22 ++++------------------ src/lib/product/components/ProductSearch.jsx | 14 ++++++++------ src/lib/product/components/ProductSlider.jsx | 10 ++-------- 5 files changed, 22 insertions(+), 36 deletions(-) (limited to 'src/lib/product') diff --git a/src/lib/product/api/productSearchApi.js b/src/lib/product/api/productSearchApi.js index f626e8cc..71fb72e6 100644 --- a/src/lib/product/api/productSearchApi.js +++ b/src/lib/product/api/productSearchApi.js @@ -2,7 +2,9 @@ import _ from 'lodash-contrib' import axios from 'axios' const productSearchApi = async ({ query }) => { - const dataProductSearch = await axios(`${process.env.NEXT_PUBLIC_SELF_HOST}/api/shop/search?${query}&operation=OR`) + const dataProductSearch = await axios( + `${process.env.NEXT_PUBLIC_SELF_HOST}/api/shop/search?${query}&operation=OR` + ) return dataProductSearch.data } diff --git a/src/lib/product/components/Product/ProductMobile.jsx b/src/lib/product/components/Product/ProductMobile.jsx index 19b4c4b2..1194419e 100644 --- a/src/lib/product/components/Product/ProductMobile.jsx +++ b/src/lib/product/components/Product/ProductMobile.jsx @@ -130,9 +130,11 @@ const ProductMobile = ({ product, wishlist, toggleWishlist }) => {

{activeVariant?.name}

- {product.variants.length > 1 && activeVariant.price.priceDiscount > 0 && !selectedVariant && ( -
Harga mulai dari:
- )} + {product.variants.length > 1 && + activeVariant.price.priceDiscount > 0 && + !selectedVariant && ( +
Harga mulai dari:
+ )} {activeVariant?.price?.discountPercentage > 0 && (
diff --git a/src/lib/product/components/ProductFilter.jsx b/src/lib/product/components/ProductFilter.jsx index be1edd18..34357526 100644 --- a/src/lib/product/components/ProductFilter.jsx +++ b/src/lib/product/components/ProductFilter.jsx @@ -35,11 +35,7 @@ const ProductFilter = ({ active, close, brands, categories, prefixUrl, defaultBr } return ( - +
{!defaultBrand && (
@@ -52,10 +48,7 @@ const ProductFilter = ({ active, close, brands, categories, prefixUrl, defaultBr > {brands.map((brand, index) => ( - ))} @@ -72,10 +65,7 @@ const ProductFilter = ({ active, close, brands, categories, prefixUrl, defaultBr > {categories.map((category, index) => ( - ))} @@ -117,11 +107,7 @@ const ProductFilter = ({ active, close, brands, categories, prefixUrl, defaultBr />
-
diff --git a/src/lib/product/components/ProductSearch.jsx b/src/lib/product/components/ProductSearch.jsx index 0010a88a..81e7948b 100644 --- a/src/lib/product/components/ProductSearch.jsx +++ b/src/lib/product/components/ProductSearch.jsx @@ -26,13 +26,15 @@ const ProductSearch = ({ query, prefixUrl, defaultBrand = null }) => { ) const productStart = productSearch.data?.responseHeader.params.start const productRows = productSearch.data?.responseHeader.params.rows - const productFound = productSearch.data?.response.numFound - - const brands = productSearch.data?.facetCounts?.facetFields?.manufactureName?.filter((value, index) => { - if (index % 2 === 0) { - return true + const productFound = productSearch.data?.response.numFound + + const brands = productSearch.data?.facetCounts?.facetFields?.manufactureName?.filter( + (value, index) => { + if (index % 2 === 0) { + return true + } } - }) + ) const categories = productSearch.data?.facetCounts?.facetFields?.categoryName?.filter( (value, index) => { if (index % 2 === 0) { diff --git a/src/lib/product/components/ProductSlider.jsx b/src/lib/product/components/ProductSlider.jsx index ed7db486..c8bd3a82 100644 --- a/src/lib/product/components/ProductSlider.jsx +++ b/src/lib/product/components/ProductSlider.jsx @@ -44,18 +44,12 @@ const ProductSlider = ({ products, simpleTitle = false, bannerMode = false }) => > {bannerMode && ( - + )} {products?.products?.map((product, index) => ( - + ))} -- cgit v1.2.3