|
|
@@ -4,13 +4,13 @@
|
|
4
|
4
|
//
|
|
5
|
5
|
|
|
6
|
6
|
import Cocoa
|
|
7
|
|
-import QuartzCore
|
|
8
|
7
|
|
|
9
|
8
|
final class DashboardView: NSView {
|
|
10
|
9
|
private enum Theme {
|
|
11
|
10
|
static let pageBackground = NSColor(calibratedWhite: 0.02, alpha: 1)
|
|
12
|
11
|
static let chromeBackground = NSColor(calibratedWhite: 0.04, alpha: 1)
|
|
13
|
12
|
static let sidebarBackground = NSColor(calibratedWhite: 0.07, alpha: 1)
|
|
|
13
|
+ static let mainHostBackground = NSColor(calibratedWhite: 0.06, alpha: 1)
|
|
14
|
14
|
static let selectionFill = NSColor(calibratedWhite: 1, alpha: 0.1)
|
|
15
|
15
|
static let cardBackground = NSColor(calibratedWhite: 0.11, alpha: 1)
|
|
16
|
16
|
static let toggleBackground = NSColor(calibratedWhite: 0.16, alpha: 1)
|
|
|
@@ -25,7 +25,6 @@ final class DashboardView: NSView {
|
|
25
|
25
|
private let chromeContainer = NSView()
|
|
26
|
26
|
private let sidebar = NSStackView()
|
|
27
|
27
|
private let mainHost = NSView()
|
|
28
|
|
- private let mainGradient = NeutralGradientBackgroundView()
|
|
29
|
28
|
private let mainOverlay = NSStackView()
|
|
30
|
29
|
private let greetingLabel = NSTextField(labelWithString: "")
|
|
31
|
30
|
private let subtitleLabel = NSTextField(labelWithString: "")
|
|
|
@@ -101,13 +100,11 @@ final class DashboardView: NSView {
|
|
101
|
100
|
sidebar.translatesAutoresizingMaskIntoConstraints = false
|
|
102
|
101
|
|
|
103
|
102
|
mainHost.translatesAutoresizingMaskIntoConstraints = false
|
|
|
103
|
+ mainHost.wantsLayer = true
|
|
|
104
|
+ mainHost.layer?.backgroundColor = Theme.mainHostBackground.cgColor
|
|
|
105
|
+ mainHost.layer?.cornerRadius = 16
|
|
|
106
|
+ mainHost.layer?.masksToBounds = true
|
|
104
|
107
|
|
|
105
|
|
- mainGradient.translatesAutoresizingMaskIntoConstraints = false
|
|
106
|
|
- mainGradient.wantsLayer = true
|
|
107
|
|
- mainGradient.layer?.cornerRadius = 16
|
|
108
|
|
- mainGradient.layer?.masksToBounds = true
|
|
109
|
|
-
|
|
110
|
|
- mainHost.addSubview(mainGradient)
|
|
111
|
108
|
mainHost.addSubview(mainOverlay)
|
|
112
|
109
|
|
|
113
|
110
|
mainOverlay.orientation = .vertical
|
|
|
@@ -180,11 +177,6 @@ final class DashboardView: NSView {
|
|
180
|
177
|
sidebar.widthAnchor.constraint(equalToConstant: 225),
|
|
181
|
178
|
mainHost.widthAnchor.constraint(greaterThanOrEqualToConstant: 720),
|
|
182
|
179
|
|
|
183
|
|
- mainGradient.leadingAnchor.constraint(equalTo: mainHost.leadingAnchor),
|
|
184
|
|
- mainGradient.trailingAnchor.constraint(equalTo: mainHost.trailingAnchor),
|
|
185
|
|
- mainGradient.topAnchor.constraint(equalTo: mainHost.topAnchor),
|
|
186
|
|
- mainGradient.bottomAnchor.constraint(equalTo: mainHost.bottomAnchor),
|
|
187
|
|
-
|
|
188
|
180
|
mainOverlay.leadingAnchor.constraint(equalTo: mainHost.leadingAnchor),
|
|
189
|
181
|
mainOverlay.trailingAnchor.constraint(equalTo: mainHost.trailingAnchor),
|
|
190
|
182
|
mainOverlay.topAnchor.constraint(equalTo: mainHost.topAnchor),
|
|
|
@@ -345,37 +337,3 @@ final class DashboardView: NSView {
|
|
345
|
337
|
documentContainer.frame = NSRect(x: 0, y: 0, width: bounds.width, height: fittingHeight)
|
|
346
|
338
|
}
|
|
347
|
339
|
}
|
|
348
|
|
-
|
|
349
|
|
-// MARK: - Neutral main-area gradient (black / grey only)
|
|
350
|
|
-
|
|
351
|
|
-private final class NeutralGradientBackgroundView: NSView {
|
|
352
|
|
- private let gradientLayer = CAGradientLayer()
|
|
353
|
|
-
|
|
354
|
|
- override init(frame frameRect: NSRect) {
|
|
355
|
|
- super.init(frame: frameRect)
|
|
356
|
|
- commonInit()
|
|
357
|
|
- }
|
|
358
|
|
-
|
|
359
|
|
- required init?(coder: NSCoder) {
|
|
360
|
|
- super.init(coder: coder)
|
|
361
|
|
- commonInit()
|
|
362
|
|
- }
|
|
363
|
|
-
|
|
364
|
|
- private func commonInit() {
|
|
365
|
|
- wantsLayer = true
|
|
366
|
|
- gradientLayer.colors = [
|
|
367
|
|
- NSColor(calibratedWhite: 0.12, alpha: 1).cgColor,
|
|
368
|
|
- NSColor(calibratedWhite: 0.05, alpha: 1).cgColor,
|
|
369
|
|
- NSColor.black.cgColor
|
|
370
|
|
- ]
|
|
371
|
|
- gradientLayer.locations = [0, 0.42, 1] as [NSNumber]
|
|
372
|
|
- gradientLayer.startPoint = CGPoint(x: 0.5, y: 1)
|
|
373
|
|
- gradientLayer.endPoint = CGPoint(x: 0.5, y: 0)
|
|
374
|
|
- layer?.addSublayer(gradientLayer)
|
|
375
|
|
- }
|
|
376
|
|
-
|
|
377
|
|
- override func layout() {
|
|
378
|
|
- super.layout()
|
|
379
|
|
- gradientLayer.frame = bounds
|
|
380
|
|
- }
|
|
381
|
|
-}
|