Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Kelly Innes committed Jul 9, 2019
1 parent edd8193 commit 0c8d176
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 52 deletions.
2 changes: 0 additions & 2 deletions src/app/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,10 @@ class App extends Component {
<main style={appStyles.mainPanelStyle}>
<Switch>
<Route
exact
path={mainRoute}
component={MapAndSidebar}
/>
<Route
exact
path={claimFacilityRoute}
render={() => (
<FeatureFlag
Expand Down
11 changes: 9 additions & 2 deletions src/app/src/components/ClaimedFacilities.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,31 @@ export default function ClaimedFacilities() {
(
<Switch>
<Route
exact
path={claimedFacilitiesDetailRoute}
render={() => 'Claimed Facility Details'}
/>
<Route render={() => 'My Facilities'} />
<Route
exact
path={claimedFacilitiesRoute}
render={() => 'My Claimed Facilities'}
/>
</Switch>
)
}
>
<Switch>
<Route
exact
path={claimedFacilitiesDetailRoute}
render={() => <Route component={ClaimedFacilitiesDetails} />}
/>
<Route
exact
path={claimedFacilitiesRoute}
component={ClaimedFacilitiesList}
/>
<Route render={() => <RouteNotFound />} />
<Route component={RouteNotFound} />
</Switch>
</AppGrid>
</AppOverflow>
Expand Down
26 changes: 24 additions & 2 deletions src/app/src/components/Dashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { checkWhetherUserHasDashboardAccess } from '../util/util';

import {
CLAIM_A_FACILITY,
dashboardRoute,
dashboardListsRoute,
dashboardClaimsRoute,
dashboardClaimsDetailsRoute,
Expand Down Expand Up @@ -86,10 +87,12 @@ function Dashboard({
(
<Switch>
<Route
exact
path={dashboardListsRoute}
render={() => 'Dashboard / Contributor Lists'}
/>
<Route
exact
path={dashboardClaimsDetailsRoute}
render={
() => (
Expand All @@ -103,6 +106,7 @@ function Dashboard({
}
/>
<Route
exact
path={dashboardClaimsRoute}
render={
() => (
Expand All @@ -116,40 +120,52 @@ function Dashboard({
}
/>
<Route
exact
path={dashboardDeleteFacilityRoute}
render={() => 'Dashboard / Delete Facility'}
/>
<Route
exact
path={dashboardMergeFacilitiesRoute}
render={() => 'Dashboard / Merge Facilities'}
/>
<Route
exact
path={dashboardSplitFacilityMatchesRoute}
render={() => 'Dashboard / Split Facility Matches'}
/>
<Route render={() => DASHBOARD_TITLE} />
<Route
exact
path={dashboardRoute}
render={() => 'Dashboard'}
/>
</Switch>
)
}
>
<Switch>
<Route
exact
path={dashboardListsRoute}
component={DashboardLists}
/>
<Route
exact
path={dashboardDeleteFacilityRoute}
component={DashboardDeleteFacility}
/>
<Route
exact
path={dashboardMergeFacilitiesRoute}
component={DashboardMergeFacilities}
/>
<Route
exact
path={dashboardSplitFacilityMatchesRoute}
component={DashboardSplitFacilityMatches}
/>
<Route
exact
path={dashboardClaimsDetailsRoute}
render={
() => (
Expand All @@ -163,6 +179,7 @@ function Dashboard({
}
/>
<Route
exact
path={dashboardClaimsRoute}
render={
() => (
Expand All @@ -175,7 +192,12 @@ function Dashboard({
)
}
/>
<Route render={() => linkSection} />
<Route
exact
path={dashboardRoute}
render={() => linkSection}
/>
<Route component={RouteNotFound} />
</Switch>
</AppGrid>
</AppOverflow>
Expand Down
12 changes: 5 additions & 7 deletions src/app/src/components/FacilityListItems.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { Component } from 'react';
import { arrayOf, bool, func, string } from 'prop-types';
import { connect } from 'react-redux';
import { Link, Switch, Route } from 'react-router-dom';
import { Link, Route } from 'react-router-dom';
import CircularProgress from '@material-ui/core/CircularProgress';
import Typography from '@material-ui/core/Typography';
import Grid from '@material-ui/core/Grid';
Expand Down Expand Up @@ -215,12 +215,10 @@ class FacilityListItems extends Component {
{
list.item_count
? (
<Switch>
<Route
path={facilityListItemsRoute}
component={FacilityListItemsTable}
/>
</Switch>)
<Route
path={facilityListItemsRoute}
component={FacilityListItemsTable}
/>)
: <FacilityListItemsEmpty />
}
</Grid>
Expand Down
121 changes: 82 additions & 39 deletions src/app/src/components/MapAndSidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@ import FilterSidebar from './FilterSidebar';
import FacilityDetailsSidebar from './FacilityDetailSidebar';
import FacilitiesMap from './FacilitiesMap';
import FacilitiesMapErrorMessage from './FacilitiesMapErrorMessage';
import RouteNotFound from './RouteNotFound';

import '../styles/css/Map.css';

import withQueryStringSync from '../util/withQueryStringSync';

import { facilityDetailsRoute } from '../util/constants';
import {
mainRoute,
facilitiesRoute,
facilityDetailsRoute,
} from '../util/constants';

class MapAndSidebar extends Component {
state = { hasError: false };
Expand All @@ -26,48 +31,86 @@ class MapAndSidebar extends Component {
}
}

renderMapAndDetailsSidebar = () => {
const { hasError } = this.state;

return (
<>
<Grid
item
xs={12}
sm={4}
id="panel-container"
>
<Route component={FacilityDetailsSidebar} />
</Grid>
<Grid
item
xs={12}
sm={8}
style={{ position: 'relative '}}
>
{
hasError
? <FacilitiesMapErrorMessage />
: <FacilitiesMap />
}
</Grid>
</>
);
}

renderMapAndFilterSidebar = () => {
const { hasError } = this.state;

return (
<>
<Grid
item
xs={12}
sm={4}
id="panel-container"
>
<Route component={FilterSidebar} />
</Grid>
<Grid
item
xs={12}
sm={8}
style={{ position: 'relative '}}
>
{
hasError
? <FacilitiesMapErrorMessage />
: <FacilitiesMap />
}
</Grid>
</>
);
}

render() {
return (
<Fragment>
<Grid container className="map-sidebar-container">
<Grid
item
xs={12}
sm={4}
id="panel-container"
>
<Switch>
<Route
path={facilityDetailsRoute}
component={FacilityDetailsSidebar}
/>
<Route component={FilterSidebar} />
</Switch>
</Grid>
<Grid
item
xs={12}
sm={8}
style={{ position: 'relative' }}
>
<Switch>
<Route
path={facilityDetailsRoute}
component={
this.state.hasError
? FacilitiesMapErrorMessage
: FacilitiesMap
}
/>
<Route
component={
this.state.hasError
? FacilitiesMapErrorMessage
: FacilitiesMap
}
/>
</Switch>
</Grid>
<Switch>
<Route
exact
path={facilityDetailsRoute}
render={this.renderMapAndDetailsSidebar}
/>
<Route
exact
path={facilitiesRoute}
render={this.renderMapAndFilterSidebar}
/>
<Route
exact
path={mainRoute}
render={this.renderMapAndFilterSidebar}
/>
<Route render={() => <RouteNotFound />} />
</Switch>
</Grid>
</Fragment>
);
Expand Down

0 comments on commit 0c8d176

Please sign in to comment.