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