Skip to content

Commit

Permalink
Refactor routes so map view is always the main view
Browse files Browse the repository at this point in the history
  • Loading branch information
nathandao committed May 26, 2020
1 parent ec1dbfc commit 59b4a22
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions src/frontend/main/MainWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const MainWrapper = (props: MainWrapperProps) => {
const { t } = useTranslation(['main']);
const showSubNav =
props.location && props.location.pathname
? ['/map', '/cities', '/map-embed', '/map-embed/', '/map-embed/cities', '/map-embed/cities/'].indexOf(
? ['/', '/cities', '/map-embed', '/map-embed/', '/map-embed/cities', '/map-embed/cities/'].indexOf(
props.location.pathname,
) > -1
: false;
Expand Down Expand Up @@ -175,23 +175,23 @@ const MainWrapper = (props: MainWrapperProps) => {
{/*
* Route structure for stat views:
* ==============================
* / -> Overview
* /map -> MapView
* /cities -> TableView
* / -> MapView
* /overview -> MapView
* /cities -> TableView
* /map-embed/ -> MapView
* /map-embed/overview -> OverView
* /map-embed/cities -> TableView
* */}

<Router>
<Overview path="/" isEmbed={false} data={data} />
<MapView
path="map"
path="/"
isEmbed={isEmbed}
dataForMap={dataForMap}
totalResponses={totalResponses}
lastUpdated={lastUpdated}
/>
<Overview path="overview" isEmbed={false} data={data} />
<TableView path="cities" isEmbed={isEmbed} cities={cities} data={data} lastUpdated={lastUpdated} />

<MapView
Expand Down
4 changes: 2 additions & 2 deletions src/frontend/main/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,15 @@ const Navigation = ({ setMenuOpen }: MenuProps) => {
</li>
<li>
<LinkItem
to="/"
to="overview"
linkText={t('overview')}
setMenuOpen={setMenuOpen}
icon={match => <OverviewIcon fillColor={match ? '#000' : '#0047FF'} />}
/>
</li>
<li>
<LinkItem
to="/map"
to="/"
linkText={t('map')}
setMenuOpen={setMenuOpen}
icon={match => <MapIcon fillColor={match ? '#000' : '#0047FF'} />}
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/main/Overview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const Label = styled.label`
const Overview = (props: OverviewProps) => {
const { t } = useTranslation(['symptoms', 'main']);
const [selectedCity, setSelectedCity] = useState('');
const mapPath = props.isEmbed ? '/map-embed' : '/map';
const mapPath = props.isEmbed ? '/map-embed' : '/';

const finlandTotalData = {
population: 0,
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/main/SubNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const SubNavLink = styled.span<SubNavLinkProps>`
`;

const SubNav = ({ isEmbed }: SubNavProps) => {
const mapPath = isEmbed ? '/map-embed' : '/map';
const mapPath = isEmbed ? '/map-embed' : '/';
const citiesPath = isEmbed ? '/map-embed/cities' : '/cities';
const { t } = useTranslation(['main']);

Expand Down

0 comments on commit 59b4a22

Please sign in to comment.