import React, { useContext, useEffect } from "react";
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 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);
let { jobLists } = useSelector((state) => state.jobLists);
const marketData = jobLists?.result_list;
let noOfJobs = 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");
});
}
});
return (
{/* logo-area */}
{darkMode.theme === "light" ? (

) : (

)}
{/* menu and settings item */}
{/* menus item */}
Menu
{/* 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) => (
))}
{/*- */}
{/* (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*/}
{/* */}
{/* */}
{/*
*/}
{/*
*/}
{!userDetails.post_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 ? (
) : (
)}
);
}
const ListItem = ({ sidebar, route, title, bubble }) => {
return (
(navData.isActive ? "active" : ""),
sidebar ? "justify-start space-x-3.5" : "justify-center")
}`}
>
{title && title}
{bubble && (
{bubble}
)}
);
};