blob: 372fa628628474f19293218a29aefbfc6b0370f1 [file] [log] [blame]
956303669a32fc2c2025-06-02 19:45:53 +08001import React from "react";
ssq5067cb92025-06-05 11:44:23 +00002import { BrowserRouter as Router, Routes, Route, useNavigate, Link, Navigate } from "react-router-dom";
956303669a32fc2c2025-06-02 19:45:53 +08003import MovieIcon from "@mui/icons-material/Movie";
4import EmailIcon from "@mui/icons-material/Email";
5import MusicNoteIcon from "@mui/icons-material/MusicNote";
6import EmojiPeopleIcon from "@mui/icons-material/EmojiPeople";
7import SportsEsportsIcon from "@mui/icons-material/SportsEsports";
8import SportsMartialArtsIcon from "@mui/icons-material/SportsMartialArts";
9import PersonIcon from "@mui/icons-material/Person";
10import AccountCircleIcon from "@mui/icons-material/AccountCircle";
wht6a1b6782025-06-06 19:14:59 +080011import ForumIcon from "@mui/icons-material/Forum";
956303669a32fc2c2025-06-02 19:45:53 +080012import "./App.css";
13import MoviePage from "./MoviePage";
14import TVPage from "./TVPage";
15import MusicPage from "./MusicPage";
16import AnimePage from "./AnimePage";
17import GamePage from "./GamePage";
18import SportPage from "./SportPage";
19import InfoPage from "./InfoPage";
20import UserProfile from "./UserProfile";
9563036699e95ae32025-06-02 21:42:11 +080021import PublishPage from "./PublishPage";
22import TorrentDetailPage from './TorrentDetailPage';
wht6a1b6782025-06-06 19:14:59 +080023import ForumPage from "./ForumPage";
24import PostDetailPage from "./PostDetailPage";
ssq5067cb92025-06-05 11:44:23 +000025import LoginPage from './LoginPage';
26import RegisterPage from './RegisterPage';
2230113338fd3882025-06-06 23:33:57 +080027import RequireAuth from './RequireAuth';
whtb1e79592025-06-07 16:03:09 +080028import AdminPage from './AdminPage';
29import AppealPage from './AppealPage';
30import MigrationPage from './MigrationPage';
31
wht6a1b6782025-06-06 19:14:59 +080032
956303669a32fc2c2025-06-02 19:45:53 +080033const navItems = [
34 { label: "电影", icon: <MovieIcon />, path: "/movie" },
35 { label: "剧集", icon: <EmailIcon />, path: "/tv" },
36 { label: "音乐", icon: <MusicNoteIcon />, path: "/music" },
37 { label: "动漫", icon: <EmojiPeopleIcon />, path: "/anime" },
38 { label: "游戏", icon: <SportsEsportsIcon />, path: "/game" },
39 { label: "体育", icon: <SportsMartialArtsIcon />, path: "/sport" },
40 { label: "资料", icon: <PersonIcon />, path: "/info" },
wht6a1b6782025-06-06 19:14:59 +080041 { label: "论坛", icon: <ForumIcon />, path: "/forum" },
42 { label: "发布", icon: <AccountCircleIcon />, path: "/publish" },
956303669a32fc2c2025-06-02 19:45:53 +080043];
44
45function Home() {
46 const navigate = useNavigate();
47 return (
48 <div className="container">
49 {/* 顶部空白与电影界面一致 */}
50 <div style={{ height: 80 }} />
51 {/* 用户栏 */}
52 <div className="user-bar" style={{ position: 'fixed', top: 18, right: 42, zIndex: 100, display: 'flex', alignItems: 'center', background: '#e0f3ff', borderRadius: 12, padding: '6px 18px', boxShadow: '0 2px 8px #b2d8ea', minWidth: 320, minHeight: 48, width: 420 }}>
53 <div style={{ cursor: 'pointer', marginRight: 16 }} onClick={() => navigate('/user')}>
54 <AccountCircleIcon style={{ fontSize: 38, color: '#1a237e', background: '#e0f3ff', borderRadius: '50%' }} />
55 </div>
56 <div style={{ color: '#222', fontWeight: 500, marginRight: 24 }}>用户栏</div>
57 <div style={{ display: 'flex', gap: 28, flex: 1, justifyContent: 'flex-end', alignItems: 'center' }}>
58 <span style={{ color: '#1976d2', fontWeight: 500 }}>魔力值: <b>12345</b></span>
59 <span style={{ color: '#1976d2', fontWeight: 500 }}>分享率: <b>2.56</b></span>
60 <span style={{ color: '#1976d2', fontWeight: 500 }}>上传量: <b>100GB</b></span>
61 <span style={{ color: '#1976d2', fontWeight: 500 }}>下载量: <b>50GB</b></span>
62 </div>
63 </div>
956303669a32fc2c2025-06-02 19:45:53 +080064 <div style={{ height: 32 }} />
65 <nav className="nav-bar card">
66 {navItems.map((item) => (
67 <div
68 key={item.label}
69 className={"nav-item"}
70 onClick={() => navigate(item.path)}
71 >
72 {item.icon}
73 <span>{item.label}</span>
74 </div>
75 ))}
76 </nav>
77 <div className="search-section card">
78 <input className="search-input" placeholder="输入搜索关键词" />
79 <button className="search-btn">
80 <span role="img" aria-label="search">🔍</span>
81 </button>
82 </div>
956303669a32fc2c2025-06-02 19:45:53 +080083 <div className="table-section card">
84 <table className="movie-table">
85 <thead>
86 <tr>
87 <th>类型</th>
88 <th>标题</th>
89 <th>发布者</th>
90 </tr>
91 </thead>
92 <tbody>
93 <tr>
94 <td>电影</td>
95 <td></td>
96 <td></td>
97 </tr>
98 <tr>
99 <td>剧集</td>
100 <td></td>
101 <td></td>
102 </tr>
103 <tr>
104 <td>音乐</td>
105 <td></td>
106 <td></td>
107 </tr>
108 <tr>
109 <td>动漫</td>
110 <td></td>
111 <td></td>
112 </tr>
113 <tr>
114 <td>游戏</td>
115 <td></td>
116 <td></td>
117 </tr>
118 </tbody>
119 </table>
120 </div>
121 <div style={{ height: 32 }} />
122 <Pagination />
123 </div>
124 );
125}
126
127function Pagination() {
128 const [page, setPage] = React.useState(3);
129 const total = 5;
130 return (
131 <div className="pagination">
132 <button onClick={() => setPage(p => Math.max(1, p - 1))} disabled={page === 1}>上一页</button>
133 <span className="page-num">{page}/{total}</span>
134 <button onClick={() => setPage(p => Math.min(total, p + 1))} disabled={page === total}>下一页</button>
135 <span className="page-info">第 <b>{page}</b> 页</span>
136 </div>
137 );
138}
139
140function Page({ label }) {
141 return (
142 <div style={{ padding: 40, fontSize: 32 }}>
143 {label} 页面(可自定义内容)
144 <br />
145 <Link to="/">返回首页</Link>
146 </div>
147 );
148}
149
150export default function App() {
151 return (
152 <Router>
153 <Routes>
ssq5067cb92025-06-05 11:44:23 +0000154 <Route path="/login" element={<LoginPage />} />
155 <Route path="/register" element={<RegisterPage />} />
156 <Route path="/" element={<Navigate to="/login" replace />} />
2230113338fd3882025-06-06 23:33:57 +0800157 {/* Protected routes */}
158 <Route element={<RequireAuth />}>
159 <Route path="/movie" element={<MoviePage />} />
160 <Route path="/tv" element={<TVPage />} />
161 <Route path="/music" element={<MusicPage />} />
162 <Route path="/anime" element={<AnimePage />} />
163 <Route path="/game" element={<GamePage />} />
164 <Route path="/sport" element={<SportPage />} />
165 <Route path="/forum" element={<ForumPage />} />
166 <Route path="/forum/:postId" element={<PostDetailPage />} />
167 <Route path="/info" element={<InfoPage />} />
168 <Route path="/user" element={<UserProfile />} />
169 <Route path="/publish" element={<PublishPage />} />
170 <Route path="/torrent/:torrentId" element={<TorrentDetailPage />} />
whtb1e79592025-06-07 16:03:09 +0800171 <Route path="/admin" element={<AdminPage />} />
172 <Route path="/appeal-review" element={<AppealPage />} />
173 <Route path="/migration-review" element={<MigrationPage />} />
2230113338fd3882025-06-06 23:33:57 +0800174 </Route>
956303669a32fc2c2025-06-02 19:45:53 +0800175 </Routes>
176 </Router>
177 );
178}