blob: 23383b6547e661cf93ca4f929927b9d7a7ee4a27 [file] [log] [blame]
956303669a32fc2c2025-06-02 19:45:53 +08001import React, { useState } from "react";
2import MovieIcon from "@mui/icons-material/Movie";
3import EmailIcon from "@mui/icons-material/Email";
4import MusicNoteIcon from "@mui/icons-material/MusicNote";
5import EmojiPeopleIcon from "@mui/icons-material/EmojiPeople";
6import SportsEsportsIcon from "@mui/icons-material/SportsEsports";
7import SportsMartialArtsIcon from "@mui/icons-material/SportsMartialArts";
8import PersonIcon from "@mui/icons-material/Person";
9import AccountCircleIcon from "@mui/icons-material/AccountCircle";
10import "./App.css";
11import { useNavigate } from "react-router-dom";
12
13const navItems = [
14 { label: "电影", icon: <MovieIcon />, path: "/movie" },
15 { label: "剧集", icon: <EmailIcon />, path: "/tv" },
16 { label: "音乐", icon: <MusicNoteIcon />, path: "/music" },
17 { label: "动漫", icon: <EmojiPeopleIcon />, path: "/anime" },
18 { label: "游戏", icon: <SportsEsportsIcon />, path: "/game" },
19 { label: "体育", icon: <SportsMartialArtsIcon />, path: "/sport" },
20 { label: "资料", icon: <PersonIcon />, path: "/info" },
9563036699e95ae32025-06-02 21:42:11 +080021 { label: "发布", icon: <AccountCircleIcon />, path: "/publish" }, // Added Publish option
956303669a32fc2c2025-06-02 19:45:53 +080022];
23
24const gameTypes = ["PC", "主机", "移动", "掌机", "视频"];
25
26const areaTabs = [
27 { label: "PC", icon: <MovieIcon fontSize="small" /> },
28 { label: "主机", icon: <EmailIcon fontSize="small" /> },
29 { label: "移动", icon: <PersonIcon fontSize="small" /> },
30 { label: "掌机", icon: <EmojiPeopleIcon fontSize="small" /> },
31 { label: "视频", icon: <PersonIcon fontSize="small" /> },
32];
33
9563036699e95ae32025-06-02 21:42:11 +080034const exampleTorrents = [
35 { type: "RPG", title: "实例1", id: 1 },
36 { type: "Shooter", title: "实例2", id: 2 },
37 { type: "Adventure", title: "实例3", id: 3 },
38];
39
956303669a32fc2c2025-06-02 19:45:53 +080040export default function GamePage() {
41 const navigate = useNavigate();
42 const [activeTab, setActiveTab] = useState(0);
43
44 return (
45 <div className="container">
46 {/* 预留顶部空间用于放图片 */}
47 <div style={{ height: 80 }} />
48 <div
49 className="user-bar"
50 style={{
51 position: "fixed",
52 top: 18,
53 right: 42,
54 zIndex: 100,
55 display: "flex",
56 alignItems: "center",
57 background: "#e0f3ff",
58 borderRadius: 12,
59 padding: "6px 18px",
60 boxShadow: "0 2px 8px #b2d8ea",
61 minWidth: 320,
62 minHeight: 48,
63 width: 420,
64 }}
65 >
66 <div
67 style={{ cursor: "pointer", marginRight: 16 }}
68 onClick={() => navigate("/user")}
69 >
70 <AccountCircleIcon
71 style={{
72 fontSize: 38,
73 color: "#1a237e",
74 background: "#e0f3ff",
75 borderRadius: "50%",
76 }}
77 />
78 </div>
79 <div style={{ color: "#222", fontWeight: 500, marginRight: 24 }}>
80 用户栏
81 </div>
82 <div
83 style={{
84 display: "flex",
85 gap: 28,
86 flex: 1,
87 justifyContent: "flex-end",
88 alignItems: "center",
89 }}
90 >
91 <span style={{ color: "#1976d2", fontWeight: 500 }}>
92 魔力值: <b>12345</b>
93 </span>
94 <span style={{ color: "#1976d2", fontWeight: 500 }}>
95 分享率: <b>2.56</b>
96 </span>
97 <span style={{ color: "#1976d2", fontWeight: 500 }}>
98 上传量: <b>100GB</b>
99 </span>
100 <span style={{ color: "#1976d2", fontWeight: 500 }}>
101 下载量: <b>50GB</b>
102 </span>
103 </div>
104 </div>
105 {/* 下方内容整体下移,留出与音乐界面一致的间距 */}
106 <div style={{ height: 32 }} />
107 <nav className="nav-bar card">
108 {navItems.map((item) => (
109 <div
110 key={item.label}
111 className={item.label === "游戏" ? "nav-item active" : "nav-item"}
112 onClick={() => navigate(item.path)}
113 >
114 {item.icon}
115 <span>{item.label}</span>
116 </div>
117 ))}
118 </nav>
119 <div className="search-section card">
120 <input className="search-input" placeholder="输入搜索关键词" />
121 <button className="search-btn">
122 <span role="img" aria-label="search">
123 🔍
124 </span>
125 </button>
126 </div>
127 <div
128 className="area-tabs"
129 style={{
130 display: "flex",
131 justifyContent: "center",
132 gap: 24,
133 margin: "18px 0",
134 }}
135 >
136 {areaTabs.map((tab, idx) => (
137 <div
138 key={tab.label}
139 className={activeTab === idx ? "area-tab active" : "area-tab"}
140 onClick={() => setActiveTab(idx)}
141 >
142 {tab.icon} <span>{tab.label}</span>
143 </div>
144 ))}
145 </div>
146 <div className="table-section">
9563036699e95ae32025-06-02 21:42:11 +0800147 <table className="game-table">
956303669a32fc2c2025-06-02 19:45:53 +0800148 <thead>
149 <tr>
150 <th>游戏类型</th>
151 <th>标题</th>
152 <th>发布者</th>
153 </tr>
154 </thead>
155 <tbody>
156 {gameTypes.map((type, idx) => (
157 <tr key={type}>
9563036699e95ae32025-06-02 21:42:11 +0800158 <td>
159 <a
160 href={`/torrent/${type}`}
161 style={{ color: "#1a237e", textDecoration: "none" }}
162 >
163 {type}
164 </a>
165 </td>
166 <td>
167 <a
168 href={`/torrent/${type}`}
169 style={{ color: "#1a237e", textDecoration: "none" }}
170 >
171 种子{idx + 1}
172 </a>
173 </td>
956303669a32fc2c2025-06-02 19:45:53 +0800174 <td></td>
175 </tr>
176 ))}
177 </tbody>
178 </table>
179 </div>
180 <div style={{ height: 32 }} />
181 <Pagination />
182 </div>
183 );
184}
185
186function Pagination() {
187 const [page, setPage] = React.useState(3);
188 const total = 5;
189 return (
190 <div className="pagination">
191 <button
192 onClick={() => setPage((p) => Math.max(1, p - 1))}
193 disabled={page === 1}
194 >
195 上一页
196 </button>
197 <span className="page-num">
198 {page}/{total}
199 </span>
200 <button
201 onClick={() => setPage((p) => Math.min(total, p + 1))}
202 disabled={page === total}
203 >
204 下一页
205 </button>
206 <span className="page-info">
207 <b>{page}</b>
208 </span>
209 </div>
210 );
211}