From cddbb815d22f0038c0c50443e5a67f18207a41c5 Mon Sep 17 00:00:00 2001 From: Victor Tran Date: Wed, 20 May 2026 14:51:23 -0700 Subject: [PATCH 1/2] Align miner heatmap summary window --- src/components/ContributionHeatmap.tsx | 8 ++++---- src/components/miners/MinerActivity.tsx | 19 ++++++++++--------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/components/ContributionHeatmap.tsx b/src/components/ContributionHeatmap.tsx index 6c759ea6..69b06ed8 100644 --- a/src/components/ContributionHeatmap.tsx +++ b/src/components/ContributionHeatmap.tsx @@ -15,7 +15,7 @@ interface ContributionData { interface ContributionHeatmapProps { data: ContributionData[]; - contributionsLast30Days: number; + contributionsShown: number; totalDaysShown: number; subtitle?: string; footerText?: string; @@ -28,9 +28,9 @@ interface ContributionHeatmapProps { const ContributionHeatmap: React.FC = ({ data, - contributionsLast30Days, + contributionsShown, totalDaysShown, - subtitle = 'network contribution(s) in the last 30 days', + subtitle = `network contribution(s) in the last ${totalDaysShown} day(s)`, footerText, emptyTitle = 'No contributions yet', emptySubtitle = 'Activity will appear here once PRs are merged', @@ -55,7 +55,7 @@ const ContributionHeatmap: React.FC = ({ lineHeight: 1, }} > - {contributionsLast30Days.toLocaleString()} + {contributionsShown.toLocaleString()} = ({ }; // Calculate contribution heatmap data - const { contributionData, contributionsLast30Days, totalDaysShown } = + const { contributionData, contributionsShown, totalDaysShown } = useMemo(() => { if (!prs || prs.length === 0) { return { contributionData: [], - contributionsLast30Days: 0, + contributionsShown: 0, totalDaysShown: 0, }; } @@ -385,9 +385,6 @@ const MinerActivity: React.FC = ({ dataMap.set(format(subDays(today, i), 'yyyy-MM-dd'), 0); } - let last30Count = 0; - const thirtyDaysAgo = subDays(today, 30); - prs.forEach((pr) => { if (!pr.mergedAt) return; const date = new Date(pr.mergedAt); @@ -397,9 +394,13 @@ const MinerActivity: React.FC = ({ if (dataMap.has(dateStr)) { dataMap.set(dateStr, (dataMap.get(dateStr) || 0) + 1); } - if (date >= thirtyDaysAgo) last30Count++; }); + const shownCount = Array.from(dataMap.values()).reduce( + (total, count) => total + count, + 0 + ); + const data = Array.from(dataMap.entries()) .map(([date, count]) => { let level: 0 | 1 | 2 | 3 | 4 = 0; @@ -413,7 +414,7 @@ const MinerActivity: React.FC = ({ return { contributionData: data, - contributionsLast30Days: last30Count, + contributionsShown: shownCount, totalDaysShown: daysToShow, }; }, [prs]); @@ -660,9 +661,9 @@ const MinerActivity: React.FC = ({ > Date: Thu, 21 May 2026 20:25:40 -0700 Subject: [PATCH 2/2] fix: align heatmap summary days --- src/components/miners/MinerActivity.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/miners/MinerActivity.tsx b/src/components/miners/MinerActivity.tsx index db69ed82..a6c1455d 100644 --- a/src/components/miners/MinerActivity.tsx +++ b/src/components/miners/MinerActivity.tsx @@ -362,7 +362,7 @@ const MinerActivity: React.FC = ({ return { contributionData: [], contributionsShown: 0, - totalDaysShown: 0, + totalDaysShown: 1, }; } @@ -398,7 +398,7 @@ const MinerActivity: React.FC = ({ const shownCount = Array.from(dataMap.values()).reduce( (total, count) => total + count, - 0 + 0, ); const data = Array.from(dataMap.entries()) @@ -415,7 +415,7 @@ const MinerActivity: React.FC = ({ return { contributionData: data, contributionsShown: shownCount, - totalDaysShown: daysToShow, + totalDaysShown: data.length, }; }, [prs]);