Files
Cyrene_v2/frontend/web/src/App.tsx
T
Aska 4a71965686 feat(frontend): add React SPA with chat, auth, and admin pages
- Vite 6 + React 19 + TypeScript + Tailwind 4 + Zustand 5
- Login page with JWT auth
- Chat interface: MessageList, ChatInput, ChatContainer
- WebSocket hook with auto-reconnect and exponential backoff
- Sidebar with new chat button + session navigation
- Admin dashboard placeholder
- 57 modules, 242KB JS, TypeScript zero errors
2026-08-12 11:47:22 +08:00

32 lines
1004 B
TypeScript

import { Routes, Route, Navigate } from 'react-router-dom'
import { useAuthStore } from './store/authStore'
import AppLayout from './components/layout/AppLayout'
import ChatPage from './pages/chat/ChatPage'
import DashboardPage from './pages/admin/DashboardPage'
import LoginPage from './pages/LoginPage'
export default function App() {
const isLoggedIn = useAuthStore((s) => s.isLoggedIn)
if (!isLoggedIn) {
return (
<Routes>
<Route path="/login" element={<LoginPage />} />
<Route path="*" element={<Navigate to="/login" replace />} />
</Routes>
)
}
return (
<AppLayout>
<Routes>
<Route path="/" element={<Navigate to="/chat" replace />} />
<Route path="/chat" element={<ChatPage />} />
<Route path="/chat/:sessionId" element={<ChatPage />} />
<Route path="/admin/dashboard" element={<DashboardPage />} />
<Route path="*" element={<Navigate to="/chat" replace />} />
</Routes>
</AppLayout>
)
}