import { useState } from 'react'
import { Routes, Route, useLocation } from 'react-router-dom'
import Sidebar from './components/Sidebar'
import TopBar from './components/TopBar'
import Glance from './pages/Glance'
import Infrastructure from './pages/Infrastructure'
import BookNest from './pages/BookNest'
import Terminal from './pages/Terminal'
import Tunnels from './pages/Tunnels'
import Files from './pages/Files'
import Containers from './pages/Containers'
import RemoteDesktop from './pages/RemoteDesktop'
import HostMetrics from './pages/HostMetrics'
import Settings from './pages/Settings'
import Help from './pages/Help'
import Login from './pages/Login'
import Enrollment from './pages/Enrollment'
import MeshGate from './pages/MeshGate'
import { useAuth } from './lib/AuthContext'
function App() {
const { status } = useAuth()
if (status === 'loading') {
return (
)
}
if (status === 'needs-setup' || status === 'enrolling') return
if (status === 'logged-out') return
if (status === 'needs-mesh') return
return
}
function Dashboard() {
const { user, meshStatus } = useAuth()
const showMeshNotice = !!meshStatus && meshStatus.required && !meshStatus.verified && !meshStatus.overridden && user?.role !== 'admin'
const [sidebarCollapsed, setSidebarCollapsed] = useState(false)
const sidebarWidth = sidebarCollapsed ? 64 : 200
const location = useLocation()
const showHero = location.pathname === '/infrastructure' || location.pathname === '/booknest'
const heroPaddingTop = location.pathname === '/booknest' ? '70px' : '72px'
const heroObjectPosition = location.pathname === '/booknest' ? '54% 8%' : 'center 5%'
const topBarHeight = location.pathname === '/booknest' ? 72 : 56
return (
setSidebarCollapsed(!sidebarCollapsed)}
/>
{showHero && (
)}
{showMeshNotice && (
Mesh setup is still in progress — an admin needs to finish verifying the network. Some features may be limited.
)}
} />
} />
} />
} />
} />
} />
} />
} />
} />
} />
} />
)
}
export default App