import React, { useContext, useEffect } from "react"; import { useSelector } from "react-redux"; import { NavLink } from "react-router-dom"; import { default as logo, default as logo3, } from "../../assets/images/wrenchboard-logo-text.png"; import DarkModeContext from "../Contexts/DarkModeContext"; import Icons from "../Helpers/Icons"; export default function Sidebar({ sidebar, action, logoutModalHandler, myJobList, }) { const darkMode = useContext(DarkModeContext); let { userDetails } = useSelector((state) => state.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; useEffect(() => { const title = document.querySelectorAll(".menu-setting-items .heading"); if (sidebar) { title.forEach((elm) => { elm.classList.add("active"); }); } else { title.forEach((elm) => { elm.classList.remove("active"); }); } }, [jobLists]); return (
{/* logo-area */}
{darkMode.theme === "light" ? ( nft ) : ( nft )}
{/* menu and settings item */}
{/* menus item */}

Menu

    {/* Using mini component reduces the bulk amount of html */} {userDetails && userDetails?.account_type !== "FAMILY" && ( )}
{/* menu and settings item */} {userDetails?.account_type !== "FAMILY" && (

Family

)} {userDetails?.account_type !== "FAMILY" && ( <> {!userDetails?.post_jobs ? (

Job Post

  • (navData.isActive ? "active" : ""), sidebar ? "justify-start space-x-3.5" : "justify-center") }`} > Enable Job Post
) : myJobList?.data?.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 */} {sidebar ? ( ) : ( )}
); } const ListItem = ({ sidebar, route, title, bubble, iconName, popup }) => { return (
  • (navData.isActive ? "active" : ""), sidebar ? "justify-start space-x-3.5" : "justify-center") }`} > {title && title} {bubble && ( {bubble} )}
  • ); };