-
Notifications
You must be signed in to change notification settings - Fork 822
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 #1843 from rschamp/upgrade-react
Upgrade to React 16
- Loading branch information
Showing
22 changed files
with
305 additions
and
186 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
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,38 @@ | ||
const classNames = require('classnames'); | ||
const PropTypes = require('prop-types'); | ||
const React = require('react'); | ||
const FormattedMessage = require('react-intl').FormattedMessage; | ||
|
||
const Button = require('../forms/button.jsx'); | ||
|
||
require('./crashmessage.scss'); | ||
|
||
const CrashMessage = props => ( | ||
<div className={classNames(['crash-container', props.className])}> | ||
<img | ||
className="" | ||
src="/images/unhandled.png" | ||
/> | ||
<div className="crash-message"> | ||
<h2> | ||
<FormattedMessage id="general.error" /> | ||
</h2> | ||
<p> | ||
<FormattedMessage id="general.unhandledError" /> | ||
</p> | ||
<Button | ||
className="" | ||
onClick={props.onBack} | ||
> | ||
<FormattedMessage id="general.back" /> | ||
</Button> | ||
</div> | ||
</div> | ||
); | ||
|
||
CrashMessage.propTypes = { | ||
className: PropTypes.string, | ||
onBack: PropTypes.func | ||
}; | ||
|
||
module.exports = CrashMessage; |
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,22 @@ | ||
.crash-container { | ||
@import "../../colors"; | ||
@import "../../frameless"; | ||
|
||
margin: 3rem auto; | ||
|
||
border: 1px solid $ui-border; | ||
border-radius: 10px; | ||
background-color: $background-color; | ||
width: 60%; | ||
overflow: hidden; | ||
text-align: center; | ||
|
||
img { | ||
width: 100%; | ||
} | ||
|
||
.crash-message { | ||
margin: 2rem; | ||
} | ||
|
||
} |
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,36 @@ | ||
const PropTypes = require('prop-types'); | ||
const React = require('react'); | ||
|
||
const CrashMessageComponent = require('../crashmessage/crashmessage.jsx'); | ||
import log from '../../lib/log.js'; | ||
|
||
class ErrorBoundary extends React.Component { | ||
constructor (props) { | ||
super(props); | ||
this.state = { | ||
hasError: false | ||
}; | ||
} | ||
|
||
componentDidCatch (error, info) { | ||
// Display fallback UI | ||
this.setState({hasError: true}); | ||
log.error(`Unhandled Error: ${error}, info: ${info}`); | ||
} | ||
|
||
handleBack () { | ||
window.history.back(); | ||
} | ||
|
||
render () { | ||
if (this.state.hasError) { | ||
return <CrashMessageComponent onBack={this.handleBack} />; | ||
} | ||
return this.props.children; | ||
} | ||
} | ||
ErrorBoundary.propTypes = { | ||
children: PropTypes.node | ||
}; | ||
|
||
module.exports = ErrorBoundary; |
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
Oops, something went wrong.