| import React from 'react'; |
| |
| const ColdTorrentsDialog = ({ |
| showColdDialog, |
| coldTorrents, |
| closeColdDialog, |
| fetchTorrentDetail |
| }) => { |
| return ( |
| showColdDialog && ( |
| <div className="cold-dialog-overlay"> |
| <div className="cold-dialog"> |
| <h3 className="cold-dialog-title">冷门资源列表</h3> |
| <button |
| className="close-btn" |
| onClick={closeColdDialog} |
| > |
| × |
| </button> |
| |
| {coldTorrents.length === 0 ? ( |
| <div className="empty-state">暂无冷门资源</div> |
| ) : ( |
| <div className="cold-table-container"> |
| <table className="cold-torrent-table"> |
| <thead> |
| <tr> |
| <th>序号</th> |
| <th>资源名称</th> |
| <th>资源ID</th> |
| <th>分类</th> |
| <th>描述</th> |
| <th>下载用户数</th> |
| <th>浏览次数</th> |
| <th>创建时间</th> |
| </tr> |
| </thead> |
| <tbody> |
| {coldTorrents.map((torrent, index) => ( |
| <tr key={torrent.id}> |
| <td>{index + 1}</td> |
| <td> |
| <button |
| className="torrent-link" |
| onClick={() => fetchTorrentDetail(torrent.id)} |
| aria-label={`查看种子${torrent.title || torrent.id}的详情`} |
| > |
| {torrent.title} |
| </button> |
| </td> |
| <td>{torrent.id}</td> |
| <td>{torrent.category || '未分类'}</td> |
| <td>{torrent.description || '无描述'}</td> |
| <td>{torrent.leechers || 0}</td> |
| <td>{torrent.views || 0}</td> |
| <td>{new Date(torrent.createdTime).toLocaleDateString()}</td> |
| </tr> |
| ))} |
| </tbody> |
| </table> |
| </div> |
| )} |
| </div> |
| </div> |
| ) |
| ); |
| }; |
| |
| export default ColdTorrentsDialog; |