Просмотр исходного кода

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 недель назад: 3
Родитель
Сommit
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 {
319 319
         titleField.textColor = Theme.primaryText
320 320
         titleField.maximumNumberOfLines = 2
321 321
         titleField.lineBreakMode = .byWordWrapping
322
+        titleField.alignment = .left
322 323
         titleField.translatesAutoresizingMaskIntoConstraints = false
323 324
 
324 325
         let descriptionField = NSTextField(wrappingLabelWithString: job.description)
@@ -376,14 +377,22 @@ final class DashboardView: NSView, NSTextFieldDelegate {
376 377
         buttonRow.setContentHuggingPriority(.required, for: .horizontal)
377 378
         buttonRow.setContentCompressionResistancePriority(.required, for: .horizontal)
378 379
 
379
-        titleField.setContentHuggingPriority(.defaultLow, for: .horizontal)
380
+        // Title hugs the leading edge; a low–hugging-priority spacer absorbs remaining width so buttons stay trailing.
381
+        titleField.setContentHuggingPriority(.defaultHigh, for: .horizontal)
380 382
         titleField.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
381 383
 
382
-        let titleAndActionsRow = NSStackView(views: [titleField, buttonRow])
384
+        let titleRowSpacer = NSView()
385
+        titleRowSpacer.translatesAutoresizingMaskIntoConstraints = false
386
+        titleRowSpacer.setContentHuggingPriority(NSLayoutConstraint.Priority(1), for: .horizontal)
387
+        titleRowSpacer.setContentCompressionResistancePriority(NSLayoutConstraint.Priority(1), for: .horizontal)
388
+
389
+        let titleAndActionsRow = NSStackView(views: [titleField, titleRowSpacer, buttonRow])
383 390
         titleAndActionsRow.orientation = .horizontal
384
-        titleAndActionsRow.spacing = 14
391
+        titleAndActionsRow.spacing = 0
392
+        titleAndActionsRow.setCustomSpacing(14, after: titleRowSpacer)
385 393
         titleAndActionsRow.alignment = .centerY
386 394
         titleAndActionsRow.distribution = .fill
395
+        titleAndActionsRow.userInterfaceLayoutDirection = .leftToRight
387 396
         titleAndActionsRow.translatesAutoresizingMaskIntoConstraints = false
388 397
 
389 398
         let contentColumn = NSStackView(views: [titleAndActionsRow, descriptionField])