fixed bug
This commit is contained in:
+177
-189
@@ -1,4 +1,4 @@
|
||||
import React, { useContext,useState, useEffect } from "react";
|
||||
import React, { useContext, useState, useEffect } from "react";
|
||||
import { Link, useLocation } from "react-router-dom";
|
||||
import bank1 from "../../assets/images/bank-1.png";
|
||||
import bank2 from "../../assets/images/bank-2.png";
|
||||
@@ -13,20 +13,18 @@ import SearchCom from "../Helpers/SearchCom";
|
||||
import WalletHeader from "../MyWallet/WalletHeader";
|
||||
import usersService from "../../services/UsersService";
|
||||
|
||||
import siteLogo from '../../assets/images/wrenchboard.png'
|
||||
import Flag from '../../assets/images/united-states.svg'
|
||||
import siteLogo from "../../assets/images/wrenchboard.png";
|
||||
import Flag from "../../assets/images/united-states.svg";
|
||||
import { useSelector } from "react-redux";
|
||||
|
||||
|
||||
export default function Header({ logoutModalHandler, sidebarHandler }) {
|
||||
const [balanceDropdown, setbalanceValue] = useToggle(false);
|
||||
const [notificationDropdown, setNotificationValue] = useToggle(false);
|
||||
const [userProfileDropdown, setProfileDropdown] = useToggle(false);
|
||||
const [moneyPopup, setPopup] = useToggle(false);
|
||||
const [toggleNotification, setToggleNotification] = useToggle(false)
|
||||
const [toggleNotification, setToggleNotification] = useToggle(false);
|
||||
const darkMode = useContext(DarkModeContext);
|
||||
const {userDetails} = useSelector((state) => state?.userDetails)
|
||||
|
||||
const { userDetails } = useSelector((state) => state?.userDetails);
|
||||
|
||||
const [myWalletList, setMyWalletList] = useState([]);
|
||||
const api = new usersService();
|
||||
@@ -34,7 +32,7 @@ export default function Header({ logoutModalHandler, sidebarHandler }) {
|
||||
const getMyWalletList = async () => {
|
||||
try {
|
||||
const res = await api.getUserWallets(null);
|
||||
console.log("wallet - > ",res.data);
|
||||
console.log("wallet - > ", res.data);
|
||||
setMyWalletList(res.data);
|
||||
} catch (error) {
|
||||
console.log("Error getting mode");
|
||||
@@ -87,22 +85,22 @@ export default function Header({ logoutModalHandler, sidebarHandler }) {
|
||||
setbalanceValue.set(false);
|
||||
};
|
||||
|
||||
const setNotification = ()=> {
|
||||
setToggleNotification.toggle()
|
||||
}
|
||||
const setNotification = () => {
|
||||
setToggleNotification.toggle();
|
||||
};
|
||||
|
||||
// getting the location of head
|
||||
let {pathname} = useLocation()
|
||||
|
||||
let { pathname } = useLocation();
|
||||
|
||||
const handleWalletBtn = () => {
|
||||
if (pathname === "/my-wallet"){
|
||||
setbalanceValue.set(false)
|
||||
} else return balanceDropdown
|
||||
}
|
||||
if (pathname === "/my-wallet") {
|
||||
setbalanceValue.set(false);
|
||||
} else return balanceDropdown;
|
||||
};
|
||||
|
||||
// User Profile
|
||||
let {firstname, lastname, email, profile_pic} = userDetails
|
||||
let userEmail = email.split('@')[0]
|
||||
let { firstname, lastname, email, profile_pic } = userDetails;
|
||||
let userEmail = email.split("@")[0];
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -240,11 +238,12 @@ export default function Header({ logoutModalHandler, sidebarHandler }) {
|
||||
|
||||
{/*<div className="lg:hidden block"></div>*/}
|
||||
<WalletHeader
|
||||
myWalletList={myWalletList}
|
||||
handlerBalance={handlerBalance}
|
||||
balanceDropdown={balanceDropdown}
|
||||
addMoneyHandler={addMoneyHandler}
|
||||
setBalanceDropdown = {setbalanceValue} />
|
||||
myWalletList={myWalletList}
|
||||
handlerBalance={handlerBalance}
|
||||
balanceDropdown={balanceDropdown}
|
||||
addMoneyHandler={addMoneyHandler}
|
||||
setBalanceDropdown={setbalanceValue}
|
||||
/>
|
||||
{/* notification */}
|
||||
<div className="user-notification lg:block hidden relative">
|
||||
<div
|
||||
@@ -481,18 +480,16 @@ export default function Header({ logoutModalHandler, sidebarHandler }) {
|
||||
{/* profile-image */}
|
||||
<div className="lg:w-[62px] lg:h-[62px] w-[50px] h-[50px] rounded-full overflow-hidden">
|
||||
<img
|
||||
src={profile_pic != '' ? profile_pic : profileImg}
|
||||
src={profile_pic != "" ? profile_pic : profileImg}
|
||||
alt="profile"
|
||||
className="w-full h-full"
|
||||
/>
|
||||
</div>
|
||||
<div className="lg:block hidden">
|
||||
<h1 className="text-xl font-bold text-dark-gray dark:text-white">
|
||||
{`${firstname} ${lastname}`}
|
||||
{`${firstname} ${lastname}`}
|
||||
</h1>
|
||||
<p className="text-sm text-thin-light-gray">
|
||||
@{userEmail}
|
||||
</p>
|
||||
<p className="text-sm text-thin-light-gray">@{userEmail}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
@@ -505,7 +502,7 @@ export default function Header({ logoutModalHandler, sidebarHandler }) {
|
||||
</div>
|
||||
<div className="heading border-b dark:border-[#5356fb29] border-light-purple px-7 py-2">
|
||||
<h3 className="text-xl font-bold text-dark-gray dark:text-white">
|
||||
Fullname
|
||||
Fullname
|
||||
</h3>
|
||||
<p className="text-base text-gray-400 dark:text-white hover:text-sky-blue cursor-pointer">{`${firstname} ${lastname}`}</p>
|
||||
</div>
|
||||
@@ -657,23 +654,19 @@ export default function Header({ logoutModalHandler, sidebarHandler }) {
|
||||
</div>
|
||||
</li> */}
|
||||
|
||||
{userDetails && userDetails?.account_type !== "FAMILY" && (
|
||||
<li className="content-item my-2 hover:bg-slate-100 transition duration-500 rounded-lg">
|
||||
<Link to="/settings" className="notifications">
|
||||
<div className="name">
|
||||
<p className="text-sm py-2 px-4 text-dark-gray dark:text-white hover:text-sky-blue transition font-medium">
|
||||
My Profile
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
</li>
|
||||
)}
|
||||
<li className="content-item my-2 hover:bg-slate-100 transition duration-500 rounded-lg">
|
||||
<Link
|
||||
to="/settings"
|
||||
className="notifications"
|
||||
>
|
||||
<div className="name">
|
||||
<p className="text-sm py-2 px-4 text-dark-gray dark:text-white hover:text-sky-blue transition font-medium">
|
||||
My Profile
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
</li>
|
||||
<li className="content-item my-2 hover:bg-slate-100 transition duration-500 rounded-lg">
|
||||
<Link
|
||||
to="/my-wallet"
|
||||
className="notifications"
|
||||
>
|
||||
<Link to="/my-wallet" className="notifications">
|
||||
<div className="name">
|
||||
<p className="text-sm py-2 px-4 text-dark-gray dark:text-white hover:text-sky-blue transition font-medium">
|
||||
My Wallet
|
||||
@@ -681,155 +674,150 @@ export default function Header({ logoutModalHandler, sidebarHandler }) {
|
||||
</div>
|
||||
</Link>
|
||||
</li>
|
||||
<li className="content-item relative my-2 hover:bg-slate-100 transition duration-500 rounded-lg">
|
||||
<Link
|
||||
to="#"
|
||||
className="notifications"
|
||||
>
|
||||
<div className="name">
|
||||
<p className="flex items-center justify-between text-sm py-2 px-4 text-dark-gray dark:text-white hover:text-sky-blue transition font-medium">
|
||||
<span>Reports</span> <span>></span>
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
{/* report list items*/}
|
||||
<div className="inner-list-items absolute rounded-lg" onClick={setNotification}>
|
||||
<ul className="p-3">
|
||||
<li className="content-item my-1 hover:bg-slate-100 transition duration-500 rounded-lg">
|
||||
<Link
|
||||
to="/referral"
|
||||
className="notifications"
|
||||
>
|
||||
<div className="name">
|
||||
<p className="text-sm py-1 px-4 text-dark-gray dark:text-white hover:text-sky-blue transition font-medium">
|
||||
Referrals
|
||||
</p>
|
||||
{userDetails && userDetails?.account_type !== "FAMILY" && (
|
||||
<>
|
||||
<li className="content-item relative my-2 hover:bg-slate-100 transition duration-500 rounded-lg">
|
||||
<Link to="#" className="notifications">
|
||||
<div className="name">
|
||||
<p className="flex items-center justify-between text-sm py-2 px-4 text-dark-gray dark:text-white hover:text-sky-blue transition font-medium">
|
||||
<span>Reports</span> <span>></span>
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
{/* report list items*/}
|
||||
<div
|
||||
className="inner-list-items absolute rounded-lg"
|
||||
onClick={setNotification}
|
||||
>
|
||||
<ul className="p-3">
|
||||
<li className="content-item my-1 hover:bg-slate-100 transition duration-500 rounded-lg">
|
||||
<Link to="/referral" className="notifications">
|
||||
<div className="name">
|
||||
<p className="text-sm py-1 px-4 text-dark-gray dark:text-white hover:text-sky-blue transition font-medium">
|
||||
Referrals
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
</li>
|
||||
<li className="content-item my-1 hover:bg-slate-100 transition duration-500 rounded-lg">
|
||||
<Link to="#" className="notifications">
|
||||
<div className="name">
|
||||
<p className="text-sm py-1 px-4 text-dark-gray dark:text-white hover:text-sky-blue transition font-medium">
|
||||
Billing
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
</li>
|
||||
<li className="content-item my-1 hover:bg-slate-100 transition duration-500 rounded-lg">
|
||||
<Link to="#" className="notifications">
|
||||
<div className="name">
|
||||
<p className="text-sm py-1 px-4 text-dark-gray dark:text-white hover:text-sky-blue transition font-medium">
|
||||
Payments
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
</li>
|
||||
<li className="content-item my-1 hover:bg-slate-100 transition duration-500 rounded-lg">
|
||||
<Link to="#" className="notifications">
|
||||
<div className="name">
|
||||
<p className="text-sm py-1 px-4 text-dark-gray dark:text-white hover:text-sky-blue transition font-medium">
|
||||
Completed Jobs
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
</li>
|
||||
<li className="content-item my-1 hover:bg-slate-100 transition duration-500 rounded-lg">
|
||||
<Link to="#" className="notifications">
|
||||
<div className="name">
|
||||
<p className="text-sm py-1 px-4 text-dark-gray dark:text-white hover:text-sky-blue transition font-medium">
|
||||
Previous Task
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
</li>
|
||||
</ul>
|
||||
<hr />
|
||||
<div className="px-7 py-3 cursor-pointer flex items-center">
|
||||
<div
|
||||
className={`h-6 w-8 mr-1 p-1 ${
|
||||
toggleNotification
|
||||
? "bg-sky-blue flex justify-end items-center"
|
||||
: "bg-slate-200"
|
||||
} rounded-full transition`}
|
||||
>
|
||||
<div className="w-4 h-full bg-white rounded-full"></div>
|
||||
</div>
|
||||
</Link>
|
||||
</li>
|
||||
<li className="content-item my-1 hover:bg-slate-100 transition duration-500 rounded-lg">
|
||||
<Link
|
||||
to="#"
|
||||
className="notifications"
|
||||
>
|
||||
<div className="name">
|
||||
<p className="text-sm py-1 px-4 text-dark-gray dark:text-white hover:text-sky-blue transition font-medium">
|
||||
Billing
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
</li>
|
||||
<li className="content-item my-1 hover:bg-slate-100 transition duration-500 rounded-lg">
|
||||
<Link
|
||||
to="#"
|
||||
className="notifications"
|
||||
>
|
||||
<div className="name">
|
||||
<p className="text-sm py-1 px-4 text-dark-gray dark:text-white hover:text-sky-blue transition font-medium">
|
||||
Payments
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
</li>
|
||||
<li className="content-item my-1 hover:bg-slate-100 transition duration-500 rounded-lg">
|
||||
<Link
|
||||
to="#"
|
||||
className="notifications"
|
||||
>
|
||||
<div className="name">
|
||||
<p className="text-sm py-1 px-4 text-dark-gray dark:text-white hover:text-sky-blue transition font-medium">
|
||||
Completed Jobs
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
</li>
|
||||
<li className="content-item my-1 hover:bg-slate-100 transition duration-500 rounded-lg">
|
||||
<Link
|
||||
to="#"
|
||||
className="notifications"
|
||||
>
|
||||
<div className="name">
|
||||
<p className="text-sm py-1 px-4 text-dark-gray dark:text-white hover:text-sky-blue transition font-medium">
|
||||
Previous Task
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
</li>
|
||||
</ul>
|
||||
<hr />
|
||||
<div className="px-7 py-3 cursor-pointer flex items-center">
|
||||
<div className={`h-6 w-8 mr-1 p-1 ${toggleNotification ? 'bg-sky-blue flex justify-end items-center': 'bg-slate-200'} rounded-full transition`}>
|
||||
<div className="w-4 h-full bg-white rounded-full"></div>
|
||||
<p className="text-sm py-2 px-4 text-slate-400 dark:text-white">
|
||||
Notifications
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<p className="text-sm py-2 px-4 text-slate-400 dark:text-white">
|
||||
Notifications
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{/* end report list items*/}
|
||||
</li>
|
||||
<li className="content-item my-2 hover:bg-slate-100 transition duration-500 rounded-lg">
|
||||
<Link
|
||||
to="#"
|
||||
className="notifications"
|
||||
>
|
||||
<div className="name">
|
||||
<p className="text-sm py-2 px-4 text-dark-gray dark:text-white font-medium">
|
||||
My Statements
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
</li>
|
||||
{/* end report list items*/}
|
||||
</li>
|
||||
<li className="content-item my-2 hover:bg-slate-100 transition duration-500 rounded-lg">
|
||||
<Link to="#" className="notifications">
|
||||
<div className="name">
|
||||
<p className="text-sm py-2 px-4 text-dark-gray dark:text-white font-medium">
|
||||
My Statements
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
</li>
|
||||
</>
|
||||
)}
|
||||
</ul>
|
||||
<hr />
|
||||
<ul className="px-7">
|
||||
<li className="content-item relative my-2 hover:bg-slate-100 transition duration-500 rounded-lg">
|
||||
<Link
|
||||
to="#"
|
||||
className="notifications"
|
||||
>
|
||||
<div className="name">
|
||||
<div className="flex items-center justify-between text-sm py-2 px-4 text-dark-gray dark:text-white hover:text-sky-blue transition font-medium">
|
||||
<p>Language</p>
|
||||
<div className="px-1 flex items-center space-x-1 bg-slate-100 rounded-sm">
|
||||
<p className="text-[10px]">English </p>
|
||||
<img className="w-[10px] h-[10px]" src={Flag} alt="U.S.A Flag" />
|
||||
{userDetails && userDetails?.account_type !== "FAMILY" && (
|
||||
<>
|
||||
<li className="content-item relative my-2 hover:bg-slate-100 transition duration-500 rounded-lg">
|
||||
<Link to="#" className="notifications">
|
||||
<div className="name">
|
||||
<div className="flex items-center justify-between text-sm py-2 px-4 text-dark-gray dark:text-white hover:text-sky-blue transition font-medium">
|
||||
<p>Language</p>
|
||||
<div className="px-1 flex items-center space-x-1 bg-slate-100 rounded-sm">
|
||||
<p className="text-[10px]">English </p>
|
||||
<img
|
||||
className="w-[10px] h-[10px]"
|
||||
src={Flag}
|
||||
alt="U.S.A Flag"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
{/* langauge list items*/}
|
||||
<div className="inner-list-items absolute rounded-lg">
|
||||
<ul className="p-3">
|
||||
<li className="content-item my-1 hover:bg-slate-100 transition duration-500 rounded-lg">
|
||||
<Link to="#" className="notifications">
|
||||
<div className="name">
|
||||
<div className="px-1 flex items-center space-x-1 bg-slate-100 rounded-sm text-sm py-1 text-dark-gray dark:text-white hover:text-sky-blue transition font-medium">
|
||||
<img
|
||||
className="w-[15px] h-[15px]"
|
||||
src={Flag}
|
||||
alt="U.S.A Flag"
|
||||
/>
|
||||
<p className="text-sm">English </p>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
{/* langauge list items*/}
|
||||
<div className="inner-list-items absolute rounded-lg">
|
||||
<ul className="p-3">
|
||||
<li className="content-item my-1 hover:bg-slate-100 transition duration-500 rounded-lg">
|
||||
<Link
|
||||
to="#"
|
||||
className="notifications"
|
||||
>
|
||||
<div className="name">
|
||||
<div className="px-1 flex items-center space-x-1 bg-slate-100 rounded-sm text-sm py-1 text-dark-gray dark:text-white hover:text-sky-blue transition font-medium">
|
||||
<img className="w-[15px] h-[15px]" src={Flag} alt="U.S.A Flag" />
|
||||
<p className="text-sm">English </p>
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
{/* end Language list items*/}
|
||||
</li>
|
||||
<li className="content-item my-2 hover:bg-slate-100 transition duration-500 rounded-lg">
|
||||
<Link
|
||||
to="#"
|
||||
className="notifications"
|
||||
>
|
||||
<div className="name">
|
||||
<p className="text-sm py-2 px-4 text-dark-gray dark:text-white hover:text-sky-blue transition font-medium">
|
||||
Account Settings
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
</li>
|
||||
{/* end Language list items*/}
|
||||
</li>
|
||||
<li className="content-item my-2 hover:bg-slate-100 transition duration-500 rounded-lg">
|
||||
<Link to="#" className="notifications">
|
||||
<div className="name">
|
||||
<p className="text-sm py-2 px-4 text-dark-gray dark:text-white hover:text-sky-blue transition font-medium">
|
||||
Account Settings
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
</li>
|
||||
</>
|
||||
)}
|
||||
|
||||
<li className="content-item my-2 hover:bg-slate-100 transition duration-500 rounded-lg cursor-pointer">
|
||||
<div className="name" onClick={logoutModalHandler}>
|
||||
@@ -839,7 +827,7 @@ export default function Header({ logoutModalHandler, sidebarHandler }) {
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<hr className="mb-3"/>
|
||||
<hr className="mb-3" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user