refactor(docs): rename recent stats to heat and update dashboard rendering

This commit is contained in:
Prad Nukala
2026-08-31 18:56:52 -04:00
parent 664ea534ed
commit d13859d31e
+7 -3
View File
@@ -46,7 +46,8 @@ interface Stats {
}[];
streak: number;
queue: { date: string; due: number }[];
recent: { date: string; attempts: number; passes: number }[];
/** Every campaign day, zeros included; this page reads only the tail. */
heat: { date: string; attempts: number; passes: number }[];
}
function isStats(value: unknown): value is Stats {
@@ -60,7 +61,7 @@ function isStats(value: unknown): value is Stats {
Array.isArray(v.phases) &&
Array.isArray(v.gates) &&
Array.isArray(v.queue) &&
Array.isArray(v.recent) &&
Array.isArray(v.heat) &&
typeof v.streak === "number"
);
}
@@ -332,11 +333,14 @@ const GREENS = [
];
function Recent({ stats }: { stats: Stats }) {
// heat spans the whole campaign, future days and all. The window wanted here
// is the seven days ending today, and campaign.day is that day, 1-based.
const week = stats.heat.slice(Math.max(0, stats.campaign.day - 7), stats.campaign.day);
return (
<div style={card}>
<div style={heading}>Last 7 days</div>
<div style={{ display: "flex", gap: "0.4rem", flexWrap: "wrap" }}>
{stats.recent.map((r) => (
{week.map((r) => (
<span
key={r.date}
title={`${r.date}: ${r.passes}/${r.attempts} passed`}