Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed disappearing NC boundaries #1066

Merged
merged 1 commit into from
Apr 1, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 24 additions & 12 deletions client/Routes.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import React from 'react';
import { Switch, Route, Redirect } from 'react-router-dom';
import {
Switch,
Route,
Redirect,
useLocation,
} from 'react-router-dom';
import Box from '@material-ui/core/Box';
import Desktop from '@components/main/Desktop';
import Reports from '@components/main/Reports';
import Privacy from '@components/main/Privacy';
Expand All @@ -8,17 +14,23 @@ import Blog from '@components/main/Blog';
import ContactForm from '@components/main/ContactForm';

export default function Routes() {
const { pathname } = useLocation();

return (
<Switch>
<Route path="/map" component={Desktop} />
<Route path="/reports" component={Reports} />
<Route path="/privacy" component={Privacy} />
<Route path="/faqs" component={Faqs} />
<Route path="/blog" component={Blog} />
<Route path="/contact" component={ContactForm} />
<Route path="/">
<Redirect to="map" />
</Route>
</Switch>
<>
<Box visibility={pathname !== '/map' ? 'hidden' : 'visible'}>
<Desktop />
</Box>
<Switch>
<Route path="/reports" component={Reports} />
<Route path="/privacy" component={Privacy} />
<Route path="/faqs" component={Faqs} />
<Route path="/blog" component={Blog} />
<Route path="/contact" component={ContactForm} />
<Route path="/">
<Redirect to="map" />
</Route>
</Switch>
</>
);
}