blob: 58fb58c1ece3c8e8281445a5a3ff4d0dcd10c1d9 [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";
whtdc90a032025-06-08 03:03:52 +080012import HelpIcon from "@mui/icons-material/Help";
956303669a32fc2c2025-06-02 19:45:53 +080013import "./App.css";
14import MoviePage from "./MoviePage";
15import TVPage from "./TVPage";
16import MusicPage from "./MusicPage";
17import AnimePage from "./AnimePage";
18import GamePage from "./GamePage";
19import SportPage from "./SportPage";
20import InfoPage from "./InfoPage";
21import UserProfile from "./UserProfile";
9563036699e95ae32025-06-02 21:42:11 +080022import PublishPage from "./PublishPage";
23import TorrentDetailPage from './TorrentDetailPage';
wht6a1b6782025-06-06 19:14:59 +080024import ForumPage from "./ForumPage";
25import PostDetailPage from "./PostDetailPage";
ssq5067cb92025-06-05 11:44:23 +000026import LoginPage from './LoginPage';
27import RegisterPage from './RegisterPage';
2230113338fd3882025-06-06 23:33:57 +080028import RequireAuth from './RequireAuth';
whtb1e79592025-06-07 16:03:09 +080029import AdminPage from './AdminPage';
30import AppealPage from './AppealPage';
31import MigrationPage from './MigrationPage';
whtdc90a032025-06-08 03:03:52 +080032import BegSeedPage from "./BegSeedPage";
33import BegInfo from "./BegInfo";
whtb1e79592025-06-07 16:03:09 +080034
wht6a1b6782025-06-06 19:14:59 +080035
956303669a32fc2c2025-06-02 19:45:53 +080036const navItems = [
37 { label: "电影", icon: <MovieIcon />, path: "/movie" },
38 { label: "剧集", icon: <EmailIcon />, path: "/tv" },
39 { label: "音乐", icon: <MusicNoteIcon />, path: "/music" },
40 { label: "动漫", icon: <EmojiPeopleIcon />, path: "/anime" },
41 { label: "游戏", icon: <SportsEsportsIcon />, path: "/game" },
42 { label: "体育", icon: <SportsMartialArtsIcon />, path: "/sport" },
43 { label: "资料", icon: <PersonIcon />, path: "/info" },
wht6a1b6782025-06-06 19:14:59 +080044 { label: "论坛", icon: <ForumIcon />, path: "/forum" },
45 { label: "发布", icon: <AccountCircleIcon />, path: "/publish" },
whtdc90a032025-06-08 03:03:52 +080046 { label: "求种", icon: <HelpIcon />, path: "/begseed" },
956303669a32fc2c2025-06-02 19:45:53 +080047];
48
49function Home() {
50 const navigate = useNavigate();
51 return (
52 <div className="container">
53 {/* 顶部空白与电影界面一致 */}
54 <div style={{ height: 80 }} />
55 {/* 用户栏 */}
56 <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 }}>
57 <div style={{ cursor: 'pointer', marginRight: 16 }} onClick={() => navigate('/user')}>
58 <AccountCircleIcon style={{ fontSize: 38, color: '#1a237e', background: '#e0f3ff', borderRadius: '50%' }} />
59 </div>
60 <div style={{ color: '#222', fontWeight: 500, marginRight: 24 }}>用户栏</div>
61 <div style={{ display: 'flex', gap: 28, flex: 1, justifyContent: 'flex-end', alignItems: 'center' }}>
62 <span style={{ color: '#1976d2', fontWeight: 500 }}>魔力值: <b>12345</b></span>
63 <span style={{ color: '#1976d2', fontWeight: 500 }}>分享率: <b>2.56</b></span>
64 <span style={{ color: '#1976d2', fontWeight: 500 }}>上传量: <b>100GB</b></span>
65 <span style={{ color: '#1976d2', fontWeight: 500 }}>下载量: <b>50GB</b></span>
66 </div>
67 </div>
956303669a32fc2c2025-06-02 19:45:53 +080068 <div style={{ height: 32 }} />
69 <nav className="nav-bar card">
70 {navItems.map((item) => (
71 <div
72 key={item.label}
73 className={"nav-item"}
74 onClick={() => navigate(item.path)}
75 >
76 {item.icon}
77 <span>{item.label}</span>
78 </div>
79 ))}
80 </nav>
81 <div className="search-section card">
82 <input className="search-input" placeholder="输入搜索关键词" />
83 <button className="search-btn">
84 <span role="img" aria-label="search">🔍</span>
85 </button>
86 </div>
956303669a32fc2c2025-06-02 19:45:53 +080087 <div className="table-section card">
88 <table className="movie-table">
89 <thead>
90 <tr>
91 <th>类型</th>
92 <th>标题</th>
93 <th>发布者</th>
94 </tr>
95 </thead>
96 <tbody>
97 <tr>
98 <td>电影</td>
99 <td></td>
100 <td></td>
101 </tr>
102 <tr>
103 <td>剧集</td>
104 <td></td>
105 <td></td>
106 </tr>
107 <tr>
108 <td>音乐</td>
109 <td></td>
110 <td></td>
111 </tr>
112 <tr>
113 <td>动漫</td>
114 <td></td>
115 <td></td>
116 </tr>
117 <tr>
118 <td>游戏</td>
119 <td></td>
120 <td></td>
121 </tr>
122 </tbody>
123 </table>
124 </div>
125 <div style={{ height: 32 }} />
126 <Pagination />
127 </div>
128 );
129}
130
131function Pagination() {
132 const [page, setPage] = React.useState(3);
133 const total = 5;
134 return (
135 <div className="pagination">
136 <button onClick={() => setPage(p => Math.max(1, p - 1))} disabled={page === 1}>上一页</button>
137 <span className="page-num">{page}/{total}</span>
138 <button onClick={() => setPage(p => Math.min(total, p + 1))} disabled={page === total}>下一页</button>
139 <span className="page-info">第 <b>{page}</b> 页</span>
140 </div>
141 );
142}
143
144function Page({ label }) {
145 return (
146 <div style={{ padding: 40, fontSize: 32 }}>
147 {label} 页面(可自定义内容)
148 <br />
149 <Link to="/">返回首页</Link>
150 </div>
151 );
152}
153
154export default function App() {
155 return (
156 <Router>
157 <Routes>
ssq5067cb92025-06-05 11:44:23 +0000158 <Route path="/login" element={<LoginPage />} />
159 <Route path="/register" element={<RegisterPage />} />
160 <Route path="/" element={<Navigate to="/login" replace />} />
2230113338fd3882025-06-06 23:33:57 +0800161 {/* Protected routes */}
162 <Route element={<RequireAuth />}>
163 <Route path="/movie" element={<MoviePage />} />
164 <Route path="/tv" element={<TVPage />} />
165 <Route path="/music" element={<MusicPage />} />
166 <Route path="/anime" element={<AnimePage />} />
167 <Route path="/game" element={<GamePage />} />
168 <Route path="/sport" element={<SportPage />} />
169 <Route path="/forum" element={<ForumPage />} />
170 <Route path="/forum/:postId" element={<PostDetailPage />} />
171 <Route path="/info" element={<InfoPage />} />
172 <Route path="/user" element={<UserProfile />} />
173 <Route path="/publish" element={<PublishPage />} />
174 <Route path="/torrent/:torrentId" element={<TorrentDetailPage />} />
whtb1e79592025-06-07 16:03:09 +0800175 <Route path="/admin" element={<AdminPage />} />
176 <Route path="/appeal-review" element={<AppealPage />} />
177 <Route path="/migration-review" element={<MigrationPage />} />
whtdc90a032025-06-08 03:03:52 +0800178 <Route path="/begseed" element={<BegSeedPage />} />
179 <Route path="/begseed/:begid" element={<BegInfo />} />
2230113338fd3882025-06-06 23:33:57 +0800180 </Route>
956303669a32fc2c2025-06-02 19:45:53 +0800181 </Routes>
182 </Router>
183 );
184}