Skip to content

fix: Align message header content#2152

Open
killianmathias wants to merge 3 commits intomasterfrom
fix/align-message-header-content
Open

fix: Align message header content#2152
killianmathias wants to merge 3 commits intomasterfrom
fix/align-message-header-content

Conversation

@killianmathias
Copy link
Copy Markdown

No description provided.

@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts the SwiftUI layout of the message header details to improve horizontal alignment of header content (sender/recipients and date) by switching to a Grid-based layout.

Changes:

  • Replaced the VStack-stacked RecipientLabel rows + date HStack with a Grid containing aligned GridRows.
  • Updated RecipientLabel to render as a GridRow and tweaked recipient text display (avoid showing email twice when name == email).
Comments suppressed due to low confidence (1)

Mail/Views/Thread/Message/MessageHeader/MessageHeaderDetailView.swift:70

  • .onPreferenceChange(ViewWidthKey.self) now only updates labelWidth, but that state isn't read anywhere in the view hierarchy anymore. This can be removed to avoid extra layout passes/state updates.
        .onPreferenceChange(ViewWidthKey.self) {
            labelWidth = $0
        }

Comment on lines 88 to 91
Text(title)
.textStyle(.bodySmallSecondary)
.background(ViewGeometry(key: ViewWidthKey.self, property: \.size.width))
.frame(width: labelWidth, alignment: .leading)
VStack(alignment: .leading, spacing: 4) {
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ViewGeometry(key: ViewWidthKey.self, ...) looks like leftover from the old fixed-label-width approach. If you remove the ViewWidthKey preference handling (since Grid aligns columns automatically), you can also drop this geometry measurement to reduce layout overhead.

Copilot uses AI. Check for mistakes.
Comment on lines 33 to 34
@State private var labelWidth: CGFloat = 100

Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

labelWidth is no longer used to drive any layout (the RecipientLabel binding/frame was removed), so keeping it as @State just adds unnecessary state and view invalidations. Consider removing labelWidth entirely along with the preference-driven width measurement if the Grid alignment is now sufficient.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants