import { CheckCircle, Edit3, HelpCircle, RefreshCw, Trash2, Wifi, XCircle, } from "lucide-react"; import type { Site } from "../types"; import { AUTH_TYPE_LABELS, SITE_TYPE_ABBR, SITE_TYPE_COLORS, SITE_TYPE_LABELS, } from "./sitesPageModel"; type SiteCardProps = { site: Site; testing: boolean; onTest: () => void; onEdit: () => void; onDelete: () => void; }; export function SiteCard({ site, testing, onTest, onEdit, onDelete, }: SiteCardProps) { return (
{/* 头部 */}
{SITE_TYPE_ABBR[site.type] || "?"}
{site.name}
{site.url}
{/* 状态指示 */}
{site.last_check_at ? ( site.last_error ? ( ) : ( ) ) : ( )} {!site.enabled && ( 已停用 )}
{/* 标签 */}
{SITE_TYPE_LABELS[site.type] || site.type} {AUTH_TYPE_LABELS[site.auth_type] || site.auth_type} {site.is_default && ( 默认 )} {site.use_proxy && ( 代理 )} {site.rate_limit && ( 限流 )} {site.browser_emulation && ( 浏览器 )}
{/* 状态与统计(只读) */}
状态: {site.login_status || "unknown"}
{(site.upload_bytes || 0) > 0 && (
↑ {Math.round(((site.upload_bytes ?? 0) / 1073741824) * 100) / 100}{" "} GB / ↓{" "} {Math.round(((site.download_bytes ?? 0) / 1073741824) * 100) / 100}{" "} GB
)} {site.priority !== 50 &&
优先级:{site.priority}
}
{/* 操作按钮 */}
); }