summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src-migrate/modules/popup-information/index.tsx6
-rw-r--r--src/components/ui/HeroBanner.jsx4
-rw-r--r--src/pages/index.jsx18
3 files changed, 18 insertions, 10 deletions
diff --git a/src-migrate/modules/popup-information/index.tsx b/src-migrate/modules/popup-information/index.tsx
index 5acdb068..d50711cc 100644
--- a/src-migrate/modules/popup-information/index.tsx
+++ b/src-migrate/modules/popup-information/index.tsx
@@ -5,6 +5,7 @@ import Image from 'next/image';
import Link from 'next/link';
import { Modal } from '~/components/ui/modal';
import { getAuth } from '~/libs/auth';
+import dynamic from 'next/dynamic';
const PagePopupInformation = () => {
const router = useRouter();
@@ -12,6 +13,8 @@ const PagePopupInformation = () => {
const auth = getAuth();
const [active, setActive] = useState<boolean>(false);
const [data, setData] = useState<any>(null);
+ const [loading, setLoading] = useState(true);
+
useEffect(() => {
const getData = async () => {
@@ -20,6 +23,7 @@ const PagePopupInformation = () => {
if (data) {
setData(data);
}
+ setLoading(false);
};
if (isHomePage && !auth) {
@@ -29,7 +33,7 @@ const PagePopupInformation = () => {
}, [isHomePage, auth]);
return (
<div className='group'>
- {data && (
+ {data && !loading && (
<Modal
active={active}
className='!w-fit !bg-transparent !border-none overflow-hidden'
diff --git a/src/components/ui/HeroBanner.jsx b/src/components/ui/HeroBanner.jsx
index 6f1ef641..d5ff6247 100644
--- a/src/components/ui/HeroBanner.jsx
+++ b/src/components/ui/HeroBanner.jsx
@@ -55,16 +55,16 @@ const HeroBanner = () => {
return heroBanner.map((banner, index) => (
<SwiperSlide key={index}>
- <Link href={banner.url} className='w-full h-auto' aria-label={banner.name}>
+ <Link href={banner?.url} aria-label={banner.name}>
<Image
src={banner.image}
alt={banner.name}
width={1152}
height={768}
- loading='eager'
placeholder='blur'
blurDataURL='/images/indoteknik-placeholder.png'
sizes='(max-width: 768px) 100vw, 50vw'
+ priority={true}
/>
</Link>
</SwiperSlide>
diff --git a/src/pages/index.jsx b/src/pages/index.jsx
index e685b382..fce2202a 100644
--- a/src/pages/index.jsx
+++ b/src/pages/index.jsx
@@ -1,23 +1,27 @@
import { HeroBannerSkeleton } from '@/components/skeleton/BannerSkeleton';
import { PopularProductSkeleton } from '@/components/skeleton/PopularProductSkeleton';
-import odooApi from '@/core/api/odooApi';
import Seo from '@/core/components/Seo';
import DelayRender from '@/core/components/elements/DelayRender/DelayRender';
import DesktopView from '@/core/components/views/DesktopView';
import MobileView from '@/core/components/views/MobileView';
-import { FlashSaleSkeleton } from '@/lib/flashSale/skeleton/FlashSaleSkeleton';
-import BannerPromoSkeleton from '@/lib/home/components/Skeleton/BannerPromoSkeleton';
import PreferredBrandSkeleton from '@/lib/home/components/Skeleton/PreferredBrandSkeleton';
import dynamic from 'next/dynamic';
-import { useEffect, useRef, useState } from 'react';
+import { useRef } from 'react';
import { getAuth } from '~/libs/auth';
-import PagePopupIformation from '~/modules/popup-information'; // need change to dynamic and ssr : false
-import CategoryPilihan from '../lib/home/components/CategoryPilihan';
-// import { getAuth } from '~/libs/auth';
const BasicLayout = dynamic(() =>
import('@/core/components/layouts/BasicLayout')
);
+
+const PagePopupIformation = dynamic(() =>
+ import('~/modules/popup-information'), {
+ ssr: false
+ }
+);
+
+const CategoryPilihan = dynamic(() =>
+ import('../lib/home/components/CategoryPilihan')
+);
const HeroBanner = dynamic(() => import('@/components/ui/HeroBanner'), {
loading: () => <HeroBannerSkeleton />,
});