Files
wehub-resource-sync d68f003000
CI / Change detection (push) Has been cancelled
CI / Version drift (push) Has been cancelled
CI / Lint (push) Has been cancelled
CI / Workflow RLM cache (push) Has been cancelled
CI / Test (macos-latest) (push) Has been cancelled
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / npm wrapper smoke (push) Has been cancelled
CI / Mobile runtime smoke (push) Has been cancelled
CI / Workflow lint (push) Has been cancelled
CI / Documentation (push) Has been cancelled
Web Frontend / Lint & Type Check (push) Failing after 1s
Auto-close harvested PRs / close (push) Failing after 1s
cargo-deny / cargo-deny (bans licenses sources) (push) Failing after 1s
Security audit / cargo-audit (push) Failing after 1s
Sync to CNB / sync (push) Failing after 1s
cargo-deny / cargo-deny (advisories) (push) Failing after 3s
Web Frontend / Deploy to Cloudflare (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:08:23 +08:00

34 lines
1.0 KiB
TypeScript

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 (
<div className="hairline-t hairline-b grid grid-cols-2 sm:grid-cols-4 col-rule">
{cells.map((c) => (
<div key={c.label} className="px-5 py-5">
<div className="eyebrow mb-2">
{c.label} · <span className="font-cjk normal-case tracking-normal">{c.cn}</span>
</div>
<div className={c.mono ? "font-mono text-2xl tabular text-ink" : "bignum text-ink"}>{c.value}</div>
</div>
))}
</div>
);
}