|
@@ -28,6 +28,9 @@ class ViewController: NSViewController {
|
|
28
|
private let titleBarControlBackground = NSColor.white.withAlphaComponent(0.04)
|
28
|
private let titleBarControlBackground = NSColor.white.withAlphaComponent(0.04)
|
|
29
|
private let titleBarLightControlBackground = NSColor.white.withAlphaComponent(0.02)
|
29
|
private let titleBarLightControlBackground = NSColor.white.withAlphaComponent(0.02)
|
|
30
|
private let appShellCornerRadius: CGFloat = 20
|
30
|
private let appShellCornerRadius: CGFloat = 20
|
|
|
|
31
|
+ private let homeChromeHeaderHeight: CGFloat = 56
|
|
|
|
32
|
+ private let nativeTrafficLightsLeading: CGFloat = 14
|
|
|
|
33
|
+ private let nativeTrafficLightsTopInset: CGFloat = 20
|
|
31
|
private let accentBlue = NSColor(calibratedRed: 27 / 255, green: 115 / 255, blue: 232 / 255, alpha: 1)
|
34
|
private let accentBlue = NSColor(calibratedRed: 27 / 255, green: 115 / 255, blue: 232 / 255, alpha: 1)
|
|
32
|
private let accentOrange = NSColor(calibratedRed: 1.0, green: 0.60, blue: 0.20, alpha: 1)
|
35
|
private let accentOrange = NSColor(calibratedRed: 1.0, green: 0.60, blue: 0.20, alpha: 1)
|
|
33
|
private let primaryText = NSColor(calibratedWhite: 0.98, alpha: 1)
|
36
|
private let primaryText = NSColor(calibratedWhite: 0.98, alpha: 1)
|
|
@@ -77,6 +80,7 @@ class ViewController: NSViewController {
|
|
77
|
window.isMovableByWindowBackground = true
|
80
|
window.isMovableByWindowBackground = true
|
|
78
|
window.styleMask.insert(.fullSizeContentView)
|
81
|
window.styleMask.insert(.fullSizeContentView)
|
|
79
|
}
|
82
|
}
|
|
|
|
83
|
+ alignNativeTrafficLights()
|
|
80
|
if isUserLoggedIn() {
|
84
|
if isUserLoggedIn() {
|
|
81
|
showHomeView(profile: nil)
|
85
|
showHomeView(profile: nil)
|
|
82
|
} else {
|
86
|
} else {
|
|
@@ -84,6 +88,11 @@ class ViewController: NSViewController {
|
|
84
|
}
|
88
|
}
|
|
85
|
}
|
89
|
}
|
|
86
|
|
90
|
|
|
|
|
91
|
+ override func viewDidLayout() {
|
|
|
|
92
|
+ super.viewDidLayout()
|
|
|
|
93
|
+ alignNativeTrafficLights()
|
|
|
|
94
|
+ }
|
|
|
|
95
|
+
|
|
87
|
private func setupUI() {
|
96
|
private func setupUI() {
|
|
88
|
view.wantsLayer = true
|
97
|
view.wantsLayer = true
|
|
89
|
view.layer?.backgroundColor = appBackground.cgColor
|
98
|
view.layer?.backgroundColor = appBackground.cgColor
|
|
@@ -697,7 +706,7 @@ class ViewController: NSViewController {
|
|
697
|
chromeHeader.topAnchor.constraint(equalTo: chromeColumn.topAnchor),
|
706
|
chromeHeader.topAnchor.constraint(equalTo: chromeColumn.topAnchor),
|
|
698
|
chromeHeader.leadingAnchor.constraint(equalTo: chromeColumn.leadingAnchor),
|
707
|
chromeHeader.leadingAnchor.constraint(equalTo: chromeColumn.leadingAnchor),
|
|
699
|
chromeHeader.trailingAnchor.constraint(equalTo: chromeColumn.trailingAnchor),
|
708
|
chromeHeader.trailingAnchor.constraint(equalTo: chromeColumn.trailingAnchor),
|
|
700
|
- chromeHeader.heightAnchor.constraint(equalToConstant: 56),
|
|
|
|
|
|
709
|
+ chromeHeader.heightAnchor.constraint(equalToConstant: homeChromeHeaderHeight),
|
|
701
|
sidebar.leadingAnchor.constraint(equalTo: chromeColumn.leadingAnchor),
|
710
|
sidebar.leadingAnchor.constraint(equalTo: chromeColumn.leadingAnchor),
|
|
702
|
sidebar.trailingAnchor.constraint(equalTo: chromeColumn.trailingAnchor),
|
711
|
sidebar.trailingAnchor.constraint(equalTo: chromeColumn.trailingAnchor),
|
|
703
|
sidebar.topAnchor.constraint(equalTo: chromeHeader.bottomAnchor, constant: 2),
|
712
|
sidebar.topAnchor.constraint(equalTo: chromeHeader.bottomAnchor, constant: 2),
|
|
@@ -848,8 +857,8 @@ class ViewController: NSViewController {
|
|
848
|
meetingsDocument.addSubview(meetingsStack)
|
857
|
meetingsDocument.addSubview(meetingsStack)
|
|
849
|
|
858
|
|
|
850
|
NSLayoutConstraint.activate([
|
859
|
NSLayoutConstraint.activate([
|
|
851
|
- brandStack.leadingAnchor.constraint(equalTo: chromeHeader.leadingAnchor, constant: 60),
|
|
|
|
852
|
- brandStack.centerYAnchor.constraint(equalTo: chromeHeader.centerYAnchor),
|
|
|
|
|
|
860
|
+ brandStack.leadingAnchor.constraint(equalTo: chromeHeader.leadingAnchor, constant: 72),
|
|
|
|
861
|
+ brandStack.centerYAnchor.constraint(equalTo: chromeHeader.centerYAnchor, constant: -1),
|
|
853
|
|
862
|
|
|
854
|
topBar.topAnchor.constraint(equalTo: content.topAnchor),
|
863
|
topBar.topAnchor.constraint(equalTo: content.topAnchor),
|
|
855
|
topBar.leadingAnchor.constraint(equalTo: content.leadingAnchor),
|
864
|
topBar.leadingAnchor.constraint(equalTo: content.leadingAnchor),
|
|
@@ -1039,6 +1048,26 @@ class ViewController: NSViewController {
|
|
1039
|
return sidebar
|
1048
|
return sidebar
|
|
1040
|
}
|
1049
|
}
|
|
1041
|
|
1050
|
|
|
|
|
1051
|
+ @MainActor
|
|
|
|
1052
|
+ private func alignNativeTrafficLights() {
|
|
|
|
1053
|
+ guard let window = view.window else { return }
|
|
|
|
1054
|
+ guard let closeButton = window.standardWindowButton(.closeButton),
|
|
|
|
1055
|
+ let miniButton = window.standardWindowButton(.miniaturizeButton),
|
|
|
|
1056
|
+ let zoomButton = window.standardWindowButton(.zoomButton) else { return }
|
|
|
|
1057
|
+ guard let buttonContainer = closeButton.superview else { return }
|
|
|
|
1058
|
+
|
|
|
|
1059
|
+ let buttons = [closeButton, miniButton, zoomButton]
|
|
|
|
1060
|
+ // Compute from top inset so moving "down" is stable in titlebar coordinates.
|
|
|
|
1061
|
+ let containerHeight = buttonContainer.bounds.height
|
|
|
|
1062
|
+ let targetY = max(0, containerHeight - closeButton.frame.height - nativeTrafficLightsTopInset)
|
|
|
|
1063
|
+ var nextX = nativeTrafficLightsLeading
|
|
|
|
1064
|
+
|
|
|
|
1065
|
+ for button in buttons {
|
|
|
|
1066
|
+ button.setFrameOrigin(NSPoint(x: nextX, y: targetY))
|
|
|
|
1067
|
+ nextX += button.frame.width + 8
|
|
|
|
1068
|
+ }
|
|
|
|
1069
|
+ }
|
|
|
|
1070
|
+
|
|
1042
|
private func makeTopBarIconButton(symbol: String, action: Selector?) -> NSButton {
|
1071
|
private func makeTopBarIconButton(symbol: String, action: Selector?) -> NSButton {
|
|
1043
|
let button = NSButton(title: "", target: action == nil ? nil : self, action: action)
|
1072
|
let button = NSButton(title: "", target: action == nil ? nil : self, action: action)
|
|
1044
|
button.isBordered = false
|
1073
|
button.isBordered = false
|