import { BrowserRouter, Routes, Route, Navigate, useParams } from 'react-router-dom' import { AuthGate } from './components/AuthGate' import { Login } from './pages/Login' import { Register } from './pages/Register' import { Dashboard } from './pages/Dashboard' import { AppFrame } from './pages/AppFrame' import { AdminUsers } from './pages/AdminUsers' import { AdminRoles } from './pages/AdminRoles' import { AdminDepartments } from './pages/AdminDepartments' import { AdminMonitor } from './pages/AdminMonitor' import { AdminSettings } from './pages/AdminSettings' import type { User } from './types' // Force full remount of AppFrame when slug changes so initialSrc recomputes function AppFrameKeyed({ user }: { user: User }) { const { slug } = useParams<{ slug: string }>() return } // The portal is only ever the top-level frame. If it finds itself loaded inside // an iframe, it means an app's path fell back to the portal (that app isn't // deployed or routed in NPM yet) — so render a placeholder instead of recursing // the whole shell endlessly inside itself. function EmbeddedFallback() { return (
🚧

This app isn’t available yet

It hasn’t been deployed or routed on this site.

) } export default function App() { if (window.self !== window.top) return return ( } /> } /> {user => ( } /> } /> : } /> : } /> : } /> : } /> : } /> } /> )} } /> ) }