TRM-coding | d1cbf67 | 2025-06-18 15:15:08 +0800 | [diff] [blame] | 1 | import React from 'react'; |
| 2 | import { |
| 3 | Routes, |
| 4 | Route, |
| 5 | Navigate, |
| 6 | } from 'react-router-dom'; |
| 7 | import AdminPage from '../components/Admin'; |
| 8 | import UserManagement from '../components/UserManagement'; |
| 9 | import LogsDashboard from '../components/LogsDashboard'; |
| 10 | import SuperAdmin from '../components/SuperAdmin'; |
| 11 | |
| 12 | import CreatePost from '../components/CreatePost' // src/components/CreatePost.jsx |
| 13 | import HomeFeed from '../components/HomeFeed' // src/components/HomeFeed.jsx |
| 14 | import PlaceholderPage from '../components/PlaceholderPage'// src/components/PlaceholderPage.jsx |
| 15 | import UploadPage from '../components/UploadPage' // src/components/UploadPage.jsx |
| 16 | |
| 17 | |
TRM-coding | c4b4f3d | 2025-06-18 19:02:46 +0800 | [diff] [blame^] | 18 | import LoginPage from '../pages/LoginPage/LoginPage'; |
| 19 | import RegisterPage from '../pages/RegisterPage/RegisterPage'; |
| 20 | import ForgotPasswordPage from '../pages/ForgotPasswordPage/ForgotPasswordPage'; |
| 21 | import TestDashboard from '../pages/TestDashboard/TestDashboard'; |
| 22 | |
TRM-coding | d1cbf67 | 2025-06-18 15:15:08 +0800 | [diff] [blame] | 23 | export default function AppRoutes() { |
| 24 | return ( |
| 25 | <Routes> |
| 26 | <Route path="/posts/new" element={<CreatePost />} /> |
| 27 | |
| 28 | <Route path="/home" element={<HomeFeed />} /> |
| 29 | |
| 30 | <Route path="/notebooks" element={<PlaceholderPage pageId="notebooks" />} /> |
| 31 | <Route path="/activity" element={<PlaceholderPage pageId="activity" />} /> |
| 32 | <Route path="/notes" element={<PlaceholderPage pageId="notes" />} /> |
| 33 | <Route path="/creator" element={<PlaceholderPage pageId="creator" />} /> |
| 34 | <Route path="/journal" element={<PlaceholderPage pageId="journal" />} /> |
| 35 | |
| 36 | <Route path="/dashboard/*" element={<UploadPage />} /> |
| 37 | |
| 38 | {/* 根路径重定向到 dashboard */} |
TRM-coding | c4b4f3d | 2025-06-18 19:02:46 +0800 | [diff] [blame^] | 39 | {/* <Route path="/" element={<Navigate to="/dashboard/overview" replace />} /> */} |
| 40 | |
| 41 | <Route path="/" element={<LoginPage />} /> |
| 42 | <Route path="/login" element={<LoginPage />} /> |
| 43 | <Route path="/register" element={<RegisterPage />} /> |
| 44 | <Route path="/forgot-password" element={<ForgotPasswordPage />} /> |
| 45 | <Route path="/test-dashboard" element={<TestDashboard />} /> |
TRM-coding | d1cbf67 | 2025-06-18 15:15:08 +0800 | [diff] [blame] | 46 | |
| 47 | {/* 最后一个兜底 */} |
| 48 | <Route path="*" element={<PlaceholderPage pageId="home" />} /> |
| 49 | |
| 50 | {/* 普通管理员,无 header */} |
| 51 | <Route path="admin" element={<AdminPage />} /> |
| 52 | |
| 53 | {/* 超级管理员,只用 SuperAdminLayout */} |
| 54 | <Route path="superadmin" element={<SuperAdmin />}> |
| 55 | <Route index element={<Navigate to="users" replace />} /> |
| 56 | <Route path="users" element={<UserManagement superAdminId={3} />} /> |
| 57 | <Route path="dashboard" element={<LogsDashboard />} /> |
| 58 | </Route> |
| 59 | </Routes> |
| 60 | ); |
| 61 | } |