A full-featured download manager.
fix(dashboard): omit partial leading month label in activity heatmap (#1938)
Justin Jacob47c46a37e98c
diff --git a/src/renderer/routes/dashboard/activity/activity-calendar-model.test.ts b/src/renderer/routes/dashboard/activity/activity-calendar-model.test.tsindex 32025ed6..fe16835c 100644--- a/src/renderer/routes/dashboard/activity/activity-calendar-model.test.ts+++ b/src/renderer/routes/dashboard/activity/activity-calendar-model.test.ts@@ -142,6 +142,14 @@ describe('activity calendar day model', () => {expect(projected.at(-1)?.dateKey).toBe(cells.at(-1)?.dateKey)})+ it('omits a short leading partial month that would overlap the next label', () => {+ const cells = buildActivityCells(snapshot(), new Date(2026, 7, 23, 12))+ const labels = activityMonthLabels(cells)++ expect(new Date(labels[0]?.dateMs ?? 0).getMonth()).toBe(8)+ expect(labels[0]?.cellIndex).toBe(7)+ })+it('omits the duplicated trailing month label only in a full-year view', () => {const cells = buildActivityCells(snapshot(), new Date(2026, 6, 29, 12))const fullYearLabels = activityMonthLabels(cells)diff --git a/src/renderer/routes/dashboard/activity/activity-calendar-model.ts b/src/renderer/routes/dashboard/activity/activity-calendar-model.tsindex 8a4d8388..4182948b 100644--- a/src/renderer/routes/dashboard/activity/activity-calendar-model.ts+++ b/src/renderer/routes/dashboard/activity/activity-calendar-model.ts@@ -504,6 +504,15 @@ export function activityMonthLabels(}}+ // A partial month with fewer than three visible week columns does not leave+ // enough room for both short labels, so prefer the next complete month.+ const leadingLabelIsPartial =+ labels[0] && new Date(labels[0].dateMs).getDate() !== 1++ if (leadingLabelIsPartial && labels[1] && labels[1].cellIndex <= 14) {+ labels.shift()+ }+// A 53-week projection commonly begins and ends in the same named month// across adjacent years. Repeating that month at both edges reads like a// duplicate heading, so keep the leading label only for the full-year view.