-
-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #426 from hackforla/264_error_handling
Added data error modal. Fix store not saving error
- Loading branch information
Showing
8 changed files
with
151 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,40 @@ | ||
import React from 'react'; | ||
import { connect } from 'react-redux'; | ||
import PropTypes from 'proptypes'; | ||
|
||
import Visualizations from '@components/Visualizations'; | ||
import Loader from '@components/common/Loader'; | ||
import Modal from '@components/common/Modal'; | ||
import Menu from '../menu/Menu'; | ||
import PinMap from '../../PinMap/PinMap'; | ||
import DataRequestError from './DataRequestError'; | ||
|
||
const Body = () => ( | ||
const Body = ({ | ||
openErrorModal, | ||
error, | ||
}) => ( | ||
<div id="body-container" className="body is-relative"> | ||
<Menu /> | ||
<main id="body-wrap"> | ||
<PinMap /> | ||
<Visualizations /> | ||
<Loader /> | ||
<Modal | ||
open={openErrorModal} | ||
content={<DataRequestError error={error} />} | ||
/> | ||
</main> | ||
</div> | ||
); | ||
|
||
export default Body; | ||
Body.propTypes = { | ||
error: PropTypes.shape({}).isRequired, | ||
openErrorModal: PropTypes.bool.isRequired, | ||
}; | ||
|
||
const mapStateToProps = state => ({ | ||
error: state.data.error, | ||
openErrorModal: state.ui.error.isOpen, | ||
}); | ||
|
||
export default connect(mapStateToProps, null)(Body); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import React from 'react'; | ||
import { connect } from 'react-redux'; | ||
import propTypes from 'proptypes'; | ||
|
||
import { setErrorModal } from '@reducers/ui'; | ||
|
||
import Icon from '@components/common/Icon'; | ||
import Button from '@components/common/Button'; | ||
|
||
const DataRequestError = ({ closeModal }) => ( | ||
<div className="data-request-error"> | ||
<div className="has-text-centered"> | ||
<Icon | ||
id="data-request-error-icon" | ||
icon="exclamation-triangle" | ||
color="warning" | ||
size="large" | ||
iconSize="3x" | ||
/> | ||
</div> | ||
<br /> | ||
<p className="has-text-centered has-text-weight-bold is-size-4"> | ||
Something went wrong | ||
</p> | ||
<br /> | ||
<p className="has-text-centered"> | ||
We failed to retrieve data for this request; please try again. | ||
</p> | ||
<br /> | ||
<div className="has-text-centered"> | ||
<Button | ||
label="Back" | ||
color="danger" | ||
handleClick={closeModal} | ||
/> | ||
</div> | ||
</div> | ||
); | ||
|
||
DataRequestError.propTypes = { | ||
closeModal: propTypes.func.isRequired, | ||
}; | ||
|
||
const mapDispatchToProps = dispatch => ({ | ||
closeModal: () => dispatch(setErrorModal(false)), | ||
}); | ||
|
||
export default connect(null, mapDispatchToProps)(DataRequestError); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.data-request-error { | ||
border-radius: 5px; | ||
background: rgba(153, 153, 153, 0.7); | ||
padding: 10px 35px; | ||
margin: 0 10em; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ | |
@import './main/tooltip'; | ||
@import './main/visualizations'; | ||
@import './main/loader'; | ||
@import './main/body'; |