From 9c7cef3869721537a10cde9bfe6bee3a50923f4e Mon Sep 17 00:00:00 2001 From: Georg Bauer Date: Fri, 31 Jul 2026 18:00:51 +0200 Subject: [PATCH] Center the Home activity strip --- TESTING.md | 2 ++ ios/Sources/ListScreens.swift | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/TESTING.md b/TESTING.md index aff5c92..7572e01 100644 --- a/TESTING.md +++ b/TESTING.md @@ -128,6 +128,8 @@ xcrun simctl launch booted de.rfc1437.gotcha - [ ] Home shows the selected server name, contribution total, nine labeled months with gaps between them, and recent activity. +- [ ] The nine-month activity strip is horizontally centered beneath its title + without clipping either edge. - [ ] Activity rows have the correct icon, repository, summary, and date. - [ ] The compact icon row below the activity graph sits flat on the normal background with no border or pill and defaults to the clock. Select the diff --git a/ios/Sources/ListScreens.swift b/ios/Sources/ListScreens.swift index 85ee31e..92d0304 100644 --- a/ios/Sources/ListScreens.swift +++ b/ios/Sources/ListScreens.swift @@ -562,8 +562,11 @@ final class HeatmapView: UIView { (calendar.dateComponents([.day], from: firstWeek, to: lastDate).day ?? 0) / 7 + 1 ) let monthGap: CGFloat = 4 - let width = max(4, min(6, (bounds.width - 32) / weekCount - 1)) + let monthGaps = CGFloat(max(months.count - 1, 0)) * monthGap + let width = max(4, min(6, (bounds.width - 32 - monthGaps) / weekCount - 1)) let gap = width + 1 + let graphWidth = (weekCount - 1) * gap + width + monthGaps + let graphOrigin = max(0, (bounds.width - graphWidth) / 2) let labelAttributes: [NSAttributedString.Key: Any] = [ .font: UIFont.preferredFont(forTextStyle: .caption2), .foregroundColor: UIColor.secondaryLabel, @@ -572,7 +575,7 @@ final class HeatmapView: UIView { let days = calendar.dateComponents([.day], from: firstWeek, to: month).day ?? 0 monthFormatter.string(from: month).draw( at: CGPoint( - x: 16 + CGFloat(days / 7) * gap + CGFloat(index) * monthGap, + x: graphOrigin + CGFloat(days / 7) * gap + CGFloat(index) * monthGap, y: 34 ), withAttributes: labelAttributes @@ -595,7 +598,7 @@ final class HeatmapView: UIView { colors[Int(min(cell.level, 4))].setFill() UIBezierPath( roundedRect: CGRect( - x: 16 + CGFloat(days / 7) * gap + CGFloat(monthIndex) * monthGap, + x: graphOrigin + CGFloat(days / 7) * gap + CGFloat(monthIndex) * monthGap, y: 48 + CGFloat(calendar.component(.weekday, from: date) - 1) * gap, width: width, height: width