|
|
@@ -6,10 +6,21 @@ final class PremiumPlansWindowController: NSWindowController {
|
|
6
|
6
|
let window = NSWindow(contentViewController: viewController)
|
|
7
|
7
|
window.title = "Premium Plans"
|
|
8
|
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
|
14
|
window.setContentSize(NSSize(width: 1160, height: 760))
|
|
10
|
15
|
window.minSize = NSSize(width: 980, height: 680)
|
|
11
|
16
|
window.center()
|
|
12
|
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
|
26
|
@available(*, unavailable)
|
|
|
@@ -77,7 +88,7 @@ private final class PremiumPlansViewController: NSViewController {
|
|
77
|
88
|
subtitle: "Balanced for regular productivity",
|
|
78
|
89
|
price: "$19.99",
|
|
79
|
90
|
period: "/ month",
|
|
80
|
|
- billedPill: "Most Popular",
|
|
|
91
|
+ billedPill: "",
|
|
81
|
92
|
billedLine: "",
|
|
82
|
93
|
crossedPrice: nil,
|
|
83
|
94
|
savingsText: nil,
|
|
|
@@ -112,26 +123,16 @@ private final class PremiumPlansViewController: NSViewController {
|
|
112
|
123
|
]
|
|
113
|
124
|
|
|
114
|
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
|
126
|
override func viewDidLayout() {
|
|
127
|
127
|
super.viewDidLayout()
|
|
128
|
128
|
pageGradient.frame = view.bounds
|
|
129
|
|
- popularGradient.frame = CGRect(x: 0, y: 0, width: 160, height: 22)
|
|
130
|
129
|
}
|
|
131
|
130
|
|
|
132
|
131
|
override func loadView() {
|
|
133
|
132
|
view = NSView()
|
|
134
|
133
|
view.wantsLayer = true
|
|
|
134
|
+ view.layer?.cornerRadius = 18
|
|
|
135
|
+ view.layer?.masksToBounds = true
|
|
135
|
136
|
pageGradient.colors = [Theme.pageStart.cgColor, Theme.pageEnd.cgColor]
|
|
136
|
137
|
pageGradient.startPoint = CGPoint(x: 0, y: 1)
|
|
137
|
138
|
pageGradient.endPoint = CGPoint(x: 1, y: 0)
|
|
|
@@ -293,39 +294,6 @@ private final class PremiumPlansViewController: NSViewController {
|
|
293
|
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
|
297
|
return card
|
|
330
|
298
|
}
|
|
331
|
299
|
|