SPB Git
952 B · 15 lines tsx
1import { fmtDate, fmtInt, t, type Locale } from "@/lib/i18n";2import type { stats } from "@/lib/papers/queries";3export function StatTiles({ s, locale }: { s: Awaited<ReturnType<typeof stats>>; locale: Locale }) {4  const d = t(locale);5  const tiles: [string, string][] = [6    [d.stats.papers, fmtInt(locale, s.papers)], [d.stats.manuscripts, fmtInt(locale, s.manuscripts)], [d.stats.topics, fmtInt(locale, s.topics)], [d.stats.authors, fmtInt(locale, s.authors)],7    [d.stats.datasets, fmtInt(locale, s.datasets)], [d.stats.methods, fmtInt(locale, s.methods)], [d.stats.pages, fmtInt(locale, s.pages)], [d.stats.latest, s.latest ? fmtDate(locale, s.latest, "month") : "—"],8  ];9  return (10    <dl className="grid grid-cols-2 sm:grid-cols-4 gap-3">11      {tiles.map(([label, value]) => <div key={label} className="card px-4 py-3"><dt className="label">{label}</dt><dd className="serif text-2xl mt-1 text-fg">{value}</dd></div>)}12    </dl>13  );14}15
Files · main
Menu

Theme