|
|
@@ -96,6 +96,7 @@ final class ViewController: NSViewController {
|
|
96
|
96
|
var newFrame = window.frame
|
|
97
|
97
|
newFrame.size = frameSize
|
|
98
|
98
|
window.setFrame(newFrame, display: true)
|
|
|
99
|
+ window.center()
|
|
99
|
100
|
|
|
100
|
101
|
window.minSize = window.frameRect(forContentRect: NSRect(origin: .zero, size: self.launchMinContentSize)).size
|
|
101
|
102
|
self.installCenteredTitleIfNeeded(on: window)
|
|
|
@@ -156,6 +157,10 @@ private extension ViewController {
|
|
156
|
157
|
updateTabAppearance()
|
|
157
|
158
|
}
|
|
158
|
159
|
|
|
|
160
|
+ @objc private func premiumButtonClicked(_ sender: NSClickGestureRecognizer) {
|
|
|
161
|
+ showSimpleAlert(title: "Get Premium", message: "Premium features coming soon.")
|
|
|
162
|
+ }
|
|
|
163
|
+
|
|
159
|
164
|
private func showSidebarPage(_ page: SidebarPage) {
|
|
160
|
165
|
selectedSidebarPage = page
|
|
161
|
166
|
updateSidebarAppearance()
|
|
|
@@ -374,8 +379,11 @@ private extension ViewController {
|
|
374
|
379
|
menuStack.addArrangedSubview(settingsRow)
|
|
375
|
380
|
sidebarRowViews[.settings] = settingsRow
|
|
376
|
381
|
|
|
|
382
|
+ let premiumButton = sidebarPremiumButton()
|
|
|
383
|
+
|
|
377
|
384
|
sidebar.addSubview(titleRow)
|
|
378
|
385
|
sidebar.addSubview(menuStack)
|
|
|
386
|
+ sidebar.addSubview(premiumButton)
|
|
379
|
387
|
|
|
380
|
388
|
NSLayoutConstraint.activate([
|
|
381
|
389
|
titleRow.leadingAnchor.constraint(equalTo: sidebar.leadingAnchor, constant: 16),
|
|
|
@@ -384,7 +392,12 @@ private extension ViewController {
|
|
384
|
392
|
|
|
385
|
393
|
menuStack.leadingAnchor.constraint(equalTo: sidebar.leadingAnchor, constant: 12),
|
|
386
|
394
|
menuStack.trailingAnchor.constraint(equalTo: sidebar.trailingAnchor, constant: -12),
|
|
387
|
|
- menuStack.topAnchor.constraint(equalTo: titleRow.bottomAnchor, constant: 20)
|
|
|
395
|
+ menuStack.topAnchor.constraint(equalTo: titleRow.bottomAnchor, constant: 20),
|
|
|
396
|
+ menuStack.bottomAnchor.constraint(lessThanOrEqualTo: premiumButton.topAnchor, constant: -16),
|
|
|
397
|
+
|
|
|
398
|
+ premiumButton.leadingAnchor.constraint(equalTo: sidebar.leadingAnchor, constant: 12),
|
|
|
399
|
+ premiumButton.trailingAnchor.constraint(equalTo: sidebar.trailingAnchor, constant: -12),
|
|
|
400
|
+ premiumButton.bottomAnchor.constraint(equalTo: sidebar.bottomAnchor, constant: -14)
|
|
388
|
401
|
])
|
|
389
|
402
|
|
|
390
|
403
|
for subview in menuStack.arrangedSubviews {
|
|
|
@@ -394,6 +407,40 @@ private extension ViewController {
|
|
394
|
407
|
return sidebar
|
|
395
|
408
|
}
|
|
396
|
409
|
|
|
|
410
|
+ func sidebarPremiumButton() -> NSView {
|
|
|
411
|
+ let button = HoverTrackingView()
|
|
|
412
|
+ button.translatesAutoresizingMaskIntoConstraints = false
|
|
|
413
|
+ button.wantsLayer = true
|
|
|
414
|
+ button.layer?.cornerRadius = 17
|
|
|
415
|
+ button.layer?.backgroundColor = palette.primaryBlue.cgColor
|
|
|
416
|
+ button.heightAnchor.constraint(equalToConstant: 34).isActive = true
|
|
|
417
|
+ styleSurface(button, borderColor: palette.primaryBlueBorder, borderWidth: 1, shadow: false)
|
|
|
418
|
+
|
|
|
419
|
+ let icon = textLabel("★", font: NSFont.systemFont(ofSize: 12, weight: .semibold), color: .white)
|
|
|
420
|
+ let title = textLabel("Get Premium", font: NSFont.systemFont(ofSize: 14, weight: .semibold), color: .white)
|
|
|
421
|
+ button.addSubview(icon)
|
|
|
422
|
+ button.addSubview(title)
|
|
|
423
|
+
|
|
|
424
|
+ NSLayoutConstraint.activate([
|
|
|
425
|
+ icon.leadingAnchor.constraint(equalTo: button.leadingAnchor, constant: 12),
|
|
|
426
|
+ icon.centerYAnchor.constraint(equalTo: button.centerYAnchor),
|
|
|
427
|
+ title.leadingAnchor.constraint(equalTo: icon.trailingAnchor, constant: 8),
|
|
|
428
|
+ title.centerYAnchor.constraint(equalTo: button.centerYAnchor),
|
|
|
429
|
+ title.trailingAnchor.constraint(lessThanOrEqualTo: button.trailingAnchor, constant: -12)
|
|
|
430
|
+ ])
|
|
|
431
|
+
|
|
|
432
|
+ let baseColor = palette.primaryBlue
|
|
|
433
|
+ let hoverColor = baseColor.blended(withFraction: 0.10, of: NSColor.white) ?? baseColor
|
|
|
434
|
+ button.onHoverChanged = { hovering in
|
|
|
435
|
+ button.layer?.backgroundColor = (hovering ? hoverColor : baseColor).cgColor
|
|
|
436
|
+ }
|
|
|
437
|
+ button.onHoverChanged?(false)
|
|
|
438
|
+
|
|
|
439
|
+ let click = NSClickGestureRecognizer(target: self, action: #selector(premiumButtonClicked(_:)))
|
|
|
440
|
+ button.addGestureRecognizer(click)
|
|
|
441
|
+ return button
|
|
|
442
|
+ }
|
|
|
443
|
+
|
|
397
|
444
|
func makeMainPanel() -> NSView {
|
|
398
|
445
|
let panel = NSView()
|
|
399
|
446
|
panel.translatesAutoresizingMaskIntoConstraints = false
|