wu | a80b90d | 2025-06-15 10:36:02 +0800 | [diff] [blame] | 1 | // src/router/index.jsx |
wu | 90da17b | 2025-06-19 12:45:29 +0800 | [diff] [blame] | 2 | |
wu | eb6e6ca | 2025-06-15 10:35:32 +0800 | [diff] [blame] | 3 | import React from 'react' |
| 4 | import { Routes, Route, Navigate } from 'react-router-dom' |
wu | 90da17b | 2025-06-19 12:45:29 +0800 | [diff] [blame] | 5 | import CreatePost from '../components/CreatePost' |
| 6 | import HomeFeed from '../components/HomeFeed' |
| 7 | import NotebookPage from '../components/NotebookPage' |
wu | 90da17b | 2025-06-19 12:45:29 +0800 | [diff] [blame] | 8 | import PlaceholderPage from '../components/PlaceholderPage' |
wu | eb6e6ca | 2025-06-15 10:35:32 +0800 | [diff] [blame] | 9 | |
| 10 | export default function AppRouter() { |
| 11 | return ( |
| 12 | <Routes> |
wu | 90da17b | 2025-06-19 12:45:29 +0800 | [diff] [blame] | 13 | {/* 新帖 & 编辑帖(/:postId 可选) */} |
| 14 | <Route path="/posts/new" element={<CreatePost />} /> |
| 15 | <Route path="/posts/edit/:postId" element={<CreatePost />} /> |
wu | eb6e6ca | 2025-06-15 10:35:32 +0800 | [diff] [blame] | 16 | |
| 17 | <Route path="/home" element={<HomeFeed />} /> |
wu | 90da17b | 2025-06-19 12:45:29 +0800 | [diff] [blame] | 18 | <Route path="/notebooks" element={<NotebookPage />} /> |
| 19 | <Route path="/activity" element={<PlaceholderPage pageId="activity" />} /> |
| 20 | <Route path="/notes" element={<PlaceholderPage pageId="notes" />} /> |
| 21 | <Route path="/creator" element={<PlaceholderPage pageId="creator" />} /> |
| 22 | <Route path="/journal" element={<PlaceholderPage pageId="journal" />} /> |
wu | a80b90d | 2025-06-15 10:36:02 +0800 | [diff] [blame] | 23 | |
wu | 90da17b | 2025-06-19 12:45:29 +0800 | [diff] [blame] | 24 | <Route path="/dashboard/*" element={<PlaceholderPage />} /> |
wu | eb6e6ca | 2025-06-15 10:35:32 +0800 | [diff] [blame] | 25 | |
wu | a80b90d | 2025-06-15 10:36:02 +0800 | [diff] [blame] | 26 | <Route path="/" element={<Navigate to="/dashboard/overview" replace />} /> |
wu | eb6e6ca | 2025-06-15 10:35:32 +0800 | [diff] [blame] | 27 | <Route path="*" element={<PlaceholderPage pageId="home" />} /> |
| 28 | </Routes> |
| 29 | ) |
wu | a80b90d | 2025-06-15 10:36:02 +0800 | [diff] [blame] | 30 | } |