|
|
|
@ -1,7 +1,8 @@ |
|
|
|
|
import React, { useEffect, useState } from "react"; |
|
|
|
|
import { Link, useNavigate } from "react-router-dom"; |
|
|
|
|
import { connect } from "react-redux"; |
|
|
|
|
import { userProduct } from "../../redux/actions"; |
|
|
|
|
import { userProduct, userFavorite } from "../../redux/actions"; |
|
|
|
|
import location from "../../utils/location"; |
|
|
|
|
import _ from "lodash"; |
|
|
|
|
|
|
|
|
|
//components
|
|
|
|
@ -34,6 +35,7 @@ function Navbar({ |
|
|
|
|
isMobile, |
|
|
|
|
isLogin, |
|
|
|
|
headerOptions, |
|
|
|
|
addToFavorite, |
|
|
|
|
}) { |
|
|
|
|
const navigation = useNavigate(); |
|
|
|
|
const { logo, hamburgerMenu, qr, shown, menu, title, back, bookmark } = |
|
|
|
@ -58,7 +60,6 @@ function Navbar({ |
|
|
|
|
} |
|
|
|
|
}, []); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
if (!isMobile && isLogin) { |
|
|
|
|
getCartProducts(); |
|
|
|
@ -124,7 +125,9 @@ function Navbar({ |
|
|
|
|
className={_.join( |
|
|
|
|
[ |
|
|
|
|
"rounded-sm p-1.5", |
|
|
|
|
isDark ? "bg-blueC0 bg-opacity-10 ml-2" : " ml-3 shadow-sm", |
|
|
|
|
isDark |
|
|
|
|
? "bg-blueC0 bg-opacity-10 ml-2" |
|
|
|
|
: " ml-3 shadow-sm", |
|
|
|
|
], |
|
|
|
|
" " |
|
|
|
|
)} |
|
|
|
@ -165,14 +168,15 @@ function Navbar({ |
|
|
|
|
isDark ? bookmarkDeactiveDarkIcon : bookmarkDeactiveLightIcon |
|
|
|
|
} |
|
|
|
|
alt="bookmark" |
|
|
|
|
className="w-7 ml-2" |
|
|
|
|
className="w-7" |
|
|
|
|
onClick={() => addToFavorite({ [bookmark]: location.getId() })} |
|
|
|
|
/> |
|
|
|
|
)} |
|
|
|
|
{menu && ( |
|
|
|
|
<img |
|
|
|
|
src={isDark ? dotsMenuDarkIcon : dotsMenuLightIcon} |
|
|
|
|
alt="menu" |
|
|
|
|
className="w-7" |
|
|
|
|
className="w-7 mr-2" |
|
|
|
|
/> |
|
|
|
|
)} |
|
|
|
|
{title && back ? ( |
|
|
|
@ -288,6 +292,7 @@ const mapStateToProps = (state) => ({ |
|
|
|
|
|
|
|
|
|
const mapDispatchToProps = { |
|
|
|
|
getCartProducts: userProduct.list, |
|
|
|
|
addToFavorite: userFavorite.add, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(Navbar); |
|
|
|
|