import type { RepoStats } from "@/lib/types"; function fmt(n: number): string { if (n >= 1000) return (n / 1000).toFixed(1) + "k"; return n.toString(); } export function StatGrid({ stats }: { stats: RepoStats }) { const cells = [ { label: "Stars", cn: "星标", value: fmt(stats.stars) }, { label: "Forks", cn: "复刻", value: fmt(stats.forks) }, { label: "Contributors", cn: "贡献者", value: fmt(stats.contributors) }, { label: "Latest", cn: "版本", value: stats.latestRelease?.tag ?? "—", mono: true, }, ]; return (
{cells.map((c) => (
{c.label} · {c.cn}
{c.value}
))}
); }