2026-09-20 08:08:16 +02:00
|
|
|
import { Route, Routes, useLocation } from 'react-router-dom'
|
|
|
|
|
import { useAuthSession } from '../components/actions'
|
|
|
|
|
import { NotFound } from '../components/ui/NotFound'
|
|
|
|
|
import { ParticipantInterviewPage } from '../features/assessments'
|
|
|
|
|
import { ParticipantMeetingPage } from '../features/interviews'
|
|
|
|
|
import { LoginPage } from '../features/login/LoginPage'
|
|
|
|
|
import { AuthenticatedApp } from './AuthenticatedApp'
|
|
|
|
|
import { DataProvider } from './DataContext'
|
2026-09-19 20:31:14 +02:00
|
|
|
|
|
|
|
|
export default function App() {
|
|
|
|
|
const location = useLocation()
|
2026-09-20 08:08:16 +02:00
|
|
|
const { authenticated, sessionExpired, completeLogin, logout } = useAuthSession()
|
2026-09-19 20:31:14 +02:00
|
|
|
|
2026-09-19 20:56:27 +02:00
|
|
|
if (location.pathname.startsWith('/participant/')) {
|
2026-09-19 20:31:14 +02:00
|
|
|
return (
|
|
|
|
|
<Routes>
|
2026-09-19 21:58:24 +02:00
|
|
|
<Route path="/participant/meeting/:token" element={<ParticipantMeetingPage />} />
|
2026-09-19 20:56:27 +02:00
|
|
|
<Route path="/participant/:invitationId" element={<ParticipantInterviewPage />} />
|
2026-09-19 20:31:14 +02:00
|
|
|
<Route path="*" element={<NotFound />} />
|
|
|
|
|
</Routes>
|
|
|
|
|
)
|
|
|
|
|
}
|
2026-09-20 07:16:38 +02:00
|
|
|
if (!authenticated) {
|
|
|
|
|
return <LoginPage onLogin={completeLogin} sessionExpired={sessionExpired} />
|
|
|
|
|
}
|
2026-09-19 20:31:14 +02:00
|
|
|
return (
|
|
|
|
|
<DataProvider>
|
2026-09-20 08:08:16 +02:00
|
|
|
<AuthenticatedApp onLogout={logout} />
|
2026-09-19 20:31:14 +02:00
|
|
|
</DataProvider>
|
|
|
|
|
)
|
|
|
|
|
}
|