From ebe159fc10e4c774ae1bd6aafa772f39618ca372 Mon Sep 17 00:00:00 2001
From: it-fixcomart <it@fixcomart.co.id>
Date: Fri, 9 Aug 2024 17:13:04 +0700
Subject: <iman> back to original

---
 src/pages/index.jsx | 53 ++++++++++++-----------------------------------------
 1 file changed, 12 insertions(+), 41 deletions(-)

(limited to 'src/pages/index.jsx')

diff --git a/src/pages/index.jsx b/src/pages/index.jsx
index cfda03ea..4493fe31 100644
--- a/src/pages/index.jsx
+++ b/src/pages/index.jsx
@@ -1,5 +1,6 @@
 import dynamic from 'next/dynamic';
-import { useEffect, useRef, useState } from 'react';
+import { useRef } from 'react';
+
 import { HeroBannerSkeleton } from '@/components/skeleton/BannerSkeleton';
 import { PopularProductSkeleton } from '@/components/skeleton/PopularProductSkeleton';
 import Seo from '@/core/components/Seo';
@@ -11,10 +12,8 @@ import PreferredBrandSkeleton from '@/lib/home/components/Skeleton/PreferredBran
 import BannerPromoSkeleton from '@/lib/home/components/Skeleton/BannerPromoSkeleton';
 import PromotinProgram from '@/lib/promotinProgram/components/HomePage';
 import PagePopupIformation from '~/modules/popup-information';
-import CategoryPilihan from '../lib/home/components/CategoryPilihan';
-import odooApi from '@/core/api/odooApi';
+import useProductDetail from '~/modules/product-detail/stores/useProductDetail';
 import { getAuth } from '~/libs/auth';
-// import { getAuth } from '~/libs/auth';
 
 const BasicLayout = dynamic(() =>
   import('@/core/components/layouts/BasicLayout')
@@ -46,9 +45,12 @@ const FlashSale = dynamic(
   }
 );
 
-// const ProgramPromotion = dynamic(() =>
-//   import('@/lib/home/components/PromotionProgram')
-// );
+const ProgramPromotion = dynamic(() =>
+  import('@/lib/home/components/PromotionProgram'),
+{
+  loading: () => <BannerPromoSkeleton />,
+}
+);
 
 const BannerSection = dynamic(() =>
   import('@/lib/home/components/BannerSection')
@@ -56,23 +58,12 @@ const BannerSection = dynamic(() =>
 const CategoryHomeId = dynamic(() =>
   import('@/lib/home/components/CategoryHomeId')
 );
-
-const CategoryDynamic = dynamic(() =>
-  import('@/lib/home/components/CategoryDynamic')
-);
-
-const CategoryDynamicMobile = dynamic(() =>
-import('@/lib/home/components/CategoryDynamicMobile')
-);
-
 const CustomerReviews = dynamic(() =>
   import('@/lib/review/components/CustomerReviews')
 );
 const ServiceList = dynamic(() => import('@/lib/home/components/ServiceList'));
 
-
-
-export default function Home({categoryId}) {
+export default function Home() {
   const bannerRef = useRef(null);
   const wrapperRef = useRef(null);
 
@@ -83,18 +74,6 @@ export default function Home({categoryId}) {
       bannerRef.current?.querySelector(':first-child')?.clientHeight + 'px';
   };
 
-  useEffect(() => {
-    const loadCategories = async () => {
-     const getCategories = await odooApi('GET', '/api/v1/category/child?partner_id='+{categoryId})
-     if(getCategories){
-      setDataCategories(getCategories)
-     }
-    }
-    loadCategories()
-  }, [])
-
-  const [dataCategories, setDataCategories] = useState([])
-
   return (
     <BasicLayout>
       <Seo
@@ -131,7 +110,6 @@ export default function Home({categoryId}) {
             </div>
           </div>
 
-          <div className='my-16 flex flex-col gap-y-8'>
           <div className='my-16 flex flex-col gap-y-8'>
             <ServiceList />
             <div id='flashsale'>
@@ -148,13 +126,10 @@ export default function Home({categoryId}) {
               </>
             )}
             <PromotinProgram />
-            <CategoryPilihan categories={dataCategories}/>
-            <CategoryDynamic/>
             <CategoryHomeId />
             <BannerSection />
             <CustomerReviews />
           </div>
-          </div>
         </div>
       </DesktopView>
 
@@ -162,7 +137,7 @@ export default function Home({categoryId}) {
         <DelayRender renderAfter={200}>
           <HeroBanner />
         </DelayRender>
-        <div className='flex flex-col gap-y-4 my-6'>
+        <div className='flex flex-col gap-y-12 my-6'>
           <DelayRender renderAfter={400}>
             <ServiceList />
           </DelayRender>
@@ -174,7 +149,7 @@ export default function Home({categoryId}) {
           {!auth?.feature?.soApproval && (
             <>
               <DelayRender renderAfter={400}>
-                {/* <ProgramPromotion /> */}
+                <ProgramPromotion />
               </DelayRender>
               <DelayRender renderAfter={600}>
                 <FlashSale />
@@ -184,10 +159,6 @@ export default function Home({categoryId}) {
           <DelayRender renderAfter={600}>
             <PromotinProgram />
           </DelayRender>
-          <DelayRender renderAfter={600}>
-            <CategoryPilihan categories={dataCategories}/>
-            <CategoryDynamicMobile/>
-          </DelayRender>
           <DelayRender renderAfter={800}>
             <PopularProduct />
           </DelayRender>
-- 
cgit v1.2.3

