blob: 3137fd82abfde9bd1620148727680508b759e682 [file] [log] [blame]
TRM-codingd1cbf672025-06-18 15:15:08 +08001import React from 'react';
2import {
3 Routes,
4 Route,
5 Navigate,
6} from 'react-router-dom';
7import AdminPage from '../components/Admin';
8import UserManagement from '../components/UserManagement';
9import LogsDashboard from '../components/LogsDashboard';
10import SuperAdmin from '../components/SuperAdmin';
11
12import CreatePost from '../components/CreatePost' // src/components/CreatePost.jsx
13import HomeFeed from '../components/HomeFeed' // src/components/HomeFeed.jsx
14import PlaceholderPage from '../components/PlaceholderPage'// src/components/PlaceholderPage.jsx
15import UploadPage from '../components/UploadPage' // src/components/UploadPage.jsx
16
TRM-coding29174c22025-06-18 23:56:51 +080017import UserProfile from '../components/UserProfile'; // src/components/UserProfileRoute.jsx
TRM-codingd1cbf672025-06-18 15:15:08 +080018
TRM-codingc4b4f3d2025-06-18 19:02:46 +080019import LoginPage from '../pages/LoginPage/LoginPage';
20import RegisterPage from '../pages/RegisterPage/RegisterPage';
21import ForgotPasswordPage from '../pages/ForgotPasswordPage/ForgotPasswordPage';
22import TestDashboard from '../pages/TestDashboard/TestDashboard';
23
TRM-coding85e5c322025-06-18 19:49:21 +080024import TransactionLogs from '../components/TransactionLogs';
25import PerformanceLogs from '../components/PerformanceLogs';
26
TRM-codingd1cbf672025-06-18 15:15:08 +080027export default function AppRoutes() {
28 return (
29 <Routes>
30 <Route path="/posts/new" element={<CreatePost />} />
31
32 <Route path="/home" element={<HomeFeed />} />
33
34 <Route path="/notebooks" element={<PlaceholderPage pageId="notebooks" />} />
35 <Route path="/activity" element={<PlaceholderPage pageId="activity" />} />
36 <Route path="/notes" element={<PlaceholderPage pageId="notes" />} />
37 <Route path="/creator" element={<PlaceholderPage pageId="creator" />} />
38 <Route path="/journal" element={<PlaceholderPage pageId="journal" />} />
TRM-coding29174c22025-06-18 23:56:51 +080039 <Route path="/user/:userId" element={<UserProfile />} />
TRM-codingd1cbf672025-06-18 15:15:08 +080040 <Route path="/dashboard/*" element={<UploadPage />} />
41
42 {/* 根路径重定向到 dashboard */}
TRM-codingc4b4f3d2025-06-18 19:02:46 +080043 {/* <Route path="/" element={<Navigate to="/dashboard/overview" replace />} /> */}
44
45 <Route path="/" element={<LoginPage />} />
46 <Route path="/login" element={<LoginPage />} />
47 <Route path="/register" element={<RegisterPage />} />
48 <Route path="/forgot-password" element={<ForgotPasswordPage />} />
49 <Route path="/test-dashboard" element={<TestDashboard />} />
TRM-codingd1cbf672025-06-18 15:15:08 +080050
TRM-codingd1cbf672025-06-18 15:15:08 +080051 {/* 普通管理员,无 header */}
52 <Route path="admin" element={<AdminPage />} />
53
54 {/* 超级管理员,只用 SuperAdminLayout */}
55 <Route path="superadmin" element={<SuperAdmin />}>
56 <Route index element={<Navigate to="users" replace />} />
57 <Route path="users" element={<UserManagement superAdminId={3} />} />
TRM-coding85e5c322025-06-18 19:49:21 +080058
59 {/* dashboard as layout */}
60 <Route path="dashboard" element={<LogsDashboard />}>
61 <Route index element={<Navigate to="transactions" replace />} />
62 <Route path="transactions" element={<TransactionLogs userId={1} />} />
63 <Route path="performance" element={<PerformanceLogs userId={1} />} />
64 </Route>
TRM-codingd1cbf672025-06-18 15:15:08 +080065 </Route>
TRM-coding85e5c322025-06-18 19:49:21 +080066
67 {/* 最后一个兜底,放在最末尾 */}
68 <Route path="*" element={<PlaceholderPage pageId="home" />} />
TRM-codingd1cbf672025-06-18 15:15:08 +080069 </Routes>
70 );
71}