hide project slection when path have = project/projectId

This commit is contained in:
Pramod Mahajan 2025-06-11 18:06:10 +05:30
parent 38960e9132
commit e404b5bc50

View File

@ -5,7 +5,7 @@ import { useDispatch, useSelector } from "react-redux";
import { changeMaster, setProjectId } from "../../slices/localVariablesSlice";
import useMaster from "../../hooks/masterHook/useMaster";
import { useProfile } from "../../hooks/useProfile";
import { useLocation, useNavigate } from "react-router-dom";
import { useLocation, useNavigate, useParams } from "react-router-dom";
import Avatar from "../../components/common/Avatar";
import { useChangePassword } from "../Context/ChangePasswordContext";
import { useProjects } from "../../hooks/useProjects";
@ -14,8 +14,7 @@ import { useEffect, useState } from "react";
const Header = () => {
const { profile } = useProfile();
const location = useLocation();
const [isGlobalSelectVisible, setIsGlobalSelectVisible] = useState(true);
const dispatch = useDispatch(changeMaster("Job Role"));
const dispatch = useDispatch( changeMaster( "Job Role" ) );
const { data, loading } = useMaster();
const navigate = useNavigate();
@ -87,12 +86,8 @@ const Header = () => {
if (projects && selectedProject !== " ") {
dispatch(setProjectId(projects[0]?.id));
}
setIsGlobalSelectVisible(
location.pathname !== `/projects/${selectedProject}`
);
}, [projects, selectedProject]);
console.log(isGlobalSelectVisible);
const isProjectPath = /^\/projects\/[a-f0-9-]{36}$/.test(location.pathname);
return (
<nav
className="layout-navbar container-xxl navbar navbar-expand-xl navbar-detached align-items-center bg-navbar-theme"
@ -111,7 +106,10 @@ const Header = () => {
id="navbar-collapse"
>
<div className=" align-items-center">
<i
{!isProjectPath && (
<>
<i
className="rounded-circle bx bx-building-house"
style={{ fontSize: "xx-large" }}
></i>
@ -138,6 +136,9 @@ const Header = () => {
))}
</ul>
</div>
</>
)}
{/* <div className="nav-item navbar-search-wrapper mb-0">
<a className="nav-item nav-link search-toggler px-0" href="#">