11import { BrowserRouter , Routes , Route , Navigate , useNavigate , useLocation } from 'react-router-dom' ;
22import { useState , useEffect } from 'react' ;
33import { ObjectStackClient } from '@objectstack/client' ;
4- import { AppShell } from '@object-ui/layout' ;
54import { ObjectForm } from '@object-ui/plugin-form' ;
65import { Dialog , DialogContent , DialogHeader , DialogTitle , DialogDescription } from '@object-ui/components' ;
76import { ObjectStackDataSource } from './dataSource' ;
87import appConfig from '../objectstack.config' ;
98
10- // New Components
11- import { AppSidebar } from './components/AppSidebar' ;
9+ // Components
10+ import { ConsoleLayout } from './components/ConsoleLayout' ;
11+ import { LoadingScreen } from './components/LoadingScreen' ;
1212import { ObjectView } from './components/ObjectView' ;
13- import { AppHeader } from './components/AppHeader' ;
1413import { DashboardView } from './components/DashboardView' ;
1514import { PageView } from './components/PageView' ;
1615
@@ -24,7 +23,6 @@ function AppContent() {
2423 const apps = appConfig . apps || [ ] ;
2524
2625 // Determine active app based on URL or default
27- // Filter active apps and find default app
2826 const activeApps = apps . filter ( ( a : any ) => a . active !== false ) ;
2927 const defaultApp = activeApps . find ( ( a : any ) => a . isDefault === true ) || activeApps [ 0 ] ;
3028 const [ activeAppName , setActiveAppName ] = useState < string > ( defaultApp ?. name || 'default' ) ;
@@ -91,20 +89,15 @@ function AppContent() {
9189 }
9290 } ;
9391
94- if ( ! client || ! dataSource ) return < div className = "flex items-center justify-center h-screen text-muted-foreground animate-pulse" > Initializing ObjectStack Console... </ div > ;
95- if ( ! activeApp ) return < div className = "p-4" > No Apps configured.</ div > ;
92+ if ( ! client || ! dataSource ) return < LoadingScreen / >;
93+ if ( ! activeApp ) return < div className = "p-4 flex items-center justify-center h-screen " > No Apps configured.</ div > ;
9694
9795 return (
98- < AppShell
99- sidebar = {
100- < AppSidebar
101- activeAppName = { activeAppName }
102- onAppChange = { handleAppChange }
103- />
104- }
105- navbar = {
106- < AppHeader appName = { activeApp . label } objects = { allObjects } />
107- }
96+ < ConsoleLayout
97+ activeAppName = { activeAppName }
98+ activeApp = { activeApp }
99+ onAppChange = { handleAppChange }
100+ objects = { allObjects }
108101 >
109102 < Routes >
110103 < Route path = "/" element = {
@@ -156,7 +149,7 @@ function AppContent() {
156149 </ div >
157150 </ DialogContent >
158151 </ Dialog >
159- </ AppShell >
152+ </ ConsoleLayout >
160153 ) ;
161154}
162155
0 commit comments