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