From 5e2a8d315fa0bc58a18d4df5a995e402388995c9 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Thu, 22 Aug 2024 13:10:29 +0700
Subject: <iman> update category dropdown

---
 src/lib/category/components/Category.jsx | 30 +++---------------------------
 1 file changed, 3 insertions(+), 27 deletions(-)

(limited to 'src/lib/category/components/Category.jsx')

diff --git a/src/lib/category/components/Category.jsx b/src/lib/category/components/Category.jsx
index 374cdf78..f76e6e42 100644
--- a/src/lib/category/components/Category.jsx
+++ b/src/lib/category/components/Category.jsx
@@ -15,7 +15,6 @@ const Category = () => {
   const [banner, setBanner] = useState([]);
 
   const promotionProgram = useQuery('banner-promo-category-card', bannerApi({ type: 'banner-promo-category-card' }));
-  // const promotionProgram = useQuery('promotionProgram', bannerApi({ type: 'banner-promotion' }));
   
   useEffect(() => {
     const loadCategories = async () => {
@@ -36,28 +35,6 @@ const Category = () => {
     }
     loadCategories()
   }, [])
-
-  // useEffect(() => {
-  //   const loadCategories = async () => {
-  //     let dataCategories = await odooApi('GET', '/api/v1/category/tree')
-  //     dataCategories = dataCategories?.map((category) => {
-  //       category.childs = category.childs.map((child1Category) => {
-  //         return {
-  //           ...child1Category,
-  //           isOpen: false
-  //         }
-  //       })
-  //       return {
-  //         ...category,
-  //         isOpen: false
-  //       }
-  //     })
-  //     setCategories(dataCategories)
-  //   }
-  //   loadCategories()
-  // }, [])
-  // console.log("categories",categories)
-
   return (
     <DesktopView>
       <div className='category-mega-box'>
@@ -67,8 +44,8 @@ const Category = () => {
               href={createSlug('/shop/category/', category.name, category.id)}
               className='category-mega-box__parent flex items-center'
             >
-              <div className='w-6 h-6 border mr-2 rounded-full flex justify-center items-center'>
-                <Image src={category.image} alt='' width={16} height={16} />
+              <div className='mr-2  flex justify-center items-center'>
+                <Image src={category.image} alt='' width={25} height={25} />
               </div>
               {category.name}
             </Link>
@@ -111,9 +88,8 @@ const Category = () => {
               </div>
               <div className='category-mega-box__child-wrapper !w-[260px] !flex !flex-col !gap-4'>
               <PopularBrand category={category} />
-              {promotionProgram?.data[0]?.map((banner, index)=>(
+              {Array.isArray(promotionProgram?.data) && promotionProgram?.data.length > 0 && promotionProgram?.data[0]?.map((banner, index) => (
                 <div key={index} className='flex w-60 h-20 object-cover'>
-                  {/* <Image src='https://erp.indoteknik.com/api/image/x_banner.banner/x_banner_image/397' alt='' width={275} height={4} /> */}
                   <Image src={`${banner.image}`} alt={`${banner.name}`} width={275} height={4} />
                 </div>
               ))}
-- 
cgit v1.2.3

