Procházet zdrojové kódy

Refine premium and dashboard window corner styling.

Align rounded edge clipping across the main and subscription windows, and remove the duplicated "Most Popular" badge treatments from the premium card layout for a cleaner UI.

Co-authored-by: Cursor <cursoragent@cursor.com>
AhtashamShahzad1 před 3 týdny
rodič
revize
3321b41e84

+ 14 - 46
App for Indeed/Controllers/PremiumPlansWindowController.swift

@@ -6,10 +6,21 @@ final class PremiumPlansWindowController: NSWindowController {
6
         let window = NSWindow(contentViewController: viewController)
6
         let window = NSWindow(contentViewController: viewController)
7
         window.title = "Premium Plans"
7
         window.title = "Premium Plans"
8
         window.styleMask = [.titled, .closable, .miniaturizable, .resizable]
8
         window.styleMask = [.titled, .closable, .miniaturizable, .resizable]
9
+        window.styleMask.insert(.fullSizeContentView)
10
+        window.titlebarAppearsTransparent = true
11
+        window.titleVisibility = .hidden
12
+        window.isOpaque = false
13
+        window.backgroundColor = .clear
9
         window.setContentSize(NSSize(width: 1160, height: 760))
14
         window.setContentSize(NSSize(width: 1160, height: 760))
10
         window.minSize = NSSize(width: 980, height: 680)
15
         window.minSize = NSSize(width: 980, height: 680)
11
         window.center()
16
         window.center()
12
         super.init(window: window)
17
         super.init(window: window)
18
+
19
+        if let frameView = window.contentView?.superview {
20
+            frameView.wantsLayer = true
21
+            frameView.layer?.cornerRadius = 18
22
+            frameView.layer?.masksToBounds = true
23
+        }
13
     }
24
     }
14
 
25
 
15
     @available(*, unavailable)
26
     @available(*, unavailable)
@@ -77,7 +88,7 @@ private final class PremiumPlansViewController: NSViewController {
77
             subtitle: "Balanced for regular productivity",
88
             subtitle: "Balanced for regular productivity",
78
             price: "$19.99",
89
             price: "$19.99",
79
             period: "/ month",
90
             period: "/ month",
80
-            billedPill: "Most Popular",
91
+            billedPill: "",
81
             billedLine: "",
92
             billedLine: "",
82
             crossedPrice: nil,
93
             crossedPrice: nil,
83
             savingsText: nil,
94
             savingsText: nil,
@@ -112,26 +123,16 @@ private final class PremiumPlansViewController: NSViewController {
112
     ]
123
     ]
113
 
124
 
114
     private let pageGradient = CAGradientLayer()
125
     private let pageGradient = CAGradientLayer()
115
-    private lazy var popularGradient: CAGradientLayer = {
116
-        let layer = CAGradientLayer()
117
-        layer.colors = [
118
-            NSColor(srgbRed: 189 / 255, green: 52 / 255, blue: 255 / 255, alpha: 1).cgColor,
119
-            NSColor(srgbRed: 73 / 255, green: 153 / 255, blue: 255 / 255, alpha: 1).cgColor
120
-        ]
121
-        layer.startPoint = CGPoint(x: 0, y: 0.5)
122
-        layer.endPoint = CGPoint(x: 1, y: 0.5)
123
-        return layer
124
-    }()
125
-
126
     override func viewDidLayout() {
126
     override func viewDidLayout() {
127
         super.viewDidLayout()
127
         super.viewDidLayout()
128
         pageGradient.frame = view.bounds
128
         pageGradient.frame = view.bounds
129
-        popularGradient.frame = CGRect(x: 0, y: 0, width: 160, height: 22)
130
     }
129
     }
131
 
130
 
132
     override func loadView() {
131
     override func loadView() {
133
         view = NSView()
132
         view = NSView()
134
         view.wantsLayer = true
133
         view.wantsLayer = true
134
+        view.layer?.cornerRadius = 18
135
+        view.layer?.masksToBounds = true
135
         pageGradient.colors = [Theme.pageStart.cgColor, Theme.pageEnd.cgColor]
136
         pageGradient.colors = [Theme.pageStart.cgColor, Theme.pageEnd.cgColor]
136
         pageGradient.startPoint = CGPoint(x: 0, y: 1)
137
         pageGradient.startPoint = CGPoint(x: 0, y: 1)
137
         pageGradient.endPoint = CGPoint(x: 1, y: 0)
138
         pageGradient.endPoint = CGPoint(x: 1, y: 0)
@@ -293,39 +294,6 @@ private final class PremiumPlansViewController: NSViewController {
293
             selectButton.widthAnchor.constraint(equalTo: content.widthAnchor)
294
             selectButton.widthAnchor.constraint(equalTo: content.widthAnchor)
294
         ])
295
         ])
295
 
296
 
296
-        if plan.highlight {
297
-            let badgeHost = NSView()
298
-            badgeHost.translatesAutoresizingMaskIntoConstraints = false
299
-            badgeHost.wantsLayer = true
300
-            badgeHost.layer?.cornerRadius = 14
301
-            badgeHost.layer?.masksToBounds = true
302
-            badgeHost.layer?.addSublayer(popularGradient)
303
-
304
-            let sparkle = NSImageView()
305
-            sparkle.translatesAutoresizingMaskIntoConstraints = false
306
-            sparkle.symbolConfiguration = NSImage.SymbolConfiguration(pointSize: 10, weight: .semibold)
307
-            sparkle.image = NSImage(systemSymbolName: "sparkles", accessibilityDescription: nil)
308
-            sparkle.contentTintColor = .white
309
-
310
-            let badge = NSTextField(labelWithString: "Most Popular")
311
-            badge.font = .systemFont(ofSize: 12, weight: .bold)
312
-            badge.textColor = .white
313
-
314
-            badgeHost.addSubview(sparkle)
315
-            badgeHost.addSubview(badge)
316
-            card.addSubview(badgeHost)
317
-            NSLayoutConstraint.activate([
318
-                badgeHost.trailingAnchor.constraint(equalTo: card.trailingAnchor, constant: -14),
319
-                badgeHost.topAnchor.constraint(equalTo: card.topAnchor, constant: 10),
320
-                badgeHost.widthAnchor.constraint(equalToConstant: 160),
321
-                badgeHost.heightAnchor.constraint(equalToConstant: 22),
322
-                sparkle.leadingAnchor.constraint(equalTo: badgeHost.leadingAnchor, constant: 14),
323
-                sparkle.centerYAnchor.constraint(equalTo: badgeHost.centerYAnchor),
324
-                badge.leadingAnchor.constraint(equalTo: sparkle.trailingAnchor, constant: 6),
325
-                badge.centerYAnchor.constraint(equalTo: badgeHost.centerYAnchor)
326
-            ])
327
-        }
328
-
329
         return card
297
         return card
330
     }
298
     }
331
 
299
 

+ 2 - 1
App for Indeed/Views/DashboardView.swift

@@ -183,7 +183,8 @@ final class DashboardView: NSView, NSTextFieldDelegate {
183
         chromeContainer.translatesAutoresizingMaskIntoConstraints = false
183
         chromeContainer.translatesAutoresizingMaskIntoConstraints = false
184
         chromeContainer.wantsLayer = true
184
         chromeContainer.wantsLayer = true
185
         chromeContainer.layer?.backgroundColor = Theme.chromeBackground.cgColor
185
         chromeContainer.layer?.backgroundColor = Theme.chromeBackground.cgColor
186
-        chromeContainer.layer?.cornerRadius = 0
186
+        chromeContainer.layer?.cornerRadius = 18
187
+        chromeContainer.layer?.masksToBounds = true
187
         addSubview(chromeContainer)
188
         addSubview(chromeContainer)
188
         chromeContainer.addSubview(contentStack)
189
         chromeContainer.addSubview(contentStack)
189
 
190