From 1b4d7f65ee08a56ca6cc57bfc6336ca3ccad3a21 Mon Sep 17 00:00:00 2001
From: trisusilo48 <tri.susilo@altama.co.id>
Date: Tue, 3 Dec 2024 14:42:36 +0700
Subject: update performance desktop

---
 .../components/elements/Navbar/NavbarDesktop.jsx   | 63 ++++++++++++----------
 1 file changed, 34 insertions(+), 29 deletions(-)

(limited to 'src/core/components/elements/Navbar/NavbarDesktop.jsx')

diff --git a/src/core/components/elements/Navbar/NavbarDesktop.jsx b/src/core/components/elements/Navbar/NavbarDesktop.jsx
index fa3df5bf..f4b0d5e1 100644
--- a/src/core/components/elements/Navbar/NavbarDesktop.jsx
+++ b/src/core/components/elements/Navbar/NavbarDesktop.jsx
@@ -12,12 +12,9 @@ import {
   MenuButton,
   MenuItem,
   MenuList,
-  useDisclosure
+  useDisclosure,
 } from '@chakra-ui/react';
-import {
-  ChevronDownIcon,
-  HeartIcon
-} from '@heroicons/react/24/outline';
+import { ChevronDownIcon, HeartIcon } from '@heroicons/react/24/outline';
 import dynamic from 'next/dynamic';
 import { default as Image, default as NextImage } from 'next/image';
 import { useRouter } from 'next/router';
@@ -81,21 +78,17 @@ const NavbarDesktop = () => {
     };
 
     window.addEventListener('scroll', handleScroll);
+
     return () => {
       window.removeEventListener('scroll', handleScroll);
     };
   }, []);
 
   useEffect(() => {
-    const handleScroll = () => {
-      setIsTop(window.scrollY < 100);
-    };
-
-    window.addEventListener('scroll', handleScroll);
-    return () => {
-      window.removeEventListener('scroll', handleScroll);
-    };
-  }, []);
+    if (auth) {
+      loadCart(auth.id);
+    }
+  }, [auth]);
 
   useEffect(() => {
     setPendingTransactions(data);
@@ -115,20 +108,22 @@ const NavbarDesktop = () => {
   }, [product, router]);
 
   useEffect(() => {
-    const handleCartChange = () => {
-      const cart = async () => {
-        const listCart = await getCountCart();
-        setCartCount(listCart);
-      };
-      cart();
-    };
-    handleCartChange();
-
-    window.addEventListener('localStorageChange', handleCartChange);
-
-    return () => {
-      window.removeEventListener('localStorageChange', handleCartChange);
-    };
+    // const handleCartChange = () => {
+    //   const cart = async () => {
+    //     const listCart = await getCountCart();
+    //     setCartCount(listCart);
+    //   };
+    //   cart();
+    // };
+    // handleCartChange();
+
+    setCartCount(cart?.products?.length)
+
+    // window.addEventListener('localStorageChange', handleCartChange);
+
+    // return () => {
+    //   window.removeEventListener('localStorageChange', handleCartChange);
+    // };
   }, [transactions.data, cart]);
 
   useEffect(() => {
@@ -202,7 +197,9 @@ const NavbarDesktop = () => {
               src={IndoteknikLogo}
               alt='Indoteknik Logo'
               width={210}
-              height={210 / 3}
+              height={70}
+              loading='eager'
+              priority={true}
             />
           </Link>
           <div className='flex-1 flex items-center'>
@@ -236,6 +233,7 @@ const NavbarDesktop = () => {
                 alt='Whatsapp'
                 width={48}
                 height={48}
+                loading='eager'
               />
               <div>
                 <div className='font-semibold'>Whatsapp</div>
@@ -284,6 +282,7 @@ const NavbarDesktop = () => {
                       quality={100}
                       // className={`fixed ${isTop ? 'md:top-[145px] lg:top-[160px] ' : 'lg:top-[85px] top-[80px]'} rounded-3xl md:left-1/4 lg:left-1/4 xl:left-1/4 left-2/3 w-40 h-12  p-2 z-50 transition-all duration-300 animate-pulse`}
                       className={`inline-block relative -top-8 transition-all duration-300 z-20 animate-pulse`}
+                      loading='eager'
                     />
                   </div>
                 )}
@@ -394,6 +393,7 @@ const SocialMedias = () => (
           // alt='Youtube - Indoteknik.com'
           width={24}
           height={24}
+          loading='eager'
         />
       </a>
       <a
@@ -406,6 +406,7 @@ const SocialMedias = () => (
           // alt='TikTok - Indoteknik.com'
           width={24}
           height={24}
+          loading='eager'
         />
       </a>
       {/* <a target='_blank' rel='noreferrer' href={whatsappUrl(null)}>
@@ -426,6 +427,7 @@ const SocialMedias = () => (
           // alt='Facebook - Indoteknik.com'
           width={24}
           height={24}
+          loading='eager'
         />
       </a>
       <a
@@ -438,6 +440,7 @@ const SocialMedias = () => (
           // alt='Instagram - Indoteknik.com'
           width={24}
           height={24}
+          loading='eager'
         />
       </a>
       <a
@@ -450,6 +453,7 @@ const SocialMedias = () => (
           // alt='Linkedin - Indoteknik.com'
           width={24}
           height={24}
+          loading='eager'
         />
       </a>
       <a
@@ -462,6 +466,7 @@ const SocialMedias = () => (
           // alt='Maps - Indoteknik.com'
           width={24}
           height={24}
+          loading='eager'
         />
       </a>
     </div>
-- 
cgit v1.2.3


From 57f400411555351f0b96799f5e4493c9c49b68e0 Mon Sep 17 00:00:00 2001
From: trisusilo48 <tri.susilo@altama.co.id>
Date: Tue, 3 Dec 2024 15:38:11 +0700
Subject: update performance

---
 src/core/components/elements/Navbar/NavbarDesktop.jsx | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

(limited to 'src/core/components/elements/Navbar/NavbarDesktop.jsx')

diff --git a/src/core/components/elements/Navbar/NavbarDesktop.jsx b/src/core/components/elements/Navbar/NavbarDesktop.jsx
index f4b0d5e1..7d6d8c9e 100644
--- a/src/core/components/elements/Navbar/NavbarDesktop.jsx
+++ b/src/core/components/elements/Navbar/NavbarDesktop.jsx
@@ -387,10 +387,11 @@ const SocialMedias = () => (
         target='_blank'
         rel='noreferrer'
         href='https://www.youtube.com/@indoteknikcom'
+        aria-label='Youtube - Indoteknik.com'
       >
         <NextImage
           src='/images/socials/youtube.webp'
-          // alt='Youtube - Indoteknik.com'
+          alt='Ytube'
           width={24}
           height={24}
           loading='eager'
@@ -400,10 +401,11 @@ const SocialMedias = () => (
         target='_blank'
         rel='noreferrer'
         href='https://www.tiktok.com/@indoteknikcom'
+        aria-label='TikTok - Indoteknik.com'
       >
         <NextImage
           src='/images/socials/tiktok.png'
-          // alt='TikTok - Indoteknik.com'
+          alt='TikTok'
           width={24}
           height={24}
           loading='eager'
@@ -421,10 +423,11 @@ const SocialMedias = () => (
         target='_blank'
         rel='noreferrer'
         href='https://www.facebook.com/indoteknikcom'
+        aria-label='Facebook - Indoteknik.com'
       >
         <NextImage
           src='/images/socials/Facebook.png'
-          // alt='Facebook - Indoteknik.com'
+          alt='FB'
           width={24}
           height={24}
           loading='eager'
@@ -434,10 +437,11 @@ const SocialMedias = () => (
         target='_blank'
         rel='noreferrer'
         href='https://www.instagram.com/indoteknikcom/'
+        aria-label='Instagram - Indoteknik.com'
       >
         <NextImage
           src='/images/socials/Instagram.png'
-          // alt='Instagram - Indoteknik.com'
+          alt='IG'
           width={24}
           height={24}
           loading='eager'
@@ -447,10 +451,11 @@ const SocialMedias = () => (
         target='_blank'
         rel='noreferrer'
         href='https://www.linkedin.com/company/pt-indoteknik-dotcom-gemilang/'
+        aria-label='Linkedin - Indoteknik.com'
       >
         <NextImage
           src='/images/socials/Linkedin.png'
-          // alt='Linkedin - Indoteknik.com'
+          alt='Linkedin'
           width={24}
           height={24}
           loading='eager'
@@ -460,10 +465,11 @@ const SocialMedias = () => (
         target='_blank'
         rel='noreferrer'
         href='https://goo.gl/maps/GF8EmDjpQTHZPsJ1A'
+        aria-label='Maps - Indoteknik.com'
       >
         <NextImage
           src='/images/socials/g_maps.png'
-          // alt='Maps - Indoteknik.com'
+          alt='Maps'
           width={24}
           height={24}
           loading='eager'
-- 
cgit v1.2.3


From 4c8d08def514cb441007c0bd2bc78e105e6d0153 Mon Sep 17 00:00:00 2001
From: trisusilo48 <tri.susilo@altama.co.id>
Date: Wed, 4 Dec 2024 11:50:21 +0700
Subject: cr popup information method

---
 src/core/components/elements/Navbar/NavbarDesktop.jsx | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

(limited to 'src/core/components/elements/Navbar/NavbarDesktop.jsx')

diff --git a/src/core/components/elements/Navbar/NavbarDesktop.jsx b/src/core/components/elements/Navbar/NavbarDesktop.jsx
index 7d6d8c9e..253a2b03 100644
--- a/src/core/components/elements/Navbar/NavbarDesktop.jsx
+++ b/src/core/components/elements/Navbar/NavbarDesktop.jsx
@@ -192,7 +192,7 @@ const NavbarDesktop = () => {
 
       <nav className='pt-6 sticky top-0 z-50 bg-white border-b-2 border-danger-500'>
         <div className='container mx-auto flex gap-x-6'>
-          <Link href='/'>
+          <Link href='/' aria-label='Indoteknik Logo'>
             <Image
               src={IndoteknikLogo}
               alt='Indoteknik Logo'
@@ -217,6 +217,7 @@ const NavbarDesktop = () => {
               target='_blank'
               rel='noreferrer'
               href='/my/wishlist'
+              aria-label='Wishlist'
               className='flex items-center gap-x-2 !text-gray_r-12/80'
             >
               <HeartIcon className='w-7' />
@@ -224,6 +225,7 @@ const NavbarDesktop = () => {
             </Link>
             <a
               href={whatsappUrl(templateWA, payloadWA, urlPath)}
+              aria-label='Whatsapp'
               target='_blank'
               rel='noreferrer'
               className='flex items-center gap-x-1 !text-gray_r-12/80'
@@ -266,6 +268,7 @@ const NavbarDesktop = () => {
             <div className='w-6/12 flex px-1 divide-x divide-gray_r-6'>
               <Link
                 href='/shop/promo'
+                aria-label='Promo'
                 className={`${
                   router.asPath === '/shop/promo' && 'bg-gray_r-3'
                 }  flex-1 flex justify-center items-center !text-gray_r-12/80 hover:bg-gray_r-3 idt-transition group relative`} // Added relative position
@@ -300,6 +303,7 @@ const NavbarDesktop = () => {
 
               <Link
                 href='/shop/brands'
+                aria-label='Brand'
                 className={`${
                   router.asPath === '/shop/brands' && 'bg-gray_r-3'
                 } p-4 flex-1 flex justify-center items-center !text-gray_r-12/80 hover:bg-gray_r-3 idt-transition group`}
@@ -312,6 +316,7 @@ const NavbarDesktop = () => {
               </Link>
               <Link
                 href='/shop/search?orderBy=stock'
+                aria-label='Ready Stock'
                 className={`${
                   router.asPath.includes('/shop/search?orderBy=stock') &&
                   'bg-gray_r-3'
@@ -325,6 +330,7 @@ const NavbarDesktop = () => {
               </Link>
               <Link
                 href='https://blog.indoteknik.com/'
+                aria-label='Blog Indoteknik'
                 className='p-4 flex-1 flex justify-center items-center !text-gray_r-12/80 hover:bg-gray_r-3 idt-transition group'
                 target='_blank'
                 rel='noreferrer noopener'
@@ -348,12 +354,14 @@ const NavbarDesktop = () => {
                 <>
                   <Link
                     href='/login'
+                    aria-label='Login'
                     className='flex-1 flex justify-center items-center bg-danger-500 !text-gray_r-1 rounded-none rounded-t-xl'
                   >
                     Masuk
                   </Link>
                   <Link
                     href='/register'
+                    aria-label='Register'
                     className='flex-1 flex justify-center items-center bg-danger-500 !text-gray_r-1 rounded-none rounded-t-xl'
                   >
                     Daftar
@@ -362,7 +370,7 @@ const NavbarDesktop = () => {
               )}
               {auth && (
                 <>
-                  <div href='/' className='navbar-user-dropdown-button'>
+                  <div href='/' className='navbar-user-dropdown-button' aria-label='User'>
                     <span>Halo, {auth?.name}</span>
                     <div className='ml-auto'>
                       <ChevronDownIcon className='w-6' />
-- 
cgit v1.2.3

