diff --git a/imports/ui/components/ErrorBoundary/ErrorBoundary.js b/imports/ui/components/ErrorBoundary/ErrorBoundary.js index 1e0c654..a6676ec 100644 --- a/imports/ui/components/ErrorBoundary/ErrorBoundary.js +++ b/imports/ui/components/ErrorBoundary/ErrorBoundary.js @@ -4,9 +4,7 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; -import { translate } from 'react-i18next'; import { Row, Col } from 'react-bootstrap'; -import { withTracker } from 'meteor/react-meteor-data'; import ravenLogger from '/imports/startup/client/ravenLogger'; import './ErrorBoundary.scss'; @@ -14,7 +12,6 @@ import './ErrorBoundary.scss'; class ErrorBoundary extends Component { constructor(props) { super(props); - this.t = props.t; this.state = { hasError: false }; } @@ -29,33 +26,41 @@ class ErrorBoundary extends Component { } render() { + const { + appName, title, subTitle, children + } = this.props; if (this.state.hasError) { // You can render any custom fallback UI return (
-

{this.t('AppNameFull')}

-

{this.t('general-error-title')}

-

- {this.t('general-error-description')} -

+

{appName}

+

{title}

+

{subTitle}

); } - return this.props.children; + return children; } } ErrorBoundary.propTypes = { - t: PropTypes.func.isRequired + appName: PropTypes.string, + title: PropTypes.string, + subTitle: PropTypes.string, + children: PropTypes.oneOfType([ + PropTypes.arrayOf(PropTypes.node), + PropTypes.node + ]).isRequired }; ErrorBoundary.defaultProps = { + appName: 'All Against Fire!', + title: 'Upppps: Something has gone wrong', + subTitle: 'We are investigating the problem, try again in a while' }; -export default translate([], { wait: true })(withTracker(props => ({ - // props.something -}))(ErrorBoundary)); +export default ErrorBoundary; diff --git a/imports/ui/layouts/App/App.js b/imports/ui/layouts/App/App.js index c8fd5fd..52a57ca 100644 --- a/imports/ui/layouts/App/App.js +++ b/imports/ui/layouts/App/App.js @@ -37,16 +37,16 @@ import VerifyEmail from '../../pages/VerifyEmail/VerifyEmail'; import RecoverPassword from '../../pages/RecoverPassword/RecoverPassword'; import ResetPassword from '../../pages/ResetPassword/ResetPassword'; import Profile from '../../pages/Profile/Profile'; -import NotFound from '../../pages/NotFound/NotFound'; -import FiresMap from '../../pages/FiresMap/FiresMap'; import Fires from '../../pages/Fires/Fires'; import Sandbox from '../../pages/Sandbox/Sandbox'; +import ZonesMap from '../../pages/ZonesMap/ZonesMap'; +import FiresMap from '../../pages/FiresMap/FiresMap'; +import NotFound from '../../pages/NotFound/NotFound'; import Terms from '../../pages/Terms/Terms'; import About from '../../pages/About/About'; import Privacy from '../../pages/Privacy/Privacy'; import License from '../../pages/License/License'; import Credits from '../../pages/Credits/Credits'; -import ZonesMap from '../../pages/ZonesMap/ZonesMap'; import Footer from '../../components/Footer/Footer'; import Feedback from '../../components/Feedback/Feedback'; import ReSendEmail from '../../components/ReSendEmail/ReSendEmail'; @@ -57,9 +57,6 @@ import './App.scss'; class LocationListener extends Component { // https://stackoverflow.com/questions/43512450/react-router-v4-route-onchange-event - static contextTypes = { - router: PropTypes.object - }; componentDidMount() { this.handleLocationChange(this.context.router.history.location); @@ -75,82 +72,90 @@ class LocationListener extends Component { // your staff here console.log(`----- location: '${location.pathname}'`); Meteor.Piwik.trackPage(location.pathname); - // Meteor.isReadyForSpiderable = true; } + // https://stackoverflow.com/questions/39133797/react-only-return-props-children render() { return this.props.children; } } +LocationListener.contextTypes = { + router: PropTypes.object +}; + +LocationListener.propTypes = { + children: PropTypes.oneOfType([ + PropTypes.arrayOf(PropTypes.node), + PropTypes.node + ]).isRequired +}; + const App = props => ( /* https://react.i18next.com/components/i18nextprovider.html */ - - - - - { !props.loading ? -
- - - {i18n.t('AppName')} - - - - - - +
+ {props.i18nReady.get() && + + + + + + { !props.loading && +
+ + + {i18n.t('AppName')} + + + + + + - - - - {/* - - - - */} - - - - - - - {/* */} - - - - - - - - - - - {/* } /> */} + + + + + + + + + + + - - - - - - - - + + + + + + + + - - - -
- - - {props.i18nReady.get() && - - } -
: ''} -
-
-
-
+ + + + + + + + + + + + +
} + + + + + } +
); App.defaultProps = {