e87390adb9
* update eslint and dependencies, fix linting errors that can be fixed with --fix * fix lots of linting errors * update eslintrc, fix some linting errors * fix all server side linting errors, untested * fix errors that fixing linting errors had caused * fix client side eslint errors * fix client side linting errors * fix refs lint errors * fix more linting errors * update eslint and dependencies, fix linting errors that can be fixed with --fix * fix lots of linting errors * update eslintrc, fix some linting errors * fix all server side linting errors, untested * fix errors that fixing linting errors had caused * fix client side eslint errors * fix client side linting errors * fix refs lint errors * fix more linting errors * fix some accessibility linting errors * fix a lot of linting errors * fix a billion more linting errors * hopefully fix all linting errors, still need to test * fix bugs that fixing linting had caused
44 lines
1.1 KiB
JavaScript
44 lines
1.1 KiB
JavaScript
import React, { PropTypes } from 'react';
|
|
import { connect } from 'react-redux';
|
|
import DevTools from './components/DevTools';
|
|
import { setPreviousPath } from '../IDE/actions/ide';
|
|
|
|
class App extends React.Component {
|
|
constructor(props, context) {
|
|
super(props, context);
|
|
this.state = { isMounted: false };
|
|
}
|
|
|
|
componentDidMount() {
|
|
this.setState({ isMounted: true }); // eslint-disable-line react/no-did-mount-set-state
|
|
}
|
|
|
|
componentWillReceiveProps(nextProps) {
|
|
if (nextProps.location !== this.props.location) {
|
|
this.props.setPreviousPath(this.props.location.pathname);
|
|
}
|
|
}
|
|
|
|
render() {
|
|
return (
|
|
<div className="app">
|
|
{this.state.isMounted && !window.devToolsExtension && process.env.NODE_ENV === 'development' && <DevTools />}
|
|
{this.props.children}
|
|
</div>
|
|
);
|
|
}
|
|
}
|
|
|
|
App.propTypes = {
|
|
children: PropTypes.element,
|
|
location: PropTypes.shape({
|
|
pathname: PropTypes.string
|
|
}).isRequired,
|
|
setPreviousPath: PropTypes.func.isRequired,
|
|
};
|
|
|
|
App.defaultProps = {
|
|
children: null
|
|
};
|
|
|
|
export default connect(() => ({}), { setPreviousPath })(App);
|