You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
72 lines
1.8 KiB
72 lines
1.8 KiB
4 years ago
|
import React, { PureComponent } from 'react';
|
||
|
import PropTypes from 'prop-types';
|
||
|
import { Provider } from 'react-redux';
|
||
|
import { HashRouter } from 'react-router-dom';
|
||
|
import * as Sentry from '@sentry/browser';
|
||
|
import { I18nProvider, LegacyI18nProvider } from '../contexts/i18n';
|
||
4 years ago
|
import {
|
||
|
MetaMetricsProvider,
|
||
|
LegacyMetaMetricsProvider,
|
||
4 years ago
|
} from '../contexts/metametrics';
|
||
4 years ago
|
import {
|
||
|
MetaMetricsProvider as NewMetaMetricsProvider,
|
||
|
LegacyMetaMetricsProvider as NewLegacyMetaMetricsProvider,
|
||
4 years ago
|
} from '../contexts/metametrics.new';
|
||
|
import ErrorPage from './error';
|
||
|
import Routes from './routes';
|
||
6 years ago
|
|
||
5 years ago
|
class Index extends PureComponent {
|
||
4 years ago
|
state = {};
|
||
6 years ago
|
|
||
4 years ago
|
static getDerivedStateFromError(error) {
|
||
4 years ago
|
return { error };
|
||
5 years ago
|
}
|
||
|
|
||
4 years ago
|
componentDidCatch(error) {
|
||
4 years ago
|
Sentry.captureException(error);
|
||
5 years ago
|
}
|
||
|
|
||
4 years ago
|
render() {
|
||
4 years ago
|
const { error, errorId } = this.state;
|
||
|
const { store } = this.props;
|
||
5 years ago
|
|
||
|
if (error) {
|
||
|
return (
|
||
|
<Provider store={store}>
|
||
5 years ago
|
<I18nProvider>
|
||
5 years ago
|
<LegacyI18nProvider>
|
||
4 years ago
|
<ErrorPage error={error} errorId={errorId} />
|
||
5 years ago
|
</LegacyI18nProvider>
|
||
5 years ago
|
</I18nProvider>
|
||
5 years ago
|
</Provider>
|
||
4 years ago
|
);
|
||
5 years ago
|
}
|
||
|
|
||
|
return (
|
||
|
<Provider store={store}>
|
||
|
<HashRouter hashType="noslash">
|
||
|
<MetaMetricsProvider>
|
||
5 years ago
|
<LegacyMetaMetricsProvider>
|
||
4 years ago
|
<NewMetaMetricsProvider>
|
||
|
<NewLegacyMetaMetricsProvider>
|
||
|
<I18nProvider>
|
||
|
<LegacyI18nProvider>
|
||
|
<Routes />
|
||
|
</LegacyI18nProvider>
|
||
|
</I18nProvider>
|
||
|
</NewLegacyMetaMetricsProvider>
|
||
|
</NewMetaMetricsProvider>
|
||
5 years ago
|
</LegacyMetaMetricsProvider>
|
||
5 years ago
|
</MetaMetricsProvider>
|
||
|
</HashRouter>
|
||
|
</Provider>
|
||
4 years ago
|
);
|
||
5 years ago
|
}
|
||
6 years ago
|
}
|
||
|
|
||
|
Index.propTypes = {
|
||
|
store: PropTypes.object,
|
||
4 years ago
|
};
|
||
6 years ago
|
|
||
4 years ago
|
export default Index;
|