import { ChevronDownIcon, HeartIcon, ShoppingCartIcon, DocumentCheckIcon } from '@heroicons/react/24/outline' import Link from '../Link/Link' import Image from 'next/image' import DesktopView from '../../views/DesktopView' import dynamic from 'next/dynamic' import IndoteknikLogo from '@/images/logo.png' import Category from '@/lib/category/components/Category' import { useCallback, useContext, useEffect, useState } from 'react' import useAuth from '@/core/hooks/useAuth' import NavbarUserDropdown from './NavbarUserDropdown' import { getCartApi, getCountCart } from '@/core/utils/cart' import whatsappUrl from '@/core/utils/whatsappUrl' import { useRouter } from 'next/router' import { getAuth, setAuth } from '@/core/utils/auth' import { createSlug, getIdFromSlug } from '@/core/utils/slug' import { TopBannerSkeleton } from '../Skeleton/TopBannerSkeleton' import { useProductContext } from '@/contexts/ProductContext' import Cardheader from '@/lib/cart/components/Cartheader' const Search = dynamic(() => import('./Search')) const TopBanner = dynamic(() => import('./TopBanner'), { loading: () => }) const NavbarDesktop = () => { const [isOpenCategory, setIsOpenCategory] = useState(false) const auth = useAuth() const [cartCount, setCartCount] = useState(0) const [templateWA, setTemplateWA] = useState(null) const [payloadWA, setPayloadWa] = useState(null) const [urlPath, setUrlPath] = useState(null) const router = useRouter() const { product } = useProductContext() useEffect(() => { if (router.pathname === '/shop/product/[slug]') { setPayloadWa({ name: product?.name, manufacture: product?.manufacture.name, url: createSlug('/shop/product/', product?.name, product?.id, true) }) setTemplateWA('product') setUrlPath(router.asPath) } }, [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) } }, []) return (
Tentang Indoteknik.com
Pembayaran Tempo Fitur Layanan
) } export default NavbarDesktop