blob: 225689e6823b9350dbd3907b8dd85181f4431d01 [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";
11import "./App.css";
12import MoviePage from "./MoviePage";
13import TVPage from "./TVPage";
14import MusicPage from "./MusicPage";
15import AnimePage from "./AnimePage";
16import GamePage from "./GamePage";
17import SportPage from "./SportPage";
18import InfoPage from "./InfoPage";
19import UserProfile from "./UserProfile";
9563036699e95ae32025-06-02 21:42:11 +080020import PublishPage from "./PublishPage";
21import TorrentDetailPage from './TorrentDetailPage';
ssq5067cb92025-06-05 11:44:23 +000022import LoginPage from './LoginPage';
23import RegisterPage from './RegisterPage';
956303669a32fc2c2025-06-02 19:45:53 +080024
25const navItems = [
26 { label: "电影", icon: <MovieIcon />, path: "/movie" },
27 { label: "剧集", icon: <EmailIcon />, path: "/tv" },
28 { label: "音乐", icon: <MusicNoteIcon />, path: "/music" },
29 { label: "动漫", icon: <EmojiPeopleIcon />, path: "/anime" },
30 { label: "游戏", icon: <SportsEsportsIcon />, path: "/game" },
31 { label: "体育", icon: <SportsMartialArtsIcon />, path: "/sport" },
32 { label: "资料", icon: <PersonIcon />, path: "/info" },
9563036699e95ae32025-06-02 21:42:11 +080033 { label: "发布", icon: <AccountCircleIcon />, path: "/publish" }, // Added Publish option
956303669a32fc2c2025-06-02 19:45:53 +080034];
35
36function Home() {
37 const navigate = useNavigate();
38 return (
39 <div className="container">
40 {/* 顶部空白与电影界面一致 */}
41 <div style={{ height: 80 }} />
42 {/* 用户栏 */}
43 <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 }}>
44 <div style={{ cursor: 'pointer', marginRight: 16 }} onClick={() => navigate('/user')}>
45 <AccountCircleIcon style={{ fontSize: 38, color: '#1a237e', background: '#e0f3ff', borderRadius: '50%' }} />
46 </div>
47 <div style={{ color: '#222', fontWeight: 500, marginRight: 24 }}>用户栏</div>
48 <div style={{ display: 'flex', gap: 28, flex: 1, justifyContent: 'flex-end', alignItems: 'center' }}>
49 <span style={{ color: '#1976d2', fontWeight: 500 }}>魔力值: <b>12345</b></span>
50 <span style={{ color: '#1976d2', fontWeight: 500 }}>分享率: <b>2.56</b></span>
51 <span style={{ color: '#1976d2', fontWeight: 500 }}>上传量: <b>100GB</b></span>
52 <span style={{ color: '#1976d2', fontWeight: 500 }}>下载量: <b>50GB</b></span>
53 </div>
54 </div>
55 {/* 下方内容整体下移,留出与电影界面一致的间距 */}
56 <div style={{ height: 32 }} />
57 <nav className="nav-bar card">
58 {navItems.map((item) => (
59 <div
60 key={item.label}
61 className={"nav-item"}
62 onClick={() => navigate(item.path)}
63 >
64 {item.icon}
65 <span>{item.label}</span>
66 </div>
67 ))}
68 </nav>
69 <div className="search-section card">
70 <input className="search-input" placeholder="输入搜索关键词" />
71 <button className="search-btn">
72 <span role="img" aria-label="search">🔍</span>
73 </button>
74 </div>
75 {/* 删除高频搜索栏 */}
76 <div className="table-section card">
77 <table className="movie-table">
78 <thead>
79 <tr>
80 <th>类型</th>
81 <th>标题</th>
82 <th>发布者</th>
83 </tr>
84 </thead>
85 <tbody>
86 <tr>
87 <td>电影</td>
88 <td></td>
89 <td></td>
90 </tr>
91 <tr>
92 <td>剧集</td>
93 <td></td>
94 <td></td>
95 </tr>
96 <tr>
97 <td>音乐</td>
98 <td></td>
99 <td></td>
100 </tr>
101 <tr>
102 <td>动漫</td>
103 <td></td>
104 <td></td>
105 </tr>
106 <tr>
107 <td>游戏</td>
108 <td></td>
109 <td></td>
110 </tr>
111 </tbody>
112 </table>
113 </div>
114 <div style={{ height: 32 }} />
115 <Pagination />
116 </div>
117 );
118}
119
120function Pagination() {
121 const [page, setPage] = React.useState(3);
122 const total = 5;
123 return (
124 <div className="pagination">
125 <button onClick={() => setPage(p => Math.max(1, p - 1))} disabled={page === 1}>上一页</button>
126 <span className="page-num">{page}/{total}</span>
127 <button onClick={() => setPage(p => Math.min(total, p + 1))} disabled={page === total}>下一页</button>
128 <span className="page-info">第 <b>{page}</b> 页</span>
129 </div>
130 );
131}
132
133function Page({ label }) {
134 return (
135 <div style={{ padding: 40, fontSize: 32 }}>
136 {label} 页面(可自定义内容)
137 <br />
138 <Link to="/">返回首页</Link>
139 </div>
140 );
141}
142
143export default function App() {
144 return (
145 <Router>
146 <Routes>
ssq5067cb92025-06-05 11:44:23 +0000147 <Route path="/login" element={<LoginPage />} />
148 <Route path="/register" element={<RegisterPage />} />
149 <Route path="/" element={<Navigate to="/login" replace />} />
956303669a32fc2c2025-06-02 19:45:53 +0800150 <Route path="/movie" element={<MoviePage />} />
151 <Route path="/tv" element={<TVPage />} />
152 <Route path="/music" element={<MusicPage />} />
153 <Route path="/anime" element={<AnimePage />} />
154 <Route path="/game" element={<GamePage />} />
155 <Route path="/sport" element={<SportPage />} />
156 <Route path="/info" element={<InfoPage />} />
157 <Route path="/user" element={<UserProfile />} />
9563036699e95ae32025-06-02 21:42:11 +0800158 <Route path="/publish" element={<PublishPage />} />
159 <Route path="/torrent/:torrentId" element={<TorrentDetailPage />} />
956303669a32fc2c2025-06-02 19:45:53 +0800160 </Routes>
161 </Router>
162 );
163}