2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-08-07 04:12:11 +00:00

move context to loadable

This commit is contained in:
Matthias Mair
2024-04-15 21:31:46 +02:00
parent fed2cecafb
commit d5eb0bf659
2 changed files with 12 additions and 18 deletions

View File

@@ -1,13 +1,17 @@
import { Center, Loader, Stack } from '@mantine/core';
import { Center, Loader, MantineProvider, Stack } from '@mantine/core';
import { Suspense } from 'react';
import { theme } from '../theme';
function LoadingFallback() {
return (
<Stack>
<Center>
<Loader />
</Center>
</Stack>
<MantineProvider theme={theme}>
<Stack>
<Center>
<Loader />
</Center>
</Stack>
</MantineProvider>
);
}

View File

@@ -1,4 +1,3 @@
import { MantineProvider } from '@mantine/core';
import '@mantine/core/styles.css';
import { useViewportSize } from '@mantine/hooks';
import { lazy, useEffect } from 'react';
@@ -6,7 +5,6 @@ import { lazy, useEffect } from 'react';
import { setApiDefaults } from '../App';
import { Loadable } from '../functions/loading';
import { useLocalState } from '../states/LocalState';
import { theme } from '../theme';
function checkMobile() {
const { height, width } = useViewportSize();
@@ -28,17 +26,9 @@ export default function MainView() {
// Check if mobile
if (!allowMobile && checkMobile()) {
return (
<MantineProvider theme={theme}>
<MobileAppView />
</MantineProvider>
);
return <MobileAppView />;
}
// Main App component
return (
<MantineProvider theme={theme}>
<DesktopAppView />
</MantineProvider>
);
return <DesktopAppView />;
}