瀏覽代碼

Inset work and education entry cards with explicit constraints

Pin inner stack views with leading and trailing margins inside each work
and education entry card so fields align with the main profile form. Set
stack edge insets to NSEdgeInsets() because NSEdgeInsets has no .zero member
in AppKit.

Co-authored-by: Cursor <cursoragent@cursor.com>
AhtashamShahzad1 2 月之前
父節點
當前提交
82a85daadf
共有 1 個文件被更改,包括 15 次插入10 次删除
  1. 15 10
      App for Indeed/Views/MyProfilePageView.swift

+ 15 - 10
App for Indeed/Views/MyProfilePageView.swift

@@ -883,6 +883,11 @@ final class MyProfilePageView: NSView {
 
 // MARK: - Work experience & education rows
 
+private enum ProfileEntryCardLayout {
+    /// Horizontal inset of fields inside each work/education entry card (matches main profile form).
+    static let horizontalInset: CGFloat = 28
+}
+
 private final class WorkExperienceEntryView: NSView {
     var onDelete: (() -> Void)?
 
@@ -981,17 +986,17 @@ private final class WorkExperienceEntryView: NSView {
         inner.spacing = 16
         inner.alignment = .leading
         inner.translatesAutoresizingMaskIntoConstraints = false
-        inner.edgeInsets = NSEdgeInsets(top: 16, left: 18, bottom: 16, right: 18)
+        inner.edgeInsets = NSEdgeInsets()
         inner.userInterfaceLayoutDirection = .leftToRight
         ProfileLayoutEnforcement.applyForcedLTR(to: inner)
         inner.pinAllArrangedSubviewWidthsEqualToStackWidth()
 
         addSubview(inner)
         NSLayoutConstraint.activate([
-            inner.leftAnchor.constraint(equalTo: leftAnchor),
-            inner.rightAnchor.constraint(equalTo: rightAnchor),
-            inner.topAnchor.constraint(equalTo: topAnchor),
-            inner.bottomAnchor.constraint(equalTo: bottomAnchor)
+            inner.leadingAnchor.constraint(equalTo: leadingAnchor, constant: ProfileEntryCardLayout.horizontalInset),
+            inner.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -ProfileEntryCardLayout.horizontalInset),
+            inner.topAnchor.constraint(equalTo: topAnchor, constant: 16),
+            inner.bottomAnchor.constraint(equalTo: bottomAnchor, constant: -16)
         ])
     }
 
@@ -1255,17 +1260,17 @@ private final class EducationEntryView: NSView {
         inner.spacing = 14
         inner.alignment = .leading
         inner.translatesAutoresizingMaskIntoConstraints = false
-        inner.edgeInsets = NSEdgeInsets(top: 14, left: 18, bottom: 14, right: 18)
+        inner.edgeInsets = NSEdgeInsets()
         inner.userInterfaceLayoutDirection = .leftToRight
         ProfileLayoutEnforcement.applyForcedLTR(to: inner)
         inner.pinAllArrangedSubviewWidthsEqualToStackWidth()
 
         addSubview(inner)
         NSLayoutConstraint.activate([
-            inner.leftAnchor.constraint(equalTo: leftAnchor),
-            inner.rightAnchor.constraint(equalTo: rightAnchor),
-            inner.topAnchor.constraint(equalTo: topAnchor),
-            inner.bottomAnchor.constraint(equalTo: bottomAnchor)
+            inner.leadingAnchor.constraint(equalTo: leadingAnchor, constant: ProfileEntryCardLayout.horizontalInset),
+            inner.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -ProfileEntryCardLayout.horizontalInset),
+            inner.topAnchor.constraint(equalTo: topAnchor, constant: 14),
+            inner.bottomAnchor.constraint(equalTo: bottomAnchor, constant: -14)
         ])
     }