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

Commit

Permalink
Auto-Lint with Prettier
Browse files Browse the repository at this point in the history
When running `./scripts/server`, files will now be autoformatted with
Prettier. This commit is the results of running formatting on all js/jsx
files in the client app.
  • Loading branch information
TaiWilkin committed Mar 4, 2021
1 parent 5748f18 commit a242edf
Show file tree
Hide file tree
Showing 169 changed files with 7,636 additions and 6,600 deletions.
68 changes: 38 additions & 30 deletions src/app/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,12 @@ const appStyles = Object.freeze({

class App extends Component {
componentDidMount() {
window.addEventListener('resize', () => this.props.handleWindowResize({
innerHeight: window.innerHeight,
innerWidth: window.innerWidth,
}));
window.addEventListener('resize', () =>
this.props.handleWindowResize({
innerHeight: window.innerHeight,
innerWidth: window.innerWidth,
}),
);

window.setGridColorRamp = this.props.setRamp;

Expand All @@ -89,7 +91,8 @@ class App extends Component {
render() {
const { fetchingFeatureFlags, embed } = this.props;

const mainPanelStyle = embed ? { ...appStyles.mainPanelStyle, bottom: 0, top: 0 }
const mainPanelStyle = embed
? { ...appStyles.mainPanelStyle, bottom: 0, top: 0 }
: appStyles.mainPanelStyle;
return (
<ErrorBoundary>
Expand All @@ -105,7 +108,11 @@ class App extends Component {
render={() => (
<FeatureFlag
flag={CLAIM_A_FACILITY}
alternative={<Route component={MapAndSidebar} />}
alternative={
<Route
component={MapAndSidebar}
/>
}
>
<Route component={ClaimFacility} />
</FeatureFlag>
Expand All @@ -118,21 +125,23 @@ class App extends Component {
flag={CLAIM_A_FACILITY}
alternative={<RouteNotFound />}
>
<Route component={ClaimedFacilities} />
<Route
component={ClaimedFacilities}
/>
</FeatureFlag>
)}
/>
<Route
path={facilitiesRoute}
render={
() => {
if (fetchingFeatureFlags) {
return <CircularProgress />;
}

return <Route component={MapAndSidebar} />;
render={() => {
if (fetchingFeatureFlags) {
return <CircularProgress />;
}
}

return (
<Route component={MapAndSidebar} />
);
}}
/>
<Route
exact
Expand Down Expand Up @@ -196,15 +205,15 @@ class App extends Component {
<Route
exact
path={mainRoute}
render={
() => {
if (fetchingFeatureFlags) {
return <CircularProgress />;
}

return <Route component={MapAndSidebar} />;
render={() => {
if (fetchingFeatureFlags) {
return <CircularProgress />;
}
}

return (
<Route component={MapAndSidebar} />
);
}}
/>
<Route render={() => <RouteNotFound />} />
</Switch>
Expand All @@ -229,12 +238,8 @@ App.propTypes = {
};

function mapStateToProps({
featureFlags: {
fetching: fetchingFeatureFlags,
},
embeddedMap: {
embed,
},
featureFlags: { fetching: fetchingFeatureFlags },
embeddedMap: { embed },
}) {
return {
fetchingFeatureFlags,
Expand All @@ -252,4 +257,7 @@ function mapDispatchToProps(dispatch) {
};
}

export default connect(mapStateToProps, mapDispatchToProps)(withStyles(appStyles)(App));
export default connect(
mapStateToProps,
mapDispatchToProps,
)(withStyles(appStyles)(App));
94 changes: 60 additions & 34 deletions src/app/src/actions/adjustFacilityMatches.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,28 @@ import {
makePromoteFacilityMatchAPIURL,
} from '../util/util';

export const startFetchFacilityToAdjust = createAction('START_FETCH_FACILITY_TO_ADJUST');
export const failFetchFacilityToAdjust = createAction('FAIL_FETCH_FACILITY_TO_ADJUST');
export const completeFetchFacilityToAdjust = createAction('COMPLETE_FETCH_FACILITY_TO_ADJUST');
export const startFetchFacilityToAdjust = createAction(
'START_FETCH_FACILITY_TO_ADJUST',
);
export const failFetchFacilityToAdjust = createAction(
'FAIL_FETCH_FACILITY_TO_ADJUST',
);
export const completeFetchFacilityToAdjust = createAction(
'COMPLETE_FETCH_FACILITY_TO_ADJUST',
);
export const clearFacilityToAdjust = createAction('CLEAR_FACILITY_TO_ADJUST');
export const resetAdjustFacilityState = createAction('RESET_ADJUST_FACILITY_STATE');
export const updateFacilityToAdjustOARID = createAction('UPDATE_FACILITY_TO_ADJUST_OAR_ID');
export const resetAdjustFacilityState = createAction(
'RESET_ADJUST_FACILITY_STATE',
);
export const updateFacilityToAdjustOARID = createAction(
'UPDATE_FACILITY_TO_ADJUST_OAR_ID',
);

export function fetchFacilityToAdjust() {
return (dispatch, getState) => {
const {
adjustFacilityMatches: {
facility: {
oarID,
},
facility: { oarID },
},
} = getState();

Expand All @@ -34,25 +42,31 @@ export function fetchFacilityToAdjust() {
return apiRequest
.get(makeSplitFacilityAPIURL(oarID))
.then(({ data }) => dispatch(completeFetchFacilityToAdjust(data)))
.catch(err => dispatch(logErrorAndDispatchFailure(
err,
'An error prevented fetching that facility',
failFetchFacilityToAdjust,
)));
.catch(err =>
dispatch(
logErrorAndDispatchFailure(
err,
'An error prevented fetching that facility',
failFetchFacilityToAdjust,
),
),
);
};
}

export const startSplitFacilityMatch = createAction('START_SPLIT_FACILITY_MATCH');
export const startSplitFacilityMatch = createAction(
'START_SPLIT_FACILITY_MATCH',
);
export const failSplitFacilityMatch = createAction('FAIL_SPLIT_FACILITY_MATCH');
export const completeSplitFacilityMatch = createAction('COMPLETE_SPLIT_FACILITY_MATCH');
export const completeSplitFacilityMatch = createAction(
'COMPLETE_SPLIT_FACILITY_MATCH',
);

export function splitFacilityMatch(matchID) {
return (dispatch, getState) => {
const {
adjustFacilityMatches: {
facility: {
oarID,
},
facility: { oarID },
},
} = getState();

Expand All @@ -65,25 +79,33 @@ export function splitFacilityMatch(matchID) {
return apiRequest
.post(makeSplitFacilityAPIURL(oarID), { match_id: matchID })
.then(({ data }) => dispatch(completeSplitFacilityMatch(data)))
.catch(err => dispatch(logErrorAndDispatchFailure(
err,
'An error prevented splitting that facility match',
failSplitFacilityMatch,
)));
.catch(err =>
dispatch(
logErrorAndDispatchFailure(
err,
'An error prevented splitting that facility match',
failSplitFacilityMatch,
),
),
);
};
}

export const startPromoteFacilityMatch = createAction('START_PROMOTE_FACILITY_MATCH');
export const failPromoteFacilityMatch = createAction('FAIL_PROMOTE_FACILITY_MATCH');
export const completePromoteFacilityMatch = createAction('COMPLETE_PROMOTE_FACILITY_MATCH');
export const startPromoteFacilityMatch = createAction(
'START_PROMOTE_FACILITY_MATCH',
);
export const failPromoteFacilityMatch = createAction(
'FAIL_PROMOTE_FACILITY_MATCH',
);
export const completePromoteFacilityMatch = createAction(
'COMPLETE_PROMOTE_FACILITY_MATCH',
);

export function promoteFacilityMatch(matchID) {
return (dispatch, getState) => {
const {
adjustFacilityMatches: {
facility: {
oarID,
},
facility: { oarID },
},
} = getState();

Expand All @@ -96,10 +118,14 @@ export function promoteFacilityMatch(matchID) {
return apiRequest
.post(makePromoteFacilityMatchAPIURL(oarID), { match_id: matchID })
.then(({ data }) => dispatch(completePromoteFacilityMatch(data)))
.catch(err => dispatch(logErrorAndDispatchFailure(
err,
'An error prevented promoting that facility match',
failPromoteFacilityMatch,
)));
.catch(err =>
dispatch(
logErrorAndDispatchFailure(
err,
'An error prevented promoting that facility match',
failPromoteFacilityMatch,
),
),
);
};
}
Loading

0 comments on commit a242edf

Please sign in to comment.