"use client"; import { useApp } from "@/contexts/AppContext"; interface CircleProgressProps { percentage: number; color: string; percentageText: string; } function CircleProgress({ percentage, color, percentageText }: CircleProgressProps) { const size = 50; const strokeWidth = 4; const radius = (size - strokeWidth) / 2; const circumference = radius * 2 * Math.PI; const offset = circumference - (percentage / 100) * circumference; return (
{/* 背景圆环 - 浅色轨道 */} {/* 进度圆环 - 填充部分 */} {/* 中间的百分比文字 */}
{percentageText}
); } export default function TransparencyStats() { const { t } = useApp(); const stats = [ { labelKey: "transparency.totalUsdcSupply", value: "$200.4M", percentage: 52.7, percentageText: "52.7%", percentageColor: "text-[#1447e6]", circleColor: "#1447e6", }, { labelKey: "transparency.utilization", value: "$140.0M", percentage: 30.1, percentageText: "30.1%", percentageColor: "text-[#ff6900]", circleColor: "#ff6900", }, { labelKey: "transparency.activeLoans", value: "$80.0M", percentage: 17.2, percentageText: "17.2%", percentageColor: "text-[#10b981]", circleColor: "#10b981", }, ]; return (
{/* Total Reserves */}
{t("transparency.totalReserves")} $465,000,000
{/* Stats Cards */}
{stats.map((stat, index) => (
{/* Left - Text Info */}
{/* Label */} {t(stat.labelKey)} {/* Value */} {stat.value} {/* Percentage */} {stat.percentageText}
{/* Right - Circle Chart */}
))}
); }