import React from 'react'; import { BrowserRouter, Link, Route, Switch, useLocation } from 'react-router-dom'; import { Provider } from 'react-redux'; import { useTranslation } from 'react-i18next'; import i18n from 'i18next'; import { initReactI18next } from 'react-i18next'; import { IndexPage } from './pages'; import { RankingPage } from './pages/ranking'; import { Header } from './components/Header'; import { TermPage } from './pages/term'; import { store } from './store'; import { ModalComponent } from './Modal'; import { useTheme } from './misc/theme'; import { getBrowserLanguage, resources } from './langs'; import { LOCALSTORAGE_KEY_LANG } from './const'; import 'xeltica-ui/dist/css/xeltica-ui.min.css'; import './style.scss'; document.body.classList.add('dark'); if (!localStorage[LOCALSTORAGE_KEY_LANG]) { localStorage[LOCALSTORAGE_KEY_LANG] = getBrowserLanguage(); } i18n .use(initReactI18next) .init({ resources, lng: localStorage[LOCALSTORAGE_KEY_LANG], interpolation: { escapeValue: false // react already safes from xss } }); const AppInner : React.VFC = () => { const $location = useLocation(); useTheme(); const {t} = useTranslation(); const error = (window as any).__misshaialert?.error; return error ? (

{t('error')}

{t('_error.sorry')}

{t('_error.additionalInfo')} {t(`_error.${error}`)}

(window as any).__misshaialert.error = null}>{t('retry')}
) : (
{$location.pathname !== '/' &&
}

(C)2020-2021 Xeltica

{t('termsOfService')}

); }; export const App: React.VFC = () => ( );