فهرست منبع

Fix job card title row: pin titles to leading edge

Use an expanding spacer between the title and action buttons so the
title stays left-aligned with the description while Apply/Saved/dismiss
remain on the trailing edge. Adjust stack spacing with custom spacing
after the spacer to preserve the previous 14pt gap before buttons.

Co-authored-by: Cursor <cursoragent@cursor.com>
AhtashamShahzad1 2 ماه پیش
والد
کامیت
afc43648c0
1فایلهای تغییر یافته به همراه12 افزوده شده و 3 حذف شده
  1. 12 3
      App for Indeed/Views/DashboardView.swift

+ 12 - 3
App for Indeed/Views/DashboardView.swift

@@ -319,6 +319,7 @@ final class DashboardView: NSView, NSTextFieldDelegate {
         titleField.textColor = Theme.primaryText
         titleField.maximumNumberOfLines = 2
         titleField.lineBreakMode = .byWordWrapping
+        titleField.alignment = .left
         titleField.translatesAutoresizingMaskIntoConstraints = false
 
         let descriptionField = NSTextField(wrappingLabelWithString: job.description)
@@ -376,14 +377,22 @@ final class DashboardView: NSView, NSTextFieldDelegate {
         buttonRow.setContentHuggingPriority(.required, for: .horizontal)
         buttonRow.setContentCompressionResistancePriority(.required, for: .horizontal)
 
-        titleField.setContentHuggingPriority(.defaultLow, for: .horizontal)
+        // Title hugs the leading edge; a low–hugging-priority spacer absorbs remaining width so buttons stay trailing.
+        titleField.setContentHuggingPriority(.defaultHigh, for: .horizontal)
         titleField.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
 
-        let titleAndActionsRow = NSStackView(views: [titleField, buttonRow])
+        let titleRowSpacer = NSView()
+        titleRowSpacer.translatesAutoresizingMaskIntoConstraints = false
+        titleRowSpacer.setContentHuggingPriority(NSLayoutConstraint.Priority(1), for: .horizontal)
+        titleRowSpacer.setContentCompressionResistancePriority(NSLayoutConstraint.Priority(1), for: .horizontal)
+
+        let titleAndActionsRow = NSStackView(views: [titleField, titleRowSpacer, buttonRow])
         titleAndActionsRow.orientation = .horizontal
-        titleAndActionsRow.spacing = 14
+        titleAndActionsRow.spacing = 0
+        titleAndActionsRow.setCustomSpacing(14, after: titleRowSpacer)
         titleAndActionsRow.alignment = .centerY
         titleAndActionsRow.distribution = .fill
+        titleAndActionsRow.userInterfaceLayoutDirection = .leftToRight
         titleAndActionsRow.translatesAutoresizingMaskIntoConstraints = false
 
         let contentColumn = NSStackView(views: [titleAndActionsRow, descriptionField])