diff --git a/src/components/FamilyAcc/FamilyTable.jsx b/src/components/FamilyAcc/FamilyTable.jsx index f1e8d91..a3d6dec 100644 --- a/src/components/FamilyAcc/FamilyTable.jsx +++ b/src/components/FamilyAcc/FamilyTable.jsx @@ -52,7 +52,7 @@ export default function FamilyTable({ className, familyList, loader }) { >
-
+
data
-
+
data
-
+
data 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 }) { {/*
*/} + myWalletList={myWalletList} + handlerBalance={handlerBalance} + balanceDropdown={balanceDropdown} + addMoneyHandler={addMoneyHandler} + setBalanceDropdown={setbalanceValue} + /> {/* notification */}
profile

- {`${firstname} ${lastname}`} + {`${firstname} ${lastname}`}

-

- @{userEmail} -

+

@{userEmail}

*/} + {userDetails && userDetails?.account_type !== "FAMILY" && ( +
  • + +
    +

    + My Profile +

    +
    + +
  • + )}
  • - -
    -

    - My Profile -

    -
    - -
  • -
  • - +

    My Wallet @@ -681,155 +674,150 @@ export default function Header({ logoutModalHandler, sidebarHandler }) {

  • -
  • - -
    -

    - Reports > -

    -
    - - {/* report list items*/} -
    -
      -
    • - -
      -

      - Referrals -

      + {userDetails && userDetails?.account_type !== "FAMILY" && ( + <> +
    • + +
      +

      + Reports > +

      +
      + + {/* report list items*/} +
      +
        +
      • + +
        +

        + Referrals +

        +
        + +
      • +
      • + +
        +

        + Billing +

        +
        + +
      • +
      • + +
        +

        + Payments +

        +
        + +
      • +
      • + +
        +

        + Completed Jobs +

        +
        + +
      • +
      • + +
        +

        + Previous Task +

        +
        + +
      • +
      +
      +
      +
      +
      - -
    • -
    • - -
      -

      - Billing -

      -
      - -
    • -
    • - -
      -

      - Payments -

      -
      - -
    • -
    • - -
      -

      - Completed Jobs -

      -
      - -
    • -
    • - -
      -

      - Previous Task -

      -
      - -
    • -
    -
    -
    -
    -
    +

    + Notifications +

    +
    -

    - Notifications -

    -
    -
  • - {/* end report list items*/} - -
  • - -
    -

    - My Statements -

    -
    - -
  • + {/* end report list items*/} + +
  • + +
    +

    + My Statements +

    +
    + +
  • + + )}
      -
    • - -
      -
      -

      Language

      -
      -

      English

      - U.S.A Flag + {userDetails && userDetails?.account_type !== "FAMILY" && ( + <> +
    • + +
      +
      +

      Language

      +
      +

      English

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

        English

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

      English

      -
      -
      - -
    • -
    -
    - {/* end Language list items*/} - -
  • - -
    -

    - Account Settings -

    -
    - -
  • + {/* end Language list items*/} + +
  • + +
    +

    + Account Settings +

    +
    + +
  • + + )}
  • @@ -839,7 +827,7 @@ export default function Header({ logoutModalHandler, sidebarHandler }) {
  • -
    +
    diff --git a/src/components/Partials/MobileSideBar.jsx b/src/components/Partials/MobileSideBar.jsx index 9abe391..b35704c 100644 --- a/src/components/Partials/MobileSideBar.jsx +++ b/src/components/Partials/MobileSideBar.jsx @@ -1,10 +1,12 @@ import React, { useContext } from "react"; +import { useSelector } from "react-redux"; import { NavLink } from "react-router-dom"; -import logo from "../../assets/images/wrenchboard.png"; //logo-2.svg"; -import logo3 from "../../assets/images/wrenchboard.png"; //logo-3.svg"; +import { + default as logo, + default as logo3, +} from "../../assets/images/wrenchboard.png"; //logo-2.svg"; import DarkModeContext from "../Contexts/DarkModeContext"; import Icons from "../Helpers/Icons"; -import { useSelector } from "react-redux"; export default function MobileSidebar({ sidebar, action, logoutModalHandler }) { let { userDetails } = useSelector((state) => state.userDetails); @@ -81,173 +83,127 @@ export default function MobileSidebar({ sidebar, action, logoutModalHandler }) {
      {/* Using mini component reduces the bulk amount of html */} - {[ - { name: "Dashboard", path: "/" }, - { name: "Market", path: "/market", bubble: noOfJobs }, - { name: "My Task(s)", path: "/mytask" }, - ].map(({ name, path, bubble }, idx) => ( + + {userDetails && userDetails?.account_type !== "FAMILY" && ( - ))} - {/*
    • */} - {/* */} - {/* */} - {/* */} - {/* */} - {/* */} - {/* Messages*/} - {/* */} - {/* */} - {/*
    • */} - {/*
    • */} - {/* */} - {/* */} - {/* */} - {/* */} - {/* */} - {/* My Wallet*/} - {/* */} - {/* */} - {/*
    • */} - {/*
    • */} - {/* */} - {/* */} - {/* */} - {/* */} - {/* */} - {/* Resources*/} - {/* */} - {/* */} - {/*
    • */} - {/*
    • */} - {/* */} - {/* */} - {/* */} - {/* */} - {/* */} - {/* History*/} - {/* */} - {/* */} - {/*
    • */} - {/*
    • */} - {/* */} - {/* */} - {/* */} - {/* */} - {/* */} - {/* Refer a Friend*/} - {/* */} - {/* */} - {/*
    • */} + )} +
    - {!userDetails.post_jobs ? ( -
    -
    - - - Enable Job Post - - -
    -
    - ) : jobLists?.result_list?.length ? ( -
    -
    -

    My Jobs

    -
    -
    -
      -
    • - - - - - - My Jobs - - -
    • -
    • - - - - - - Pending - - -
    • -
    • - - - - - - Active Job(s) - - -
    • -
    -
    -
    - ) : ( -
    -
    -

    My Jobs

    -
    -
    -
      -
    • - - - - - - My Jobs - - -
    • -
    -
    -
    + {userDetails?.account_type !== "FAMILY" && ( + <> + {!userDetails?.post_jobs ? ( +
    + {/* menus item */} +
    +
    +
    +

    + Job Post +

    +
    +
      +
    • + (navData.isActive ? "active" : ""), + sidebar + ? "justify-start space-x-3.5" + : "justify-center") + }`} + > + + + + + Enable Job Post + + +
    • +
    +
    +
    +
    + ) : jobLists?.result_list?.length ? ( +
    +
    +

    + My Jobs +

    +
    +
    +
      + {[ + { name: "List", path: "/myjobs", iconName: "people-two" }, + { + name: "Pending", + path: "/my-pending-jobs", + iconName: "people-two", + }, + { + name: "Active", + path: "/my-active-jobs", + iconName: "people-two", + }, + ].map(({ name, path, iconName }, idx) => ( + + ))} +
    +
    +
    + ) : ( +
    +
    +

    + My Jobs +

    +
    +
    +
      + +
    +
    +
    + )} + )}
    {/* signout area */} diff --git a/src/components/Partials/Sidebar.jsx b/src/components/Partials/Sidebar.jsx index 0bb50a2..f68ba47 100644 --- a/src/components/Partials/Sidebar.jsx +++ b/src/components/Partials/Sidebar.jsx @@ -1,20 +1,27 @@ import React, { useContext, useEffect } from "react"; +import { useSelector } from "react-redux"; import { NavLink } from "react-router-dom"; -import logo from "../../assets/images/wrenchboard.png"; //logo-2.svg"; -import logo3 from "../../assets/images/wrenchboard.png"; //logo-3.svg"; +import { + default as logo, + default as logo3, +} from "../../assets/images/wrenchboard.png"; //logo-2.svg"; import DarkModeContext from "../Contexts/DarkModeContext"; import Icons from "../Helpers/Icons"; -import { useSelector } from "react-redux"; export default function Sidebar({ sidebar, action, logoutModalHandler }) { const darkMode = useContext(DarkModeContext); let { userDetails } = useSelector((state) => state.userDetails); + console.log(userDetails); //const jobLists = getJobList(); // pass from upper - we need in a lot of places let { jobLists } = useSelector((state) => state.jobLists); const marketData = jobLists?.result_list; let noOfJobs = marketData?.length <= 0 ? "0" : marketData?.length; + function accntType() { + return userDetails?.account_type !== "FAMILY"; + } + useEffect(() => { const title = document.querySelectorAll(".menu-setting-items .heading"); if (sidebar) { @@ -102,186 +109,69 @@ export default function Sidebar({ sidebar, action, logoutModalHandler }) {
      {/* Using mini component reduces the bulk amount of html */} - {[ - { name: "Dashboard", path: "/" }, - { name: "Market", path: "/market", bubble: noOfJobs }, - { name: "My Task(s)", path: "/mytask" }, - ].map(({ name, path, bubble }, idx) => ( + + {userDetails && userDetails?.account_type !== "FAMILY" && ( - ))} - {/*
    • */} - {/* (navData.isActive ? "active" : ""),*/} - {/* sidebar ? "justify-start space-x-3.5" : "justify-center")*/} - {/* }`}*/} - {/* >*/} - {/* */} - {/* */} - {/* */} - {/* */} - {/* Messages*/} - {/* */} - {/* */} - {/*
    • */} - {/*
    • */} - {/* (navData.isActive ? "active" : ""),*/} - {/* sidebar ? "justify-start space-x-3.5" : "justify-center")*/} - {/* }`}*/} - {/* >*/} - {/* */} - {/* */} - {/* */} - {/* */} - {/* My Wallet*/} - {/* */} - {/* */} - {/*
    • */} - {/*
    • */} - {/* (navData.isActive ? "active" : ""),*/} - {/* sidebar ? "justify-start space-x-3.5" : "justify-center")*/} - {/* }`}*/} - {/* >*/} - {/* */} - {/* */} - {/* */} - {/* */} - {/* Resources*/} - {/* */} - {/* */} - {/*
    • */} - - {/*
    • */} - {/* (navData.isActive ? "active" : ""),*/} - {/* sidebar ? "justify-start space-x-3.5" : "justify-center")*/} - {/* }`}*/} - {/* >*/} - {/* */} - {/* */} - {/* */} - {/* */} - {/* History*/} - {/* */} - {/* */} - {/*
    • */} - - {/*
    • */} - {/* (navData.isActive ? "active" : ""),*/} - {/* sidebar ? "justify-start space-x-3.5" : "justify-center")*/} - {/* }`}*/} - {/* >*/} - {/* */} - {/* */} - {/* */} - {/* */} - {/* Refer a Friend*/} - {/* */} - {/* */} - {/*
    • */} + )} +
    - {/*
    -
    - - - Family Account - - -
    -
    */} - {/* menu and settings item */} -
    - {/* menus item */} -
    - {/*
    - -

    - Family Corner -

    -
    -
    */} -
    + {userDetails?.account_type !== "FAMILY" && ( +
    + {/* menus item */} +
    +
    -

    Family

    +

    + Family +

      -
    • - (navData.isActive ? "active" : ""), - sidebar ? "justify-start space-x-3.5" : "justify-center") - }`} - > - - - - - Family Corner - - -
    • +
    +
    -
    + )} - {!userDetails.post_jobs ? ( - -
    - {/* menus item */} -
    - {/*
    + <> + {!userDetails?.post_jobs ? ( +
    + {/* menus item */} +
    + {/*
    @@ -290,176 +180,98 @@ export default function Sidebar({ sidebar, action, logoutModalHandler }) {
    */} -
    -
    -

    Job Post

    -
    -
      -
    • - (navData.isActive ? "active" : ""), - sidebar ? "justify-start space-x-3.5" : "justify-center") - }`} - > - - - - +
      +

      + Job Post +

      +
      +
        +
      • + (navData.isActive ? "active" : ""), + sidebar + ? "justify-start space-x-3.5" + : "justify-center") }`} > - Enable Job Post - - -
      • + + + + + Enable Job Post + + + +
      +
    +
    +
    + ) : jobLists?.result_list?.length ? ( + <> + {userDetails?.account_type !== "FAMILY" && ( +
    +
    +

    + My Jobs +

    +
    +
    +
      + {[ + { + name: "List", + path: "/myjobs", + iconName: "people-two", + }, + { + name: "Pending", + path: "/my-pending-jobs", + iconName: "people-two", + }, + { + name: "Active", + path: "/my-active-jobs", + iconName: "people-two", + }, + ].map(({ name, path, iconName }, idx) => ( + + ))} +
    +
    +
    + )} + + ) : ( +
    +
    +

    My Jobs

    +
    +
    +
      +
    -
    - ) : jobLists?.result_list?.length ? ( -
    -
    -

    My Jobs

    -
    -
    -
      -
    • - (navData.isActive ? "active" : ""), - sidebar ? "justify-start space-x-3.5" : "justify-center") - }`} - > - - - - - List - - -
    • -
    • - (navData.isActive ? "active" : ""), - sidebar ? "justify-start space-x-3.5" : "justify-center") - }`} - > - - - - - Pending - - -
    • -
    • - (navData.isActive ? "active" : ""), - sidebar ? "justify-start space-x-3.5" : "justify-center") - }`} - > - - - - - Active - - -
    • - {/*
    • */} - {/* (navData.isActive ? "active" : ""),*/} - {/* sidebar ? "justify-start space-x-3.5" : "justify-center")*/} - {/* }`}*/} - {/* >*/} - {/* */} - {/* */} - {/* */} - {/* */} - {/* My Profile*/} - {/* */} - {/* */} - {/*
    • */} - {/*
    • */} - {/* (navData.isActive ? "active" : ""),*/} - {/* sidebar ? "justify-start space-x-3.5" : "justify-center")*/} - {/* }`}*/} - {/* >*/} - {/* */} - {/* */} - {/* */} - {/* */} - {/* Settings*/} - {/* */} - {/* */} - {/*
    • */} -
    -
    -
    - ) : ( -
    -
    -

    My Jobs

    -
    -
    -
      -
    • - (navData.isActive ? "active" : ""), - sidebar ? "justify-start space-x-3.5" : "justify-center") - }`} - > - - - - - Add Job - - -
    • -
    -
    -
    - )} + )} +
    {/* signout area */} {sidebar ? ( @@ -526,9 +338,15 @@ export default function Sidebar({ sidebar, action, logoutModalHandler }) { ); } -const ListItem = ({ sidebar, route, title, bubble }) => { +const ListItem = ({ + sidebar, + route, + title, + bubble, + iconName, +}) => { return ( -
  • +
  • { }`} > - +