import { CycleTransferStats, NezhaServer } from "@/types/nezha-api" import React from "react" import { CycleTransferStatsClient } from "./CycleTransferStatsClient" interface CycleTransferStatsProps { serverList: NezhaServer[] cycleStats: CycleTransferStats className?: string } export const CycleTransferStatsCard: React.FC = ({ serverList, cycleStats, className }) => { if (serverList.length === 0) { return null } const serverIdList = serverList.map((server) => server.id.toString()) return (
{Object.entries(cycleStats).map(([cycleId, cycleData]) => { if (!cycleData.server_name) { return null } return Object.entries(cycleData.server_name).map(([serverId, serverName]) => { const transfer = cycleData.transfer?.[serverId] || 0 const nextUpdate = cycleData.next_update?.[serverId] if (!serverIdList.includes(serverId)) { return null } if (!transfer && !nextUpdate) { return null } return ( ) }) })}
) } export default CycleTransferStatsCard