blob: 83c2adad899c5a1e7d0c2e06e60d232009ed0d08 [file] [log] [blame]
simon26e79f72022-10-05 22:16:08 -04001/*
2 * Copyright (C) 2022 Savoir-faire Linux Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Affero General Public License as
6 * published by the Free Software Foundation; either version 3 of the
7 * License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Affero General Public License for more details.
13 *
14 * You should have received a copy of the GNU Affero General Public
15 * License along with this program. If not, see
16 * <https://www.gnu.org/licenses/>.
17 */
simond47ef9e2022-09-28 22:24:28 -040018'use strict';
19import './index.scss';
idillon5815c732022-09-16 13:54:45 -040020import './i18n';
Larbi Gharibe9af9732021-03-31 15:08:01 +010021
idillon8e6c0062022-09-16 13:34:43 -040022// import config from "../sentry-client.config.json"
idillon08f77172022-09-13 19:14:17 -040023import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
simon07b4eb02022-09-29 17:50:26 -040024import { StrictMode } from 'react';
25import { createRoot } from 'react-dom/client';
26import { Provider } from 'react-redux';
27import { BrowserRouter as Router } from 'react-router-dom';
idillon322e4ac2022-09-14 12:48:43 -040028import socketio from 'socket.io-client';
simon07b4eb02022-09-29 17:50:26 -040029
simon218d3d12022-10-01 17:27:01 -040030import App from './App';
simon35378692022-10-02 23:25:57 -040031import { SocketProvider } from './contexts/Socket';
simond8ca2f22022-10-11 23:30:55 -040032import { store } from './redux/store';
idillon08f77172022-09-13 19:14:17 -040033
34const queryClient = new QueryClient({
35 defaultOptions: {
36 queries: {
37 cacheTime: Infinity, // websocket is responsible to tell when data needs to be updated
38 },
39 },
simond47ef9e2022-09-28 22:24:28 -040040});
idillon5e897432022-09-16 13:28:09 -040041
simond47ef9e2022-09-28 22:24:28 -040042const socket = socketio();
idillon322e4ac2022-09-14 12:48:43 -040043
simond47ef9e2022-09-28 22:24:28 -040044const container = document.getElementById('root');
simon218d3d12022-10-01 17:27:01 -040045if (!container) {
46 throw new Error('Failed to get the root element');
47}
idillon169f64f2022-09-16 14:01:22 -040048const root = createRoot(container);
49root.render(
50 <Provider store={store}>
Adrien Béraud023f7cf2022-09-18 14:57:53 -040051 <StrictMode>
idillon08f77172022-09-13 19:14:17 -040052 <QueryClientProvider client={queryClient}>
idillon322e4ac2022-09-14 12:48:43 -040053 <SocketProvider socket={socket}>
54 <Router>
simond47ef9e2022-09-28 22:24:28 -040055 <App />
idillon322e4ac2022-09-14 12:48:43 -040056 </Router>
57 </SocketProvider>
idillon08f77172022-09-13 19:14:17 -040058 </QueryClientProvider>
Adrien Béraud023f7cf2022-09-18 14:57:53 -040059 </StrictMode>
idillon169f64f2022-09-16 14:01:22 -040060 </Provider>
61);