浏览代码

Fixed minor bugs

feature/646
Djordje Mitrovic 3 年前
父节点
当前提交
08be822971

+ 1
- 1
src/components/Cards/FilterCard/FilterFooter/FilterFooter.js 查看文件

@@ -12,7 +12,7 @@ const FilterFooter = (props) => {
const filters = props.filters;
const handleFilters = () => {
filters.paging.changePage(1);
filters.search.clear();
// filters.search.clear();
filters.applyFilters();
props.toggleFilters();
};

+ 12
- 4
src/components/Header/Header.js 查看文件

@@ -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"

+ 7
- 0
src/util/helpers/routeHelpers.js 查看文件

@@ -1,4 +1,5 @@
import {
ADMIN_HOME_PAGE,
ADMIN_LOGIN_PAGE,
FORGOT_PASSWORD_MAIL_SENT,
FORGOT_PASSWORD_PAGE,
@@ -33,12 +34,18 @@ export const isAuthRoute = () => {
routeMatches(REGISTER_SUCCESSFUL_PAGE) ||
routeMatches(FORGOT_PASSWORD_PAGE) ||
routeMatches(FORGOT_PASSWORD_MAIL_SENT) ||
routeMatches(ADMIN_LOGIN_PAGE) ||
dynamicRouteMatches(RESET_PASSWORD_PAGE)
) {
return true;
}
return false;
};
export const isAdminRoute = () => {
if (routeMatches(ADMIN_LOGIN_PAGE) || routeMatches(ADMIN_HOME_PAGE))
return true;
return false;
};
export const dynamicRouteMatches = (dynamicRoute) => {
const charactersToDelete =
(dynamicRoute.length - dynamicRoute.indexOf(":")) * -1;

正在加载...
取消
保存