2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-08-10 05:40:55 +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 { Suspense } from 'react';
import { theme } from '../theme';
function LoadingFallback() { function LoadingFallback() {
return ( return (
<MantineProvider theme={theme}>
<Stack> <Stack>
<Center> <Center>
<Loader /> <Loader />
</Center> </Center>
</Stack> </Stack>
</MantineProvider>
); );
} }

View File

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