Add repo names to heatmap tooltip
Extends the JSON response to include per-day repo names via array_agg on action.repo_name, and surfaces them in the hover tooltip below the contribution count. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -56,7 +56,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
const byDate = Object.fromEntries(data.map(d => [d.date, d.count]));
|
||||
const byDate = Object.fromEntries(data.map(d => [d.date, d]));
|
||||
const bucket = c =>
|
||||
c === 0 ? 0 : c < 3 ? 1 : c < 6 ? 2 : c < 10 ? 3 : 4;
|
||||
|
||||
@@ -85,10 +85,13 @@
|
||||
if (d > today) {
|
||||
cell.classList.add('future');
|
||||
} else {
|
||||
const c = byDate[fmt(d)] || 0;
|
||||
const entry = byDate[fmt(d)];
|
||||
const c = entry ? entry.count : 0;
|
||||
const repos = entry && entry.repos && entry.repos.length ? entry.repos : [];
|
||||
cell.dataset.level = String(bucket(c));
|
||||
// Native browser tooltip. For richer ones, swap in Tippy.js etc.
|
||||
cell.title = `${fmt(d)}: ${c} contribution${c === 1 ? '' : 's'}`;
|
||||
const repoLine = repos.length ? '\n' + repos.join('\n') : '';
|
||||
cell.title = `${fmt(d)}: ${c} contribution${c === 1 ? '' : 's'}${repoLine}`;
|
||||
}
|
||||
frag.appendChild(cell);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user