Parcourir la source

Fix profile form horizontal inset inside card

Pin the profile form stack to the card with explicit leading and trailing
constraints instead of relying on NSStackView edge insets alone, so labels
and fields stay inside the card border. Keep vertical stack insets and
update compact layout width math for the new horizontal inset.

Co-authored-by: Cursor <cursoragent@cursor.com>
AhtashamShahzad1 il y a 2 mois
Parent
commit
9d266d9064
1 fichiers modifiés avec 6 ajouts et 5 suppressions
  1. 6 5
      App for Indeed/Views/MyProfilePageView.swift

+ 6 - 5
App for Indeed/Views/MyProfilePageView.swift

@@ -128,6 +128,8 @@ final class MyProfilePageView: NSView {
     /// Below this form content width, two-column rows stack vertically.
     private static let compactFormWidth: CGFloat = 640
     private static let horizontalPageInset: CGFloat = 24
+    /// Inset of form content from the card border (left/right); explicit constraints so fields stay inside the card chrome.
+    private static let cardContentHorizontalInset: CGFloat = 28
 
     private let scrollView = NSScrollView()
     private let documentView = NSView()
@@ -270,7 +272,7 @@ final class MyProfilePageView: NSView {
         formStack.alignment = .leading
         formStack.distribution = .fill
         formStack.spacing = 24
-        formStack.edgeInsets = NSEdgeInsets(top: 32, left: 28, bottom: 32, right: 28)
+        formStack.edgeInsets = NSEdgeInsets(top: 32, left: 0, bottom: 32, right: 0)
         formStack.userInterfaceLayoutDirection = .leftToRight
         ProfileLayoutEnforcement.applyForcedLTR(to: formStack)
         formStack.setContentHuggingPriority(.defaultLow, for: .horizontal)
@@ -298,9 +300,8 @@ final class MyProfilePageView: NSView {
             cardView.rightAnchor.constraint(equalTo: documentView.rightAnchor, constant: -Self.horizontalPageInset),
             cardView.topAnchor.constraint(equalTo: documentView.topAnchor, constant: Self.horizontalPageInset),
 
-            formStack.leftAnchor.constraint(equalTo: cardView.leftAnchor),
-            formStack.rightAnchor.constraint(equalTo: cardView.rightAnchor),
-            formStack.widthAnchor.constraint(equalTo: cardView.widthAnchor),
+            formStack.leadingAnchor.constraint(equalTo: cardView.leadingAnchor, constant: Self.cardContentHorizontalInset),
+            formStack.trailingAnchor.constraint(equalTo: cardView.trailingAnchor, constant: -Self.cardContentHorizontalInset),
             formStack.topAnchor.constraint(equalTo: cardView.topAnchor),
             formStack.bottomAnchor.constraint(equalTo: cardView.bottomAnchor)
         ])
@@ -371,7 +372,7 @@ final class MyProfilePageView: NSView {
     private func applyResponsiveRowsIfNeeded() {
         let w = cardView.bounds.width
         guard w > 1 else { return }
-        let formWidth = max(0, w - formStack.edgeInsets.left - formStack.edgeInsets.right)
+        let formWidth = max(0, w - 2 * Self.cardContentHorizontalInset - formStack.edgeInsets.left - formStack.edgeInsets.right)
         let compact = formWidth < Self.compactFormWidth
         guard compact != lastCompactLayout else { return }
         lastCompactLayout = compact