summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authortrisusilo <tri.susilo@altama.co.id>2023-09-22 03:25:33 +0000
committertrisusilo <tri.susilo@altama.co.id>2023-09-22 03:25:33 +0000
commit8b12b43c0c3f9dd2d2743c83c23ed2a3f30fdae0 (patch)
tree6ce4958f4000e3db72ceddebe7ffb468eefe395b /src/core
parent74b4e3a9b86f1d3b102ad3f907237f7da1b05009 (diff)
parentbda91439b6ef4605a579bde8bef603b551aab3dd (diff)
Merged in Feature/popup_cart (pull request #73)
Feature/popup cart
Diffstat (limited to 'src/core')
-rw-r--r--src/core/components/elements/Navbar/NavbarDesktop.jsx18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/core/components/elements/Navbar/NavbarDesktop.jsx b/src/core/components/elements/Navbar/NavbarDesktop.jsx
index 2e4b25fc..3aba55c9 100644
--- a/src/core/components/elements/Navbar/NavbarDesktop.jsx
+++ b/src/core/components/elements/Navbar/NavbarDesktop.jsx
@@ -10,19 +10,17 @@ import DesktopView from '../../views/DesktopView'
import dynamic from 'next/dynamic'
import IndoteknikLogo from '@/images/logo.png'
import Category from '@/lib/category/components/Category'
-import { useContext, useEffect, useState } from 'react'
+import { useCallback, useContext, useEffect, useState } from 'react'
import useAuth from '@/core/hooks/useAuth'
import NavbarUserDropdown from './NavbarUserDropdown'
-import { getCountCart } from '@/core/utils/cart'
+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 productApi from '@/lib/product/api/productApi'
-import { useSession } from 'next-auth/react'
-import { AuthContext } from '@/pages/_app'
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'), {
@@ -31,7 +29,6 @@ const TopBanner = dynamic(() => import('./TopBanner'), {
const NavbarDesktop = () => {
const [isOpenCategory, setIsOpenCategory] = useState(false)
- const { authenticated } = useContext(AuthContext)
const auth = useAuth()
const [cartCount, setCartCount] = useState(0)
@@ -43,7 +40,7 @@ const NavbarDesktop = () => {
const router = useRouter()
const { product } = useProductContext()
-
+
useEffect(() => {
if (router.pathname === '/shop/product/[slug]') {
setPayloadWa({
@@ -101,7 +98,7 @@ const NavbarDesktop = () => {
<div className='flex-1 flex items-center'>
<Search />
</div>
- <div className='flex gap-x-4'>
+ <div className='flex gap-x-4 items-center'>
<Link
href='/my/transactions'
target='_blank'
@@ -113,7 +110,8 @@ const NavbarDesktop = () => {
<br />
Quotation
</Link>
- <Link
+ <Cardheader cartCount={cartCount}/>
+ {/* <Link
href='/shop/cart'
target='_blank'
rel='noreferrer'
@@ -132,7 +130,7 @@ const NavbarDesktop = () => {
<br />
Belanja
</span>
- </Link>
+ </Link> */}
<Link
target='_blank'
rel='noreferrer'