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"; import bank3 from "../../assets/images/bank-3.png"; import bank4 from "../../assets/images/bank-4.png"; import profileImg from "../../assets/images/profile-pic.jpg"; import useToggle from "../../hooks/useToggle"; import DarkModeContext from "../Contexts/DarkModeContext"; import Icons from "../Helpers/Icons"; import ModalCom from "../Helpers/ModalCom"; 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 { 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 darkMode = useContext(DarkModeContext); const {userDetails} = useSelector((state) => state?.userDetails) const [myWalletList, setMyWalletList] = useState([]); const api = new usersService(); const getMyWalletList = async () => { try { const res = await api.getUserWallets(null); console.log("wallet - > ",res.data); setMyWalletList(res.data); } catch (error) { console.log("Error getting mode"); } }; useEffect(() => { getMyWalletList(); }, []); const handlerBalance = () => { setbalanceValue.toggle(); if (notificationDropdown) { setNotificationValue.toggle(); } if (userProfileDropdown) { setProfileDropdown.toggle(); } }; const handlerNotification = () => { setNotificationValue.toggle(); if (balanceDropdown) { setbalanceValue.toggle(); } if (userProfileDropdown) { setProfileDropdown.toggle(); } }; const handlerProfile = () => { setProfileDropdown.toggle(); if (balanceDropdown) { setbalanceValue.toggle(); } if (notificationDropdown) { setNotificationValue.toggle(); } }; const clickAwayhandler = () => { if (balanceDropdown) { setbalanceValue.toggle(); } if (notificationDropdown) { setNotificationValue.toggle(); } if (userProfileDropdown) { setProfileDropdown.toggle(); } }; const addMoneyHandler = () => { setPopup.toggle(); setbalanceValue.set(false); }; const setNotification = ()=> { setToggleNotification.toggle() } // getting the location of head let {pathname} = useLocation() const handleWalletBtn = () => { if (pathname === "/my-wallet"){ setbalanceValue.set(false) } else return balanceDropdown } // User Profile let {firstname, lastname, email, profile_pic} = userDetails let userEmail = email.split('@')[0] return ( <>
{/* search bar */}
{/**/}
{/* user info */}
{/* dark mode */} {/* balance */} {/*
*/} {/* notification */}
handlerNotification()} className="lg:w-[48px] lg:h-[48px] w-[38px] h-[38px] bg-white flex justify-center items-center rounded-full overflow-hidden relative" > 10

Recent Notifications

  • Your Account has been created successfully done

    23 house ago

  • You upload your frast product successfully done

    23 house ago

  • Thank you ! you made your frast sell 232.98 ETH

    23 house ago

  • Your Account has been created successfully done

    23 house ago

  • Your Account has been created successfully done

    23 house ago

See all Notification
10
{/* profile */}
handlerProfile()} className="flex items-center space-x-3.5" > {/* profile-image */}
profile

{`${firstname} ${lastname}`}

@{userEmail}

Logo

Fullname

{`${firstname} ${lastname}`}

    {/*
  • My Profile

  • */} {/*
  • History

  • */} {/*
  • Setting

  • */} {/*
  • Log Out

  • */}
  • My Profile

  • My Wallet

  • Reports >

    {/* report list items*/}
    • Referrals

    • Billing

    • Payments

    • Completed Jobs

    • Previous Task


    Notifications

    {/* end report list items*/}
  • My Statements


  • Language

    English

    U.S.A Flag
    {/* langauge list items*/}
    • U.S.A Flag

      English

    {/* end Language list items*/}
  • Account Settings

  • Sign Out


profile
{balanceDropdown || notificationDropdown || userProfileDropdown ? (
) : ( "" )} {moneyPopup && (

Connect to a wallet

  • MetaMask

  • Coinbase Wallet

  • Bitski

  • WalletConnect

View Wallet
)} ); }