/* eslint-disable jsx-a11y/no-href */ /* eslint import/no-absolute-path: [2, { esmodule: false, commonjs: false, amd: false }] */ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { Router, Switch, Route } from 'react-router-dom'; import { Grid } from 'react-bootstrap'; import { I18nextProvider } from 'react-i18next'; import { Helmet } from 'react-helmet'; import { Meteor } from 'meteor/meteor'; import { withTracker } from 'meteor/react-meteor-data'; import { Roles } from 'meteor/alanning:roles'; // https://github.com/gadicc/meteor-blaze-react-component/ import Blaze from 'meteor/gadicc:blaze-react-component'; // i18n import i18n, { i18nReady } from '/imports/startup/client/i18n'; import '/imports/startup/client/meta'; import '/imports/startup/client/ravenLogger'; import '/imports/startup/client/geolocation'; import '/imports/startup/client/piwik-start.js'; import '/imports/startup/client/reconnect.js'; import Reconnect from '../../components/Reconnect/Reconnect'; import Navigation from '../../components/Navigation/Navigation'; import Authenticated from '../../components/Authenticated/Authenticated'; import Public from '../../components/Public/Public'; import Index from '../../pages/Index/Index'; import Subscriptions from '../../pages/Subscriptions/Subscriptions'; import NewSubscription from '../../pages/NewSubscription/NewSubscription'; import ViewSubscription from '../../pages/ViewSubscription/ViewSubscription'; import EditSubscription from '../../pages/EditSubscription/EditSubscription'; import TestError from '../../pages/TestError/TestError'; import Signup from '../../pages/Signup/Signup'; import Auth from '../../pages/Auth/Auth'; import Login from '../../pages/Login/Login'; import Logout from '../../pages/Logout/Logout'; import Status from '../../pages/Status/Status'; 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 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 Footer from '../../components/Footer/Footer'; import Feedback from '../../components/Feedback/Feedback'; import ReSendEmail from '../../components/ReSendEmail/ReSendEmail'; import ErrorBoundary from '../../components/ErrorBoundary/ErrorBoundary'; import history from '../../components/History/History'; import '../../components/NotificationsObserver/NotificationsObserver'; import './App.scss'; class LocationListener extends Component { // https://stackoverflow.com/questions/43512450/react-router-v4-route-onchange-event componentDidMount() { // https://github.com/GoogleChrome/rendertron#rendering-budget-timeout window.renderComplete = true; this.handleLocationChange(this.context.router.history.location); this.unlisten = this.context.router.history.listen(this.handleLocationChange); } componentWillUnmount() { this.unlisten(); } handleLocationChange(location) { // your staff here console.log(`----- location: '${location.pathname}'`); Meteor.Piwik.trackPage(location.pathname); } // 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 */