import { formatBytes } from "@/lib/format" import { cn } from "@/lib/utils" import React from "react" import { useTranslation } from "react-i18next" interface CycleTransferStatsClientProps { name: string from: string to: string max: number serverStats: Array<{ serverId: string serverName: string transfer: number nextUpdate: string }> className?: string } export const CycleTransferStatsClient: React.FC = ({ name, from, to, max, serverStats, className }) => { const { t } = useTranslation() const customBackgroundImage = (window.CustomBackgroundImage as string) !== "" ? window.CustomBackgroundImage : undefined return (
{serverStats.map(({ serverId, serverName, transfer, nextUpdate }) => { const progress = (transfer / max) * 100 return (
{/* Header */}
{serverName}
{name}
{/* Progress Section */}
{formatBytes(transfer)} / {formatBytes(max)}
{progress.toFixed(1)}%
{/* Footer */}
{new Date(from).toLocaleDateString()} - {new Date(to).toLocaleDateString()} {t("cycleTransfer.nextUpdate")}: {new Date(nextUpdate).toLocaleString()}
) })}
) } export default CycleTransferStatsClient