diff options
| author | Mqdd <ahmadmiqdad27@gmail.com> | 2025-11-26 14:56:36 +0700 |
|---|---|---|
| committer | Mqdd <ahmadmiqdad27@gmail.com> | 2025-11-26 14:56:36 +0700 |
| commit | adc316e70faf20ea375b3e590998a36997b6b6e2 (patch) | |
| tree | 8a98f7cdebda18046dc10858a14d1d2e49759bd1 /src/core/components | |
| parent | c472261f34388a0b76c3e21fec494b8d5f304715 (diff) | |
<Miqdad> balikin
Diffstat (limited to 'src/core/components')
| -rw-r--r-- | src/core/components/layouts/BasicLayout.jsx | 44 |
1 files changed, 13 insertions, 31 deletions
diff --git a/src/core/components/layouts/BasicLayout.jsx b/src/core/components/layouts/BasicLayout.jsx index b13e807d..19e2c580 100644 --- a/src/core/components/layouts/BasicLayout.jsx +++ b/src/core/components/layouts/BasicLayout.jsx @@ -7,15 +7,12 @@ import { useProductContext } from '@/contexts/ProductContext'; import odooApi from '@/core/api/odooApi'; import whatsappUrl from '@/core/utils/whatsappUrl'; import Navbar from '../elements/Navbar/Navbar'; -import styles from './BasicLayout.module.css'; // Import modul CSS +import styles from './BasicLayout.module.css'; import useDevice from '@/core/hooks/useDevice'; -const AnimationLayout = dynamic(() => import('./AnimationLayout'), { - ssr: false, -}); -const BasicFooter = dynamic(() => import('../elements/Footer/BasicFooter'), { - ssr: false, -}); +// ❌ JANGAN dynamic UNTUK LAYOUT +import AnimationLayout from './AnimationLayout'; +import BasicFooter from '../elements/Footer/BasicFooter'; const BasicLayout = ({ children }) => { const [templateWA, setTemplateWA] = useState(null); @@ -27,7 +24,6 @@ const BasicLayout = ({ children }) => { const [isProductPage, setIsProductPage] = useState(false); const { isDesktop, isMobile } = useDevice(); - const router = useRouter(); const buttonRef = useRef(null); @@ -44,11 +40,10 @@ const BasicLayout = ({ children }) => { ) { setPayloadWa({ name: product?.name, - manufacture: product?.manufacture.name, + manufacture: product?.manufacture?.name, url: process.env.NEXT_PUBLIC_SELF_HOST + router.asPath, }); setTemplateWA('product'); - setUrlPath(router.asPath); } if (router.pathname.includes('/shop/product/')) { @@ -69,25 +64,17 @@ const BasicLayout = ({ children }) => { }; window.addEventListener('mouseout', handleMouseOut); - - return () => { - window.removeEventListener('mouseout', handleMouseOut); - }; + return () => window.removeEventListener('mouseout', handleMouseOut); }, []); useEffect(() => { if (highlight) { - // Set wobble animation after overlay highlight animation completes - const timer = setTimeout(() => setWobble(true), 1000); // Adjust timing if needed + const timer = setTimeout(() => setWobble(true), 1000); return () => clearTimeout(timer); } }, [highlight]); - const recordActivity = async (pathname) => { - const ONLY_ON_PATH = false; - const recordedPath = []; - if (ONLY_ON_PATH && !recordedPath.includes(pathname)) return; - + const recordActivity = async () => { const ip = await odooApi('GET', '/api/ip-address'); const data = new URLSearchParams({ page_title: document.title, @@ -117,9 +104,12 @@ const BasicLayout = ({ children }) => { onAnimationEnd={() => setHighlight(false)} /> )} + <Navbar isMobile={isMobile} /> + <AnimationLayout> {children} + {(!isProductPage || hasPrice) && ( <div className={`fixed ${ @@ -142,6 +132,7 @@ const BasicLayout = ({ children }) => { {isDesktop && 'Whatsapp'} </span> </a> + <a href={whatsappUrl(templateWA, payloadWA, urlPath)} className='elemen-whatsapp p-4 rounded-full bg-[#4FB84A] border border-green-300 flex items-center' @@ -152,24 +143,15 @@ const BasicLayout = ({ children }) => { <Image src='/images/socials/WHATSAPP.svg' alt='Whatsapp' - className='block sm:hidden' - width={36} - height={36} - loading='eager' - /> - <Image - src='/images/socials/WHATSAPP.svg' - alt='Whatsapp' - className='hidden sm:block' width={44} height={44} - loading='eager' /> </a> </div> </div> )} </AnimationLayout> + <BasicFooter /> </> ); |
