2023-04-27 17:04:33 -04:00
|
|
|
import loadable from '@loadable/component';
|
2023-09-27 02:07:40 -04:00
|
|
|
import { ThemeProvider } from '@mui/material/styles';
|
2022-10-28 01:09:59 -04:00
|
|
|
import { History } from '@remix-run/router';
|
2024-01-05 11:23:33 -05:00
|
|
|
import { QueryClientProvider } from '@tanstack/react-query';
|
2023-06-07 03:38:39 +03:00
|
|
|
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
|
2023-09-30 01:17:37 -04:00
|
|
|
import React from 'react';
|
2022-10-28 01:09:59 -04:00
|
|
|
|
2023-09-27 02:07:40 -04:00
|
|
|
import { ApiProvider } from 'hooks/useApi';
|
|
|
|
import { WebConfigProvider } from 'hooks/useWebConfig';
|
|
|
|
import theme from 'themes/theme';
|
2024-01-05 11:23:33 -05:00
|
|
|
import { queryClient } from 'utils/query/queryClient';
|
2022-10-28 01:09:59 -04:00
|
|
|
|
2023-10-06 20:29:54 -07:00
|
|
|
const StableAppRouter = loadable(() => import('./apps/stable/AppRouter'));
|
2023-10-06 20:26:00 -07:00
|
|
|
const RootAppRouter = loadable(() => import('./RootAppRouter'));
|
2023-04-27 17:04:33 -04:00
|
|
|
|
2023-10-06 20:45:37 -07:00
|
|
|
const RootApp = ({ history }: Readonly<{ history: History }>) => {
|
2023-04-13 00:47:34 +03:00
|
|
|
const layoutMode = localStorage.getItem('layout');
|
2023-09-27 02:07:40 -04:00
|
|
|
const isExperimentalLayout = layoutMode === 'experimental';
|
2022-11-18 18:58:11 -05:00
|
|
|
|
2022-10-28 01:09:59 -04:00
|
|
|
return (
|
2023-10-06 20:45:37 -07:00
|
|
|
<QueryClientProvider client={queryClient}>
|
|
|
|
<ApiProvider>
|
|
|
|
<WebConfigProvider>
|
|
|
|
<ThemeProvider theme={theme}>
|
|
|
|
{isExperimentalLayout ?
|
|
|
|
<RootAppRouter history={history} /> :
|
|
|
|
<StableAppRouter history={history} />
|
|
|
|
}
|
|
|
|
</ThemeProvider>
|
|
|
|
</WebConfigProvider>
|
|
|
|
</ApiProvider>
|
|
|
|
<ReactQueryDevtools initialIsOpen={false} />
|
|
|
|
</QueryClientProvider>
|
2022-10-28 01:09:59 -04:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2023-04-27 17:04:33 -04:00
|
|
|
export default RootApp;
|