1- import { useCallback , useState } from 'react' ;
1+ import { Suspense , lazy , useCallback , useState } from 'react' ;
22import { Routes , Route } from 'react-router-dom' ;
33import { Menu } from 'lucide-react' ;
44import { useAuth } from './hooks/useAuth' ;
55import Sidebar from './components/Sidebar' ;
66import CommandPalette from './components/CommandPalette' ;
77import ErrorBoundary from './components/ErrorBoundary' ;
88import Login from './pages/Login' ;
9- import Dashboard from './pages/Dashboard' ;
10- import Catalog from './pages/Catalog' ;
11- import EntityDetail from './pages/EntityDetail' ;
12- import Actions from './pages/Actions' ;
13- import AuditLog from './pages/AuditLog' ;
14- import Settings from './pages/Settings' ;
15- import UsersPage from './pages/Users' ;
16- import Plugins from './pages/Plugins' ;
17- import StatusMonitor from './pages/StatusMonitor' ;
18- import GitOps from './pages/GitOps' ;
19- import Harbor from './pages/Harbor' ;
20- import Nexus from './pages/Nexus' ;
21- import RBAC from './pages/RBAC' ;
22- import TopologyExplorer from './pages/TopologyExplorer' ;
23- import Flow from './pages/Flow' ;
9+ const Dashboard = lazy ( ( ) => import ( './pages/Dashboard' ) ) ;
10+ const Catalog = lazy ( ( ) => import ( './pages/Catalog' ) ) ;
11+ const EntityDetail = lazy ( ( ) => import ( './pages/EntityDetail' ) ) ;
12+ const Actions = lazy ( ( ) => import ( './pages/Actions' ) ) ;
13+ const AuditLog = lazy ( ( ) => import ( './pages/AuditLog' ) ) ;
14+ const Settings = lazy ( ( ) => import ( './pages/Settings' ) ) ;
15+ const UsersPage = lazy ( ( ) => import ( './pages/Users' ) ) ;
16+ const Plugins = lazy ( ( ) => import ( './pages/Plugins' ) ) ;
17+ const StatusMonitor = lazy ( ( ) => import ( './pages/StatusMonitor' ) ) ;
18+ const GitOps = lazy ( ( ) => import ( './pages/GitOps' ) ) ;
19+ const Harbor = lazy ( ( ) => import ( './pages/Harbor' ) ) ;
20+ const Nexus = lazy ( ( ) => import ( './pages/Nexus' ) ) ;
21+ const RBAC = lazy ( ( ) => import ( './pages/RBAC' ) ) ;
22+ const TopologyExplorer = lazy ( ( ) => import ( './pages/TopologyExplorer' ) ) ;
23+ const Flow = lazy ( ( ) => import ( './pages/Flow' ) ) ;
2424
2525
2626function AuthenticatedLayout ( ) {
@@ -41,30 +41,32 @@ function AuthenticatedLayout() {
4141 </ button >
4242 </ div >
4343 < ErrorBoundary >
44- < Routes >
45- < Route path = "/flow" element = { < div className = "px-4 py-6 sm:px-6 sm:py-8" > < Flow /> </ div > } />
46- < Route path = "/topology" element = { < div className = "px-4 py-6 sm:px-6 sm:py-8" > < TopologyExplorer /> </ div > } />
47- < Route path = "/users" element = { < div className = "px-4 py-6 sm:px-6 sm:py-8" > < UsersPage /> </ div > } />
48- < Route path = "*" element = {
49- < div className = "mx-auto max-w-7xl px-4 py-6 sm:px-6 sm:py-8" >
50- < Routes >
51- < Route path = "/" element = { < Dashboard /> } />
52- < Route path = "/catalog" element = { < Catalog /> } />
53- < Route path = "/catalog/:kind" element = { < Catalog /> } />
54- < Route path = "/catalog/:kind/:name" element = { < EntityDetail /> } />
55- < Route path = "/actions" element = { < Actions /> } />
56- < Route path = "/audit" element = { < AuditLog /> } />
57- < Route path = "/plugins" element = { < Plugins /> } />
58- < Route path = "/status" element = { < StatusMonitor /> } />
59- < Route path = "/gitops" element = { < GitOps /> } />
60- < Route path = "/harbor" element = { < Harbor /> } />
61- < Route path = "/nexus" element = { < Nexus /> } />
62- < Route path = "/rbac" element = { < RBAC /> } />
63- < Route path = "/settings" element = { < Settings /> } />
64- </ Routes >
65- </ div >
66- } />
67- </ Routes >
44+ < Suspense fallback = { < LoadingScreen /> } >
45+ < Routes >
46+ < Route path = "/flow" element = { < div className = "px-4 py-6 sm:px-6 sm:py-8" > < Flow /> </ div > } />
47+ < Route path = "/topology" element = { < div className = "px-4 py-6 sm:px-6 sm:py-8" > < TopologyExplorer /> </ div > } />
48+ < Route path = "/users" element = { < div className = "px-4 py-6 sm:px-6 sm:py-8" > < UsersPage /> </ div > } />
49+ < Route path = "*" element = {
50+ < div className = "mx-auto max-w-7xl px-4 py-6 sm:px-6 sm:py-8" >
51+ < Routes >
52+ < Route path = "/" element = { < Dashboard /> } />
53+ < Route path = "/catalog" element = { < Catalog /> } />
54+ < Route path = "/catalog/:kind" element = { < Catalog /> } />
55+ < Route path = "/catalog/:kind/:name" element = { < EntityDetail /> } />
56+ < Route path = "/actions" element = { < Actions /> } />
57+ < Route path = "/audit" element = { < AuditLog /> } />
58+ < Route path = "/plugins" element = { < Plugins /> } />
59+ < Route path = "/status" element = { < StatusMonitor /> } />
60+ < Route path = "/gitops" element = { < GitOps /> } />
61+ < Route path = "/harbor" element = { < Harbor /> } />
62+ < Route path = "/nexus" element = { < Nexus /> } />
63+ < Route path = "/rbac" element = { < RBAC /> } />
64+ < Route path = "/settings" element = { < Settings /> } />
65+ </ Routes >
66+ </ div >
67+ } />
68+ </ Routes >
69+ </ Suspense >
6870 </ ErrorBoundary >
6971 </ main >
7072 < CommandPalette />
0 commit comments