forked from maluQxzh/QChatDemo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.tsx
More file actions
35 lines (32 loc) · 1.08 KB
/
Copy pathApp.tsx
File metadata and controls
35 lines (32 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import React, { useEffect } from 'react';
import { HashRouter, Routes, Route, Navigate } from 'react-router-dom';
import LoginPage from './pages/LoginPage';
import Dashboard from './pages/Dashboard';
import SettingsPage from './pages/SettingsPage';
import RegisterPage from './pages/RegisterPage';
import { storageService } from './services/storageService';
const App: React.FC = () => {
useEffect(() => {
// Initialize theme
storageService.getSettings().then(settings => {
if (settings.theme === 'dark') {
document.documentElement.classList.add('dark');
} else {
document.documentElement.classList.remove('dark');
}
});
}, []);
return (
<HashRouter>
<Routes>
<Route path="/" element={<LoginPage />} />
<Route path="/register" element={<RegisterPage />} />
<Route path="/app" element={<Dashboard />} />
<Route path="/settings" element={<SettingsPage />} />
{/* Fallback */}
<Route path="*" element={<Navigate to="/" replace />} />
</Routes>
</HashRouter>
);
};
export default App;