]> git.localhorst.tv Git - alttp.git/blob - resources/js/app/index.js
try to respond more appropriately
[alttp.git] / resources / js / app / index.js
1 import React from 'react';
2 import { Helmet } from 'react-helmet';
3 import { useTranslation } from 'react-i18next';
4
5 import Routes from './Routes';
6 import AlttpBaseRomProvider from '../helpers/AlttpBaseRomContext';
7 import { SNESProvider } from '../hooks/snes';
8 import { UserProvider } from '../hooks/user';
9 import i18n from '../i18n';
10
11 const App = () => {
12         const { t } = useTranslation();
13
14         React.useEffect(() => {
15                 window.Echo.channel('App.Control')
16                         .listen('PleaseRefresh', () => {
17                                 location.reload();
18                         });
19                 return () => {
20                         window.Echo.leave('App.Control');
21                 };
22         }, []);
23
24         return <AlttpBaseRomProvider>
25                 <SNESProvider>
26                         <UserProvider>
27                                 <Helmet>
28                                         <html lang={i18n.language} />
29                                         <title>{t('general.appName')}</title>
30                                         <meta name="description" content={t('general.appDescription')} />
31                                 </Helmet>
32                                 <Routes />
33                         </UserProvider>
34                 </SNESProvider>
35         </AlttpBaseRomProvider>;
36 };
37
38 export default App;