diff options
Diffstat (limited to 'src/pages/index.jsx')
| -rw-r--r-- | src/pages/index.jsx | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/src/pages/index.jsx b/src/pages/index.jsx index c097530c..8af963fb 100644 --- a/src/pages/index.jsx +++ b/src/pages/index.jsx @@ -11,6 +11,8 @@ import { FlashSaleSkeleton } from '@/lib/flashSale/skeleton/FlashSaleSkeleton'; import PreferredBrandSkeleton from '@/lib/home/components/Skeleton/PreferredBrandSkeleton'; import PromotinProgram from '@/lib/promotinProgram/components/HomePage'; import PagePopupIformation from '~/modules/popup-information'; +import useProductDetail from '~/modules/product-detail/stores/useProductDetail'; +import { getAuth } from '~/libs/auth'; const BasicLayout = dynamic(() => import('@/core/components/layouts/BasicLayout') @@ -41,6 +43,11 @@ const FlashSale = dynamic( loading: () => <FlashSaleSkeleton />, } ); + +const ProgramPromotion = dynamic(() => + import('@/lib/home/components/PromotionProgram') +); + const BannerSection = dynamic(() => import('@/lib/home/components/BannerSection') ); @@ -56,6 +63,8 @@ export default function Home() { const bannerRef = useRef(null); const wrapperRef = useRef(null); + const auth = getAuth(); + const handleOnLoad = () => { wrapperRef.current.style.height = bannerRef.current?.querySelector(':first-child')?.clientHeight + 'px'; @@ -97,12 +106,16 @@ export default function Home() { </div> </div> - <div className='my-16 flex flex-col gap-y-16'> + <div className='my-16 flex flex-col gap-y-8'> <ServiceList /> <div id='flashsale'> <PreferredBrand /> </div> - <FlashSale /> + {!auth?.feature?.soApproval && ( + <> + <ProgramPromotion /> <FlashSale /> + </> + )} <PromotinProgram /> <CategoryHomeId /> <BannerSection /> @@ -124,9 +137,16 @@ export default function Home() { <PreferredBrand /> </div> </DelayRender> - <DelayRender renderAfter={600}> - <FlashSale /> - </DelayRender> + {!auth?.feature?.soApproval && ( + <> + <DelayRender renderAfter={400}> + <ProgramPromotion /> + </DelayRender> + <DelayRender renderAfter={600}> + <FlashSale /> + </DelayRender> + </> + )} <DelayRender renderAfter={600}> <PromotinProgram /> </DelayRender> |
