diff --git a/src/frontend/src/App.tsx b/src/frontend/src/App.tsx index c9b7e19def..762d5328b1 100644 --- a/src/frontend/src/App.tsx +++ b/src/frontend/src/App.tsx @@ -1,9 +1,6 @@ -import { useViewportSize } from '@mantine/hooks'; import { QueryClient } from '@tanstack/react-query'; import axios from 'axios'; -import { lazy } from 'react'; -import { Loadable } from './functions/loading'; import { useLocalState } from './states/LocalState'; import { useSessionState } from './states/SessionState'; @@ -18,23 +15,3 @@ export function setApiDefaults() { api.defaults.headers.common['Authorization'] = `Token ${token}`; } export const queryClient = new QueryClient(); - -function checkMobile() { - const { height, width } = useViewportSize(); - if (width < 425 || height < 425) return true; - return false; -} - -const MobileAppView = Loadable(lazy(() => import('./views/MobileAppView'))); -const DesktopAppView = Loadable(lazy(() => import('./views/DesktopAppView'))); - -// Main App -export default function App() { - // Check if mobile - if (checkMobile()) { - return ; - } - - // Main App component - return ; -} diff --git a/src/frontend/src/main.tsx b/src/frontend/src/main.tsx index 53322dc2b2..020f3c7efe 100644 --- a/src/frontend/src/main.tsx +++ b/src/frontend/src/main.tsx @@ -4,8 +4,8 @@ import ReactDOM from 'react-dom/client'; import 'react-grid-layout/css/styles.css'; import 'react-resizable/css/styles.css'; -import App from './App'; import { HostList } from './states/states'; +import MainView from './views/MainView'; // define settings declare global { @@ -71,7 +71,7 @@ export const base_url = window.INVENTREE_SETTINGS.base_url || 'platform'; ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render( - + ); diff --git a/src/frontend/src/views/MainView.tsx b/src/frontend/src/views/MainView.tsx new file mode 100644 index 0000000000..473ff9b7bf --- /dev/null +++ b/src/frontend/src/views/MainView.tsx @@ -0,0 +1,24 @@ +import { useViewportSize } from '@mantine/hooks'; +import { lazy } from 'react'; + +import { Loadable } from '../functions/loading'; + +function checkMobile() { + const { height, width } = useViewportSize(); + if (width < 425 || height < 425) return true; + return false; +} + +const MobileAppView = Loadable(lazy(() => import('./MobileAppView'))); +const DesktopAppView = Loadable(lazy(() => import('./DesktopAppView'))); + +// Main App +export default function MainView() { + // Check if mobile + if (checkMobile()) { + return ; + } + + // Main App component + return ; +}