Replace the synchronous PDF import with Server-Sent Events streaming between the backend (LLM) and the browser. The user can now close the import modal and continue working while the conversion runs — a fixed progress bar in the Layout shows real-time stage and percentage.
35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
import { Routes, Route, Navigate } from 'react-router-dom';
|
||
import { useAuth } from './context/AuthContext';
|
||
import { ImportProvider } from './context/ImportContext';
|
||
import { Layout } from './components/Layout';
|
||
import { LoginPage } from './pages/LoginPage';
|
||
import { HistoryPage } from './pages/HistoryPage';
|
||
import { AnalyticsPage } from './pages/AnalyticsPage';
|
||
import { SettingsPage } from './pages/SettingsPage';
|
||
|
||
export function App() {
|
||
const { user, loading } = useAuth();
|
||
|
||
if (loading) {
|
||
return <div className="app-loading">Загрузка...</div>;
|
||
}
|
||
|
||
if (!user) {
|
||
return <LoginPage />;
|
||
}
|
||
|
||
return (
|
||
<ImportProvider>
|
||
<Layout>
|
||
<Routes>
|
||
<Route path="/" element={<Navigate to="/history" replace />} />
|
||
<Route path="/history" element={<HistoryPage />} />
|
||
<Route path="/analytics" element={<AnalyticsPage />} />
|
||
<Route path="/settings" element={<SettingsPage />} />
|
||
<Route path="*" element={<Navigate to="/history" replace />} />
|
||
</Routes>
|
||
</Layout>
|
||
</ImportProvider>
|
||
);
|
||
}
|