reduced chunks size
This commit is contained in:
@@ -1,23 +1,25 @@
|
|||||||
import { ThemeProvider } from '@emotion/react'
|
import { ThemeProvider } from '@emotion/react'
|
||||||
import {
|
|
||||||
ChevronLeft,
|
import ChevronLeft from '@mui/icons-material/ChevronLeft'
|
||||||
Dashboard,
|
import Dashboard from '@mui/icons-material/Dashboard'
|
||||||
FormatListBulleted,
|
import FormatListBulleted from '@mui/icons-material/FormatListBulleted'
|
||||||
Menu,
|
import Menu from '@mui/icons-material/Menu'
|
||||||
SettingsEthernet,
|
import SettingsIcon from '@mui/icons-material/Settings'
|
||||||
Settings as SettingsIcon,
|
import SettingsEthernet from '@mui/icons-material/SettingsEthernet'
|
||||||
Storage
|
import Storage from '@mui/icons-material/Storage'
|
||||||
} from '@mui/icons-material'
|
|
||||||
import {
|
import { Box, createTheme } from '@mui/material'
|
||||||
Box,
|
|
||||||
CircularProgress,
|
import CircularProgress from '@mui/material/CircularProgress'
|
||||||
CssBaseline,
|
import CssBaseline from '@mui/material/CssBaseline'
|
||||||
Divider,
|
import Divider from '@mui/material/Divider'
|
||||||
IconButton, List,
|
import IconButton from '@mui/material/IconButton'
|
||||||
ListItemIcon, ListItemText, Toolbar,
|
import List from '@mui/material/List'
|
||||||
Typography,
|
import ListItemIcon from '@mui/material/ListItemIcon'
|
||||||
createTheme
|
import ListItemText from '@mui/material/ListItemText'
|
||||||
} from '@mui/material'
|
import Toolbar from '@mui/material/Toolbar'
|
||||||
|
import Typography from '@mui/material/Typography'
|
||||||
|
|
||||||
import ListItemButton from '@mui/material/ListItemButton'
|
import ListItemButton from '@mui/material/ListItemButton'
|
||||||
import { grey } from '@mui/material/colors'
|
import { grey } from '@mui/material/colors'
|
||||||
import { Suspense, lazy, useMemo, useState } from 'react'
|
import { Suspense, lazy, useMemo, useState } from 'react'
|
||||||
@@ -27,9 +29,8 @@ import {
|
|||||||
BrowserRouter as Router,
|
BrowserRouter as Router,
|
||||||
Routes
|
Routes
|
||||||
} from 'react-router-dom'
|
} from 'react-router-dom'
|
||||||
import Home from './Home'
|
import AppBar from './components/AppBar'
|
||||||
import { AppBar } from './components/AppBar'
|
import Drawer from './components/Drawer'
|
||||||
import { Drawer } from './components/Drawer'
|
|
||||||
import { toggleListView } from './features/settings/settingsSlice'
|
import { toggleListView } from './features/settings/settingsSlice'
|
||||||
import { RootState, store } from './stores/store'
|
import { RootState, store } from './stores/store'
|
||||||
import { formatGiB } from './utils'
|
import { formatGiB } from './utils'
|
||||||
@@ -57,6 +58,7 @@ function AppContent() {
|
|||||||
setOpen(!open)
|
setOpen(!open)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Home = lazy(() => import('./Home'))
|
||||||
const Settings = lazy(() => import('./Settings'))
|
const Settings = lazy(() => import('./Settings'))
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -168,7 +170,11 @@ function AppContent() {
|
|||||||
>
|
>
|
||||||
<Toolbar />
|
<Toolbar />
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route path="/" element={<Home />} />
|
<Route path="/" element={
|
||||||
|
<Suspense fallback={<CircularProgress />}>
|
||||||
|
<Home />
|
||||||
|
</Suspense>
|
||||||
|
} />
|
||||||
<Route path="/settings" element={
|
<Route path="/settings" element={
|
||||||
<Suspense fallback={<CircularProgress />}>
|
<Suspense fallback={<CircularProgress />}>
|
||||||
<Settings />
|
<Settings />
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ interface AppBarProps extends MuiAppBarProps {
|
|||||||
|
|
||||||
const drawerWidth = 240;
|
const drawerWidth = 240;
|
||||||
|
|
||||||
export const AppBar = styled(MuiAppBar, {
|
const AppBar = styled(MuiAppBar, {
|
||||||
shouldForwardProp: (prop) => prop !== 'open',
|
shouldForwardProp: (prop) => prop !== 'open',
|
||||||
})<AppBarProps>(({ theme, open }) => ({
|
})<AppBarProps>(({ theme, open }) => ({
|
||||||
zIndex: theme.zIndex.drawer + 1,
|
zIndex: theme.zIndex.drawer + 1,
|
||||||
@@ -24,3 +24,5 @@ export const AppBar = styled(MuiAppBar, {
|
|||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
export default AppBar
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
import { styled } from '@mui/material';
|
import { styled } from '@mui/material'
|
||||||
import MuiDrawer from '@mui/material/Drawer';
|
import MuiDrawer from '@mui/material/Drawer'
|
||||||
|
|
||||||
const drawerWidth = 240;
|
const drawerWidth = 240
|
||||||
|
|
||||||
export const Drawer = styled(MuiDrawer, { shouldForwardProp: (prop) => prop !== 'open' })(
|
const Drawer = styled(MuiDrawer, { shouldForwardProp: (prop) => prop !== 'open' })(
|
||||||
({ theme, open }) => ({
|
({ theme, open }) => ({
|
||||||
'& .MuiDrawer-paper': {
|
'& .MuiDrawer-paper': {
|
||||||
position: 'relative',
|
position: 'relative',
|
||||||
@@ -27,4 +27,6 @@ export const Drawer = styled(MuiDrawer, { shouldForwardProp: (prop) => prop !==
|
|||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
);
|
)
|
||||||
|
|
||||||
|
export default Drawer
|
||||||
Reference in New Issue
Block a user