blob: 79d2b4b7e0541b20bfe6dc0c5fd5d22b06772811 [file] [log] [blame]
Krishyadbfadaa2025-06-09 20:33:15 +08001import React from 'react';
2
3const ColdTorrentsDialog = ({
4 showColdDialog,
5 coldTorrents,
6 closeColdDialog,
7 fetchTorrentDetail
8}) => {
9 return (
10 showColdDialog && (
11 <div className="cold-dialog-overlay">
12 <div className="cold-dialog">
13 <h3 className="cold-dialog-title">冷门资源列表</h3>
14 <button
15 className="close-btn"
16 onClick={closeColdDialog}
17 >
18 &times;
19 </button>
20
21 {coldTorrents.length === 0 ? (
22 <div className="empty-state">暂无冷门资源</div>
23 ) : (
24 <div className="cold-table-container">
25 <table className="cold-torrent-table">
26 <thead>
27 <tr>
28 <th>序号</th>
29 <th>资源名称</th>
30 <th>资源ID</th>
31 <th>分类</th>
32 <th>描述</th>
33 <th>下载用户数</th>
34 <th>浏览次数</th>
35 <th>创建时间</th>
36 </tr>
37 </thead>
38 <tbody>
39 {coldTorrents.map((torrent, index) => (
40 <tr key={torrent.id}>
41 <td>{index + 1}</td>
42 <td>
43 <button
44 className="torrent-link"
45 onClick={() => fetchTorrentDetail(torrent.id)}
46 aria-label={`查看种子${torrent.title || torrent.id}的详情`}
47 >
48 {torrent.title}
49 </button>
50 </td>
51 <td>{torrent.id}</td>
52 <td>{torrent.category || '未分类'}</td>
53 <td>{torrent.description || '无描述'}</td>
54 <td>{torrent.leechers || 0}</td>
55 <td>{torrent.views || 0}</td>
56 <td>{new Date(torrent.createdTime).toLocaleDateString()}</td>
57 </tr>
58 ))}
59 </tbody>
60 </table>
61 </div>
62 )}
63 </div>
64 </div>
65 )
66 );
67};
68
69export default ColdTorrentsDialog;