/* eslint-disable jsx-a11y/no-href */ /* eslint import/no-absolute-path: [2, { esmodule: false, commonjs: false, amd: false }] */ import React, { useEffect } from 'react'; import PropTypes from 'prop-types'; import { unstable_HistoryRouter as HistoryRouter, Routes, Route, useLocation } from 'react-router-dom'; import { Container } from 'react-bootstrap'; import { I18nextProvider } from 'react-i18next'; import { Helmet } from 'react-helmet-async'; import { Meteor } from 'meteor/meteor'; import { withTracker } from 'meteor/react-meteor-data'; // 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 withRouterCompat from '../../components/withRouterCompat/withRouterCompat'; 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 CookieConsent from '../../components/CookieConsent/CookieConsent'; 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'; // Tracks route changes for Piwik/analytics. v6 replaces the old // contextTypes.router.history.listen wiring with the useLocation hook. const LocationListener = ({ children }) => { const location = useLocation(); useEffect(() => { // https://github.com/GoogleChrome/rendertron#rendering-budget-timeout window.renderComplete = true; Meteor.Piwik.trackPage(location.pathname); }, [location.pathname]); return children; }; LocationListener.propTypes = { children: PropTypes.oneOfType([ PropTypes.arrayOf(PropTypes.node), PropTypes.node ]).isRequired }; // v6 routes render an `element`, not a `component`, and no longer pass down // history/match/location. Wrap each class page once (module scope, so the // component identity stays stable across renders) with the v4-compat HOC. const IndexR = withRouterCompat(Index); const SubscriptionsR = withRouterCompat(Subscriptions); const NewSubscriptionR = withRouterCompat(NewSubscription); const ViewSubscriptionR = withRouterCompat(ViewSubscription); const EditSubscriptionR = withRouterCompat(EditSubscription); const ProfileR = withRouterCompat(Profile); const StatusR = withRouterCompat(Status); const FiresMapR = withRouterCompat(FiresMap); const ZonesMapR = withRouterCompat(ZonesMap); const FiresR = withRouterCompat(Fires); const AuthR = withRouterCompat(Auth); const SignupR = withRouterCompat(Signup); const LoginR = withRouterCompat(Login); const LogoutR = withRouterCompat(Logout); const VerifyEmailR = withRouterCompat(VerifyEmail); const RecoverPasswordR = withRouterCompat(RecoverPassword); const ResetPasswordR = withRouterCompat(ResetPassword); const App = props => ( /* https://react.i18next.com/components/i18nextprovider.html */