|
|
|
@@ -18,7 +18,11 @@ import { ABOUT_PAGE, BASE_PAGE, HOME_PAGE } from "../../constants/pages"; |
|
|
|
import { fetchMineProfile } from "../../store/actions/profile/profileActions"; |
|
|
|
import CreateOffer from "../Cards/CreateOfferCard/CreateOffer"; |
|
|
|
import useSearch from "../../hooks/useOffers/useSearch"; |
|
|
|
import { isAuthRoute, routeMatches } from "../../util/helpers/routeHelpers"; |
|
|
|
import { |
|
|
|
isAdminRoute, |
|
|
|
isAuthRoute, |
|
|
|
routeMatches, |
|
|
|
} from "../../util/helpers/routeHelpers"; |
|
|
|
import AboutHeader from "./AboutHeader/AboutHeader"; |
|
|
|
import SearchInput from "./SearchInput/SearchInput"; |
|
|
|
import DrawerContainer from "./DrawerContainer/DrawerContainer"; |
|
|
|
@@ -44,9 +48,9 @@ const Header = () => { |
|
|
|
const [shouldShow, setShouldShow] = useState(true); |
|
|
|
const routeMatch = useRouteMatch(); |
|
|
|
|
|
|
|
// Dont show header on auth routes(login, register, etc.) |
|
|
|
// Dont show header on auth routes(login, register, etc.) and admin routes |
|
|
|
useEffect(() => { |
|
|
|
if (isAuthRoute()) setShouldShow(false); |
|
|
|
if (isAuthRoute() || isAdminRoute()) setShouldShow(false); |
|
|
|
else setShouldShow(true); |
|
|
|
}, [routeMatch]); |
|
|
|
|
|
|
|
@@ -100,8 +104,12 @@ const Header = () => { |
|
|
|
setShowCreateOfferModal(false); |
|
|
|
}; |
|
|
|
|
|
|
|
if (!shouldShow) { |
|
|
|
return (<></>) |
|
|
|
} |
|
|
|
|
|
|
|
return ( |
|
|
|
<HeaderContainer style={{ display: shouldShow ? "block" : "none" }}> |
|
|
|
<HeaderContainer> |
|
|
|
<AppBar |
|
|
|
elevation={0} |
|
|
|
position="fixed" |