2026-07-05 06:41:23 +02:00
|
|
|
import { Navigate, Route, Routes } from 'react-router-dom'
|
|
|
|
|
import { SessionProvider, useSession } from './context/SessionContext.jsx'
|
|
|
|
|
import { AppLayout } from './layout/AppLayout.jsx'
|
|
|
|
|
import { AuthPanel } from './pages/AuthPanel.jsx'
|
|
|
|
|
import { VIEWS } from './registry/viewRegistry.js'
|
|
|
|
|
import './app.css'
|
|
|
|
|
|
|
|
|
|
function AppRoutes() {
|
|
|
|
|
const { isAuthenticated, loading } = useSession()
|
|
|
|
|
|
|
|
|
|
if (loading) {
|
|
|
|
|
return null
|
2026-07-04 20:17:03 +02:00
|
|
|
}
|
|
|
|
|
|
2026-07-05 06:41:23 +02:00
|
|
|
if (!isAuthenticated) {
|
|
|
|
|
return <AuthPanel />
|
2026-07-04 20:17:03 +02:00
|
|
|
}
|
|
|
|
|
|
2026-07-04 19:15:43 +02:00
|
|
|
return (
|
2026-07-05 06:41:23 +02:00
|
|
|
<Routes>
|
|
|
|
|
<Route element={<AppLayout />}>
|
|
|
|
|
{VIEWS.map((view) => (
|
|
|
|
|
<Route key={view.key} path={view.path} element={<view.component />} />
|
|
|
|
|
))}
|
|
|
|
|
<Route path="/" element={<Navigate to="/workspace" replace />} />
|
|
|
|
|
<Route path="*" element={<Navigate to="/workspace" replace />} />
|
|
|
|
|
</Route>
|
|
|
|
|
</Routes>
|
|
|
|
|
)
|
|
|
|
|
}
|
2026-07-04 20:19:02 +02:00
|
|
|
|
2026-07-05 06:41:23 +02:00
|
|
|
export default function App() {
|
|
|
|
|
return (
|
|
|
|
|
<SessionProvider>
|
|
|
|
|
<AppRoutes />
|
|
|
|
|
</SessionProvider>
|
2026-07-04 19:15:43 +02:00
|
|
|
)
|
|
|
|
|
}
|