From 8fe0cdf1f457148eb39d5438b13bbec7bc912976 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Wed, 31 Jul 2024 08:59:17 +0700
Subject: <iman> update category management

---
 src/lib/home/components/CategoryDynamic.jsx | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

(limited to 'src/lib/home/components/CategoryDynamic.jsx')

diff --git a/src/lib/home/components/CategoryDynamic.jsx b/src/lib/home/components/CategoryDynamic.jsx
index 60e01df0..f2d1a16f 100644
--- a/src/lib/home/components/CategoryDynamic.jsx
+++ b/src/lib/home/components/CategoryDynamic.jsx
@@ -18,14 +18,10 @@ const CategoryDynamic = () => {
         const updatedSubCategoryData = {};
         
         for (const category of categoryManagement.data) {
-          // Calculate level 1 products
           const countLevel1 = await odooApi('GET', `/api/v1/category/numFound?parent_id=${category.categoryIdI}`);
-          // console.log("countLevel1.child",countLevel1)
           
           updatedCategoryData[category.categoryIdI] = countLevel1?.numFound;
           
-          
-          // Calculate level 2 products for each sub-category
           for (const subCategory of countLevel1.children) {
             updatedSubCategoryData[subCategory.id] = subCategory.numFound;
           }
@@ -50,9 +46,9 @@ const CategoryDynamic = () => {
             <div key={category.id}>
               <div className='bagian-judul flex flex-row justify-start items-center gap-3 mb-4 mt-4'>
                 <div className='font-semibold sm:text-h-lg mr-2'>{category.name}</div>
-                <p className={`text-gray_r-10 text-sm ${countLevel1 === 0 ? 'animate-pulse ' : ''}`}>
-                  {countLevel1 === 0 ? 'Menghitung jumlah produk...' : `${countLevel1} Produk tersedia`}
-              </p>
+                <Skeleton isLoaded={countLevel1 !=0}>
+                  <p className={`text-gray_r-10 text-sm`}>{countLevel1} Produk tersedia</p>
+                </Skeleton>
                 <Link href={createSlug('/shop/category/', category?.name, category?.categoryIdI)} className="!text-red-500 font-semibold">Lihat Semua</Link>
               </div>
               <div className='grid grid-cols-3 gap-2'>
@@ -72,9 +68,6 @@ const CategoryDynamic = () => {
                           />
                           <div className='bagian-judul flex flex-col justify-center items-start gap-2 ml-2'>
                             <div className='font-semibold text-lg mr-2'>{subCategory.name}</div>
-                            {/* <p className={`text-gray_r-10 text-sm ${countLevel2 === 0 ? 'animate-pulse ' : ''}`}>
-                              {countLevel2 === 0 ? 'Menghitung jumlah produk...' : `${countLevel2} Produk tersedia`}
-                            </p> */}
                             <Skeleton isLoaded={countLevel2 != 0}>
                             <p className={`text-gray_r-10 text-sm`}>
                               {countLevel2} Produk tersedia
-- 
cgit v1.2.3

