handle poject selector when there are 0 or 1 projects
This commit is contained in:
parent
23bd307a37
commit
f14644b3b4
@ -14,7 +14,7 @@ import { useEffect, useState } from "react";
|
||||
const Header = () => {
|
||||
const { profile } = useProfile();
|
||||
const location = useLocation();
|
||||
const dispatch = useDispatch( changeMaster( "Job Role" ) );
|
||||
const dispatch = useDispatch(changeMaster("Job Role"));
|
||||
const { data, loading } = useMaster();
|
||||
const navigate = useNavigate();
|
||||
|
||||
@ -105,72 +105,39 @@ const Header = () => {
|
||||
className="navbar-nav-right d-flex align-items-center justify-content-between"
|
||||
id="navbar-collapse"
|
||||
>
|
||||
<div className=" align-items-center">
|
||||
{projects?.length > 0 && ( <div className=" align-items-center">
|
||||
{!isProjectPath && (
|
||||
<>
|
||||
<i
|
||||
className="rounded-circle bx bx-building-house"
|
||||
style={{ fontSize: "xx-large" }}
|
||||
></i>
|
||||
<div className="btn-group">
|
||||
<button
|
||||
className={`btn btn-sm-sm btn-xl ${projects?.length > 1 && "dropdown-toggle" } px-1`}
|
||||
type="button"
|
||||
data-bs-toggle="dropdown"
|
||||
aria-expanded="false"
|
||||
>
|
||||
{displayText}
|
||||
</button>
|
||||
|
||||
<i
|
||||
className="rounded-circle bx bx-building-house"
|
||||
style={{ fontSize: "xx-large" }}
|
||||
></i>
|
||||
<div className="btn-group">
|
||||
<button
|
||||
className="btn btn-sm-sm btn-xl dropdown-toggle px-1"
|
||||
type="button"
|
||||
data-bs-toggle="dropdown"
|
||||
aria-expanded="false"
|
||||
>
|
||||
{displayText}
|
||||
</button>
|
||||
|
||||
<ul className="dropdown-menu">
|
||||
{projects?.map((project) => (
|
||||
<li key={project?.id}>
|
||||
<button
|
||||
className="dropdown-item"
|
||||
onClick={() => dispatch(setProjectId(project?.id))}
|
||||
>
|
||||
{project?.name}
|
||||
</button>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
{projects?.length > 1 && ( <ul className="dropdown-menu">
|
||||
{projects?.map((project) => (
|
||||
<li key={project?.id}>
|
||||
<button
|
||||
className="dropdown-item"
|
||||
onClick={() => dispatch(setProjectId(project?.id))}
|
||||
>
|
||||
{project?.name}
|
||||
</button>
|
||||
</li>
|
||||
))}
|
||||
</ul>)}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
|
||||
{/* <div className="nav-item navbar-search-wrapper mb-0">
|
||||
<a className="nav-item nav-link search-toggler px-0" href="#">
|
||||
<span
|
||||
className="d-inline-block text-body-secondary fw-normal"
|
||||
id="autocomplete"
|
||||
>
|
||||
<div
|
||||
className="aa-Autocomplete"
|
||||
role="combobox"
|
||||
aria-expanded="false"
|
||||
aria-haspopup="listbox"
|
||||
aria-labelledby="autocomplete-0-label"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
className="aa-DetachedSearchButton"
|
||||
title="Search"
|
||||
id="autocomplete-0-label"
|
||||
>
|
||||
<div className="aa-DetachedSearchButtonIcon"></div>
|
||||
<div className="aa-DetachedSearchButtonPlaceholder">
|
||||
Search -{" "}
|
||||
<span className="font-italic">Coming Soon...</span>
|
||||
</div>
|
||||
<div className="aa-DetachedSearchButtonQuery"></div>
|
||||
</button>
|
||||
</div>
|
||||
</span>
|
||||
</a>
|
||||
</div> */}
|
||||
</div>
|
||||
</div>)}
|
||||
|
||||
<ul className="navbar-nav flex-row align-items-center ms-md-auto">
|
||||
<li className="nav-item dropdown-shortcuts navbar-dropdown dropdown me-2 me-xl-0">
|
||||
|
Loading…
x
Reference in New Issue
Block a user