import React from "react"; import { cn } from "@/lib/utils"; import { formatBytes } from "@/lib/format"; import AnimatedCircularProgressBar from "./ui/animated-circular-progress-bar"; import { CircleStackIcon } from "@heroicons/react/24/outline"; 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< CycleTransferStatsClientProps > = ({ name, from, to, max, serverStats, className }) => { const { t } = useTranslation(); return (
{serverStats.map(({ serverId, serverName, transfer, nextUpdate }) => { const progress = (transfer / max) * 100; return (
{name}
{new Date(from).toLocaleDateString()} -{" "} {new Date(to).toLocaleDateString()}
{serverName}

{progress.toFixed(0)}%

{formatBytes(transfer)} {t("cycleTransfer.used")} {formatBytes(max)} {t("cycleTransfer.total")}
{t("cycleTransfer.nextUpdate")}:{" "} {new Date(nextUpdate).toLocaleString()}
); })}
); }; export default CycleTransferStatsClient;