Add mitra online/offline status with heartbeat-based auto-offline, customer-mitra pairing via Valkey pub/sub blast, session management, and control center dashboard with real-time stats. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
32 lines
1.2 KiB
JavaScript
32 lines
1.2 KiB
JavaScript
import { Routes, Route, Navigate } from 'react-router-dom'
|
|
import { useAuth } from './core/auth/AuthContext'
|
|
import LoginPage from './pages/login/LoginPage'
|
|
import DashboardPage from './pages/dashboard/DashboardPage'
|
|
import MitrasPage from './pages/mitras/MitrasPage'
|
|
import SessionsPage from './pages/sessions/SessionsPage'
|
|
import UsersPage from './pages/users/UsersPage'
|
|
import SettingsPage from './pages/settings/SettingsPage'
|
|
import Layout from './components/Layout'
|
|
|
|
const ProtectedRoute = ({ children }) => {
|
|
const { user, loading } = useAuth()
|
|
if (loading) return <div>Loading...</div>
|
|
return user ? children : <Navigate to="/login" replace />
|
|
}
|
|
|
|
export default function App() {
|
|
return (
|
|
<Routes>
|
|
<Route path="/login" element={<LoginPage />} />
|
|
<Route path="/" element={<ProtectedRoute><Layout /></ProtectedRoute>}>
|
|
<Route index element={<Navigate to="/dashboard" replace />} />
|
|
<Route path="dashboard" element={<DashboardPage />} />
|
|
<Route path="mitras" element={<MitrasPage />} />
|
|
<Route path="sessions" element={<SessionsPage />} />
|
|
<Route path="users" element={<UsersPage />} />
|
|
<Route path="settings" element={<SettingsPage />} />
|
|
</Route>
|
|
</Routes>
|
|
)
|
|
}
|