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

Fix sidebar pro card layout: center content and fit width

Center the Premium upgrade stack with NSStackView centerX alignment,
center-aligned copy and CTA, and use centerX instead of invalid
NSLayoutConstraint.Attribute.center.

Reduce the pro card width so it stays inside the sidebar’s inset
content area (218pt column minus 14pt horizontal edge insets), which
stops the upgrade button from sitting against the right edge. Sync
the description preferredMaxLayoutWidth with the inner content width.

Co-authored-by: Cursor <cursoragent@cursor.com>
AhtashamShahzad1 недель назад: 3
Родитель
Сommit
2a4287a4d2
1 измененных файлов с 10 добавлено и 6 удалено
  1. 10 6
      App for Indeed/Views/DashboardView.swift

+ 10 - 6
App for Indeed/Views/DashboardView.swift

@@ -172,7 +172,7 @@ final class DashboardView: NSView {
172 172
             contentStack.topAnchor.constraint(equalTo: chromeContainer.topAnchor),
173 173
             contentStack.bottomAnchor.constraint(equalTo: chromeContainer.bottomAnchor),
174 174
 
175
-            sidebar.widthAnchor.constraint(equalToConstant: 225),
175
+            sidebar.widthAnchor.constraint(equalToConstant: 218),
176 176
             mainHost.widthAnchor.constraint(greaterThanOrEqualToConstant: 720),
177 177
 
178 178
             mainOverlay.leadingAnchor.constraint(equalTo: mainHost.leadingAnchor),
@@ -347,7 +347,7 @@ final class DashboardView: NSView {
347 347
         inner.translatesAutoresizingMaskIntoConstraints = false
348 348
         inner.orientation = .vertical
349 349
         inner.spacing = 10
350
-        inner.alignment = .leading
350
+        inner.alignment = .centerX
351 351
 
352 352
         let proIcon = NSImageView()
353 353
         proIcon.translatesAutoresizingMaskIntoConstraints = false
@@ -358,7 +358,7 @@ final class DashboardView: NSView {
358 358
         let proEyebrow = NSTextField(labelWithString: "Premium")
359 359
         proEyebrow.font = .systemFont(ofSize: 11, weight: .heavy)
360 360
         proEyebrow.textColor = Theme.proAccent
361
-        proEyebrow.alignment = .left
361
+        proEyebrow.alignment = .center
362 362
 
363 363
         let eyebrowRow = NSStackView(views: [proIcon, proEyebrow])
364 364
         eyebrowRow.orientation = .horizontal
@@ -368,18 +368,23 @@ final class DashboardView: NSView {
368 368
         let headline = NSTextField(labelWithString: "Upgrade to Pro")
369 369
         headline.font = .systemFont(ofSize: 16, weight: .bold)
370 370
         headline.textColor = Theme.primaryText
371
-        headline.alignment = .left
371
+        headline.alignment = .center
372 372
 
373 373
         let upgradeDescription = NSTextField(wrappingLabelWithString: "Unlimited AI matches, smart alerts, and interview prep—all in one place.")
374 374
         upgradeDescription.font = .systemFont(ofSize: 12, weight: .regular)
375 375
         upgradeDescription.textColor = Theme.secondaryText
376
-        upgradeDescription.preferredMaxLayoutWidth = 165
376
+        upgradeDescription.alignment = .center
377
+        // Sidebar content width is 190pt (218 − edge insets); card must stay within that band.
378
+        let cardWidth: CGFloat = 186
379
+        let innerContentWidth = cardWidth - 28
380
+        upgradeDescription.preferredMaxLayoutWidth = innerContentWidth
377 381
 
378 382
         let upgradeButton = NSButton(title: "Upgrade to Pro", target: self, action: #selector(didTapUpgradeToPro))
379 383
         upgradeButton.isBordered = false
380 384
         upgradeButton.bezelStyle = .rounded
381 385
         upgradeButton.font = .systemFont(ofSize: 13, weight: .bold)
382 386
         upgradeButton.contentTintColor = Theme.proCTAText
387
+        upgradeButton.alignment = .center
383 388
         upgradeButton.wantsLayer = true
384 389
         upgradeButton.layer?.backgroundColor = Theme.proCTABackground.cgColor
385 390
         upgradeButton.layer?.cornerRadius = 20
@@ -394,7 +399,6 @@ final class DashboardView: NSView {
394 399
         upgradeCard.addSubview(accentBar)
395 400
         upgradeCard.addSubview(inner)
396 401
 
397
-        let cardWidth: CGFloat = 197
398 402
         NSLayoutConstraint.activate([
399 403
             upgradeCard.widthAnchor.constraint(equalToConstant: cardWidth),
400 404