{grid.weeks.map((week, wIdx) => (
{week.map((day, dIdx) => {
if (!day) {
return (
);
}
const lvl = level(day.count);
// index back from the end → most recent day first
const fromEnd = days.length - 1 - days.indexOf(day);
const delay = fromEnd * 0.002;
return (
onCellEnter(e, day)}
onFocus={(e) => {
// Synthesise a pointer-style enter for keyboard nav
const cont = containerRef.current;
if (!cont) return;
const r = (
e.currentTarget as HTMLButtonElement
).getBoundingClientRect();
const cr = cont.getBoundingClientRect();
tooltipX.set(r.left - cr.left + r.width / 2);
tooltipY.set(r.top - cr.top - 6);
setHover(day);
}}
onBlur={onLeave}
aria-label={`${day.count} contributions on ${day.date}`}
className={cn(
"block rounded-[3px] outline-none transition-colors",
"ring-0 focus-visible:ring-2 focus-visible:ring-chili-500/60",
LEVEL_BG[lvl],
lvl === 0 &&
"ring-1 ring-inset ring-[var(--border)]/60"
)}
style={{
width: fittedCellSize,
height: fittedCellSize,
willChange: "transform",
}}
/>
);
})}
))}