From 4310c68248520d265879fbc0a2fc094f7f3e3b52 Mon Sep 17 00:00:00 2001
From: "HATEC\\SPVDEV001" <tri.susilo@altama.co.id>
Date: Fri, 20 Oct 2023 15:06:08 +0700
Subject: feedback testing - filter by brand (ada brand lain yang ikut)

---
 src/lib/product/components/ProductSearch.jsx | 35 +++++++++++++++-------------
 1 file changed, 19 insertions(+), 16 deletions(-)

(limited to 'src/lib/product/components/ProductSearch.jsx')

diff --git a/src/lib/product/components/ProductSearch.jsx b/src/lib/product/components/ProductSearch.jsx
index 630e3a74..d094a25b 100644
--- a/src/lib/product/components/ProductSearch.jsx
+++ b/src/lib/product/components/ProductSearch.jsx
@@ -28,7 +28,7 @@ const ProductSearch = ({ query, prefixUrl, defaultBrand = null, brand = null })
   if (defaultBrand) query.brand = defaultBrand.toLowerCase()
   const { productSearch } = useProductSearch({
     query: { ...query, q, limit, orderBy },
-    operation: router?.pathname?.includes('brands') ? 'OR' : 'AND'
+    operation: 'OR' 
   })
   const [products, setProducts] = useState(null)
   const [spellings, setSpellings] = useState(null)
@@ -295,21 +295,24 @@ const ProductSearch = ({ query, prefixUrl, defaultBrand = null, brand = null })
       <DesktopView>
         <div className='container mx-auto flex mb-3'>
           <div className='w-3/12'>
-            <div className='p-4'>
-              <div className='text-caption-1 text-gray_r-11 mb-2'>Produk dari brand:</div>
-              {brand?.data?.logo && (
-                <Image
-                  src={brand?.data?.logo}
-                  alt={brand?.data?.name}
-                  className='w-32 p-2 border borde-gray_r-6 rounded'
-                />
-              )}
-              {!brand?.data?.logo && (
-                <div className='bg-danger-500 text-white text-center text-body-1 py-2 px-4 rounded w-fit'>
-                  {brand?.data?.name}
-                </div>
-              )}
-            </div>
+            {brand && (
+              <div className='p-4'>
+                <div className='text-caption-1 text-gray_r-11 mb-2'>Produk dari brand:</div>
+                {brand?.data?.logo && (
+                  <Image
+                    src={brand?.data?.logo}
+                    alt={brand?.data?.name}
+                    className='w-32 p-2 border borde-gray_r-6 rounded'
+                  />
+                )}
+                {!brand?.data?.logo && (
+                  <div className='bg-danger-500 text-white text-center text-body-1 py-2 px-4 rounded w-fit'>
+                    {brand?.data?.name}
+                  </div>
+                )}
+              </div>
+            )}
+
             <ProductFilterDesktop
               brands={brands || []}
               categories={categories || []}
-- 
cgit v1.2.3

