simon | 26e79f7 | 2022-10-05 22:16:08 -0400 | [diff] [blame] | 1 | /* |
| 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 | */ |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 18 | 'use strict'; |
| 19 | import './index.scss'; |
idillon | 5815c73 | 2022-09-16 13:54:45 -0400 | [diff] [blame] | 20 | import './i18n'; |
Larbi Gharib | e9af973 | 2021-03-31 15:08:01 +0100 | [diff] [blame] | 21 | |
Michelle Sepkap Sime | 51c0045 | 2022-10-31 21:26:38 -0400 | [diff] [blame] | 22 | import { ThemeProvider } from '@mui/material/styles'; |
idillon | 08f7717 | 2022-09-13 19:14:17 -0400 | [diff] [blame] | 23 | import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; |
simon | 07b4eb0 | 2022-09-29 17:50:26 -0400 | [diff] [blame] | 24 | import { StrictMode } from 'react'; |
| 25 | import { createRoot } from 'react-dom/client'; |
| 26 | import { Provider } from 'react-redux'; |
simon | 3f5f3e7 | 2022-11-08 21:01:57 -0500 | [diff] [blame] | 27 | import { RouterProvider } from 'react-router-dom'; |
simon | 07b4eb0 | 2022-09-29 17:50:26 -0400 | [diff] [blame] | 28 | |
simon | d8ca2f2 | 2022-10-11 23:30:55 -0400 | [diff] [blame] | 29 | import { store } from './redux/store'; |
simon | 3f5f3e7 | 2022-11-08 21:01:57 -0500 | [diff] [blame] | 30 | import { router } from './router'; |
Michelle Sepkap Sime | 51c0045 | 2022-10-31 21:26:38 -0400 | [diff] [blame] | 31 | import defaultTheme from './themes/Default'; |
idillon | 08f7717 | 2022-09-13 19:14:17 -0400 | [diff] [blame] | 32 | |
| 33 | const queryClient = new QueryClient({ |
| 34 | defaultOptions: { |
| 35 | queries: { |
| 36 | cacheTime: Infinity, // websocket is responsible to tell when data needs to be updated |
| 37 | }, |
| 38 | }, |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 39 | }); |
idillon | 5e89743 | 2022-09-16 13:28:09 -0400 | [diff] [blame] | 40 | |
simon | d47ef9e | 2022-09-28 22:24:28 -0400 | [diff] [blame] | 41 | const container = document.getElementById('root'); |
simon | 218d3d1 | 2022-10-01 17:27:01 -0400 | [diff] [blame] | 42 | if (!container) { |
| 43 | throw new Error('Failed to get the root element'); |
| 44 | } |
idillon | 169f64f | 2022-09-16 14:01:22 -0400 | [diff] [blame] | 45 | const root = createRoot(container); |
| 46 | root.render( |
| 47 | <Provider store={store}> |
Adrien Béraud | 023f7cf | 2022-09-18 14:57:53 -0400 | [diff] [blame] | 48 | <StrictMode> |
idillon | 08f7717 | 2022-09-13 19:14:17 -0400 | [diff] [blame] | 49 | <QueryClientProvider client={queryClient}> |
Issam E. Maghni | 0432cb7 | 2022-11-12 06:09:26 +0000 | [diff] [blame] | 50 | <ThemeProvider theme={defaultTheme}> |
| 51 | <RouterProvider router={router} /> |
| 52 | </ThemeProvider> |
idillon | 08f7717 | 2022-09-13 19:14:17 -0400 | [diff] [blame] | 53 | </QueryClientProvider> |
Adrien Béraud | 023f7cf | 2022-09-18 14:57:53 -0400 | [diff] [blame] | 54 | </StrictMode> |
idillon | 169f64f | 2022-09-16 14:01:22 -0400 | [diff] [blame] | 55 | </Provider> |
| 56 | ); |