Parcourir la Source

Update dashboard theme to a black-tone palette.

Co-authored-by: Cursor <cursoragent@cursor.com>
AhtashamShahzad1 il y a 3 semaines
Parent
commit
fc76ae72f9
1 fichiers modifiés avec 46 ajouts et 28 suppressions
  1. 46 28
      App for Indeed/Views/DashboardView.swift

+ 46 - 28
App for Indeed/Views/DashboardView.swift

@@ -6,6 +6,24 @@
6
 import Cocoa
6
 import Cocoa
7
 
7
 
8
 final class DashboardView: NSView {
8
 final class DashboardView: NSView {
9
+    private enum Theme {
10
+        static let pageBackground = NSColor(calibratedRed: 0.02, green: 0.02, blue: 0.03, alpha: 1)
11
+        static let chromeBackground = NSColor(calibratedRed: 0.05, green: 0.05, blue: 0.06, alpha: 1)
12
+        static let sidebarBackground = NSColor(calibratedRed: 0.07, green: 0.07, blue: 0.09, alpha: 1)
13
+        static let heroBackground = NSColor(calibratedRed: 0.09, green: 0.09, blue: 0.12, alpha: 1)
14
+        static let sectionBackground = NSColor(calibratedRed: 0.08, green: 0.08, blue: 0.1, alpha: 1)
15
+        static let statCardBackground = NSColor(calibratedRed: 0.1, green: 0.1, blue: 0.12, alpha: 1)
16
+        static let insightCardBackground = NSColor(calibratedRed: 0.09, green: 0.09, blue: 0.11, alpha: 1)
17
+        static let accent = NSColor(calibratedRed: 0.3, green: 0.48, blue: 1.0, alpha: 1)
18
+        static let accentMuted = NSColor(calibratedRed: 0.3, green: 0.48, blue: 1.0, alpha: 0.3)
19
+        static let iconBackground = NSColor(calibratedRed: 0.3, green: 0.48, blue: 1.0, alpha: 0.24)
20
+        static let primaryText = NSColor(calibratedRed: 0.95, green: 0.95, blue: 0.97, alpha: 1)
21
+        static let secondaryText = NSColor(calibratedRed: 0.73, green: 0.74, blue: 0.79, alpha: 1)
22
+        static let tertiaryText = NSColor(calibratedRed: 0.56, green: 0.57, blue: 0.62, alpha: 1)
23
+        static let bubbleText = NSColor(calibratedRed: 0.86, green: 0.89, blue: 0.98, alpha: 1)
24
+        static let bubbleBackground = NSColor(calibratedRed: 0.16, green: 0.2, blue: 0.33, alpha: 0.45)
25
+    }
26
+
9
     private let contentStack = NSStackView()
27
     private let contentStack = NSStackView()
10
     private let documentContainer = NSView()
28
     private let documentContainer = NSView()
11
     private let chromeContainer = NSView()
29
     private let chromeContainer = NSView()
@@ -47,7 +65,7 @@ final class DashboardView: NSView {
47
 
65
 
48
     private func setupLayout() {
66
     private func setupLayout() {
49
         wantsLayer = true
67
         wantsLayer = true
50
-        layer?.backgroundColor = NSColor(calibratedRed: 0.03, green: 0.06, blue: 0.14, alpha: 1).cgColor
68
+        layer?.backgroundColor = Theme.pageBackground.cgColor
51
 
69
 
52
         scrollView.translatesAutoresizingMaskIntoConstraints = false
70
         scrollView.translatesAutoresizingMaskIntoConstraints = false
53
         scrollView.hasVerticalScroller = true
71
         scrollView.hasVerticalScroller = true
@@ -65,7 +83,7 @@ final class DashboardView: NSView {
65
         documentContainer.frame = NSRect(x: 0, y: 0, width: 1040, height: 900)
83
         documentContainer.frame = NSRect(x: 0, y: 0, width: 1040, height: 900)
66
         chromeContainer.translatesAutoresizingMaskIntoConstraints = false
84
         chromeContainer.translatesAutoresizingMaskIntoConstraints = false
67
         chromeContainer.wantsLayer = true
85
         chromeContainer.wantsLayer = true
68
-        chromeContainer.layer?.backgroundColor = NSColor(calibratedRed: 0.03, green: 0.08, blue: 0.2, alpha: 1).cgColor
86
+        chromeContainer.layer?.backgroundColor = Theme.chromeBackground.cgColor
69
         chromeContainer.layer?.cornerRadius = 18
87
         chromeContainer.layer?.cornerRadius = 18
70
         documentContainer.addSubview(chromeContainer)
88
         documentContainer.addSubview(chromeContainer)
71
         chromeContainer.addSubview(contentStack)
89
         chromeContainer.addSubview(contentStack)
@@ -75,7 +93,7 @@ final class DashboardView: NSView {
75
         sidebar.spacing = 10
93
         sidebar.spacing = 10
76
         sidebar.alignment = .leading
94
         sidebar.alignment = .leading
77
         sidebar.wantsLayer = true
95
         sidebar.wantsLayer = true
78
-        sidebar.layer?.backgroundColor = NSColor(calibratedRed: 0.06, green: 0.09, blue: 0.2, alpha: 1).cgColor
96
+        sidebar.layer?.backgroundColor = Theme.sidebarBackground.cgColor
79
         sidebar.layer?.cornerRadius = 16
97
         sidebar.layer?.cornerRadius = 16
80
         sidebar.edgeInsets = NSEdgeInsets(top: 18, left: 14, bottom: 18, right: 14)
98
         sidebar.edgeInsets = NSEdgeInsets(top: 18, left: 14, bottom: 18, right: 14)
81
         sidebar.translatesAutoresizingMaskIntoConstraints = false
99
         sidebar.translatesAutoresizingMaskIntoConstraints = false
@@ -86,12 +104,12 @@ final class DashboardView: NSView {
86
         mainColumn.translatesAutoresizingMaskIntoConstraints = false
104
         mainColumn.translatesAutoresizingMaskIntoConstraints = false
87
 
105
 
88
         greetingLabel.font = .systemFont(ofSize: 30, weight: .bold)
106
         greetingLabel.font = .systemFont(ofSize: 30, weight: .bold)
89
-        greetingLabel.textColor = .white
107
+        greetingLabel.textColor = Theme.primaryText
90
         subtitleLabel.font = .systemFont(ofSize: 14, weight: .regular)
108
         subtitleLabel.font = .systemFont(ofSize: 14, weight: .regular)
91
-        subtitleLabel.textColor = NSColor.white.withAlphaComponent(0.75)
109
+        subtitleLabel.textColor = Theme.secondaryText
92
 
110
 
93
         heroCard.wantsLayer = true
111
         heroCard.wantsLayer = true
94
-        heroCard.layer?.backgroundColor = NSColor(calibratedRed: 0.08, green: 0.11, blue: 0.28, alpha: 1).cgColor
112
+        heroCard.layer?.backgroundColor = Theme.heroBackground.cgColor
95
         heroCard.layer?.cornerRadius = 18
113
         heroCard.layer?.cornerRadius = 18
96
         heroCard.translatesAutoresizingMaskIntoConstraints = false
114
         heroCard.translatesAutoresizingMaskIntoConstraints = false
97
         let hero = buildHeroContent()
115
         let hero = buildHeroContent()
@@ -174,16 +192,16 @@ final class DashboardView: NSView {
174
 
192
 
175
         let title = NSTextField(labelWithString: "AI Job Search Assistant")
193
         let title = NSTextField(labelWithString: "AI Job Search Assistant")
176
         title.font = .systemFont(ofSize: 24, weight: .semibold)
194
         title.font = .systemFont(ofSize: 24, weight: .semibold)
177
-        title.textColor = .white
195
+        title.textColor = Theme.primaryText
178
 
196
 
179
         let body = NSTextField(labelWithString: "Let AI find the best jobs for you on Indeed based on your preferences.")
197
         let body = NSTextField(labelWithString: "Let AI find the best jobs for you on Indeed based on your preferences.")
180
         body.font = .systemFont(ofSize: 12, weight: .regular)
198
         body.font = .systemFont(ofSize: 12, weight: .regular)
181
-        body.textColor = NSColor.white.withAlphaComponent(0.72)
199
+        body.textColor = Theme.secondaryText
182
 
200
 
183
         let action = NSButton(title: "Find Jobs with AI", target: nil, action: nil)
201
         let action = NSButton(title: "Find Jobs with AI", target: nil, action: nil)
184
         action.bezelStyle = .rounded
202
         action.bezelStyle = .rounded
185
         action.wantsLayer = true
203
         action.wantsLayer = true
186
-        action.layer?.backgroundColor = NSColor(calibratedRed: 0.27, green: 0.42, blue: 1.0, alpha: 1).cgColor
204
+        action.layer?.backgroundColor = Theme.accent.cgColor
187
         action.layer?.cornerRadius = 8
205
         action.layer?.cornerRadius = 8
188
         action.contentTintColor = .white
206
         action.contentTintColor = .white
189
         action.font = .systemFont(ofSize: 13, weight: .semibold)
207
         action.font = .systemFont(ofSize: 13, weight: .semibold)
@@ -212,7 +230,7 @@ final class DashboardView: NSView {
212
 
230
 
213
         let brand = NSTextField(labelWithString: "Indeed AI\nJob Finder")
231
         let brand = NSTextField(labelWithString: "Indeed AI\nJob Finder")
214
         brand.font = .systemFont(ofSize: 18, weight: .bold)
232
         brand.font = .systemFont(ofSize: 18, weight: .bold)
215
-        brand.textColor = .white
233
+        brand.textColor = Theme.primaryText
216
         sidebar.addArrangedSubview(brand)
234
         sidebar.addArrangedSubview(brand)
217
 
235
 
218
         let spacer = NSView()
236
         let spacer = NSView()
@@ -229,17 +247,17 @@ final class DashboardView: NSView {
229
             row.layer?.cornerRadius = 8
247
             row.layer?.cornerRadius = 8
230
             row.edgeInsets = NSEdgeInsets(top: 8, left: 10, bottom: 8, right: 10)
248
             row.edgeInsets = NSEdgeInsets(top: 8, left: 10, bottom: 8, right: 10)
231
             if index == 0 {
249
             if index == 0 {
232
-                row.layer?.backgroundColor = NSColor(calibratedRed: 0.22, green: 0.31, blue: 0.85, alpha: 0.4).cgColor
250
+                row.layer?.backgroundColor = Theme.accentMuted.cgColor
233
             }
251
             }
234
 
252
 
235
             let icon = NSImageView()
253
             let icon = NSImageView()
236
             icon.symbolConfiguration = NSImage.SymbolConfiguration(pointSize: 13, weight: .medium)
254
             icon.symbolConfiguration = NSImage.SymbolConfiguration(pointSize: 13, weight: .medium)
237
             icon.image = NSImage(systemSymbolName: item.systemImage, accessibilityDescription: item.title)
255
             icon.image = NSImage(systemSymbolName: item.systemImage, accessibilityDescription: item.title)
238
-            icon.contentTintColor = .white
256
+            icon.contentTintColor = Theme.primaryText
239
 
257
 
240
             let text = NSTextField(labelWithString: item.title)
258
             let text = NSTextField(labelWithString: item.title)
241
             text.font = .systemFont(ofSize: 14, weight: .medium)
259
             text.font = .systemFont(ofSize: 14, weight: .medium)
242
-            text.textColor = .white
260
+            text.textColor = Theme.primaryText
243
 
261
 
244
             row.addArrangedSubview(icon)
262
             row.addArrangedSubview(icon)
245
             row.addArrangedSubview(text)
263
             row.addArrangedSubview(text)
@@ -249,7 +267,7 @@ final class DashboardView: NSView {
249
                 badgeField.font = .systemFont(ofSize: 11, weight: .semibold)
267
                 badgeField.font = .systemFont(ofSize: 11, weight: .semibold)
250
                 badgeField.textColor = .white
268
                 badgeField.textColor = .white
251
                 badgeField.wantsLayer = true
269
                 badgeField.wantsLayer = true
252
-                badgeField.layer?.backgroundColor = NSColor.systemPurple.cgColor
270
+                badgeField.layer?.backgroundColor = Theme.accent.cgColor
253
                 badgeField.layer?.cornerRadius = 8
271
                 badgeField.layer?.cornerRadius = 8
254
                 badgeField.alignment = .center
272
                 badgeField.alignment = .center
255
                 badgeField.maximumNumberOfLines = 1
273
                 badgeField.maximumNumberOfLines = 1
@@ -271,16 +289,16 @@ final class DashboardView: NSView {
271
             card.spacing = 6
289
             card.spacing = 6
272
             card.edgeInsets = NSEdgeInsets(top: 14, left: 14, bottom: 14, right: 14)
290
             card.edgeInsets = NSEdgeInsets(top: 14, left: 14, bottom: 14, right: 14)
273
             card.wantsLayer = true
291
             card.wantsLayer = true
274
-            card.layer?.backgroundColor = NSColor(calibratedRed: 0.06, green: 0.11, blue: 0.24, alpha: 1).cgColor
292
+            card.layer?.backgroundColor = Theme.statCardBackground.cgColor
275
             card.layer?.cornerRadius = 14
293
             card.layer?.cornerRadius = 14
276
 
294
 
277
             let value = NSTextField(labelWithString: stat.value)
295
             let value = NSTextField(labelWithString: stat.value)
278
             value.font = .systemFont(ofSize: 30, weight: .bold)
296
             value.font = .systemFont(ofSize: 30, weight: .bold)
279
-            value.textColor = .white
297
+            value.textColor = Theme.primaryText
280
 
298
 
281
             let title = NSTextField(labelWithString: stat.title)
299
             let title = NSTextField(labelWithString: stat.title)
282
             title.font = .systemFont(ofSize: 13, weight: .medium)
300
             title.font = .systemFont(ofSize: 13, weight: .medium)
283
-            title.textColor = NSColor.white.withAlphaComponent(0.74)
301
+            title.textColor = Theme.secondaryText
284
 
302
 
285
             let trend = NSTextField(labelWithString: stat.trend)
303
             let trend = NSTextField(labelWithString: stat.trend)
286
             trend.font = .systemFont(ofSize: 12, weight: .semibold)
304
             trend.font = .systemFont(ofSize: 12, weight: .semibold)
@@ -315,7 +333,7 @@ final class DashboardView: NSView {
315
             let icon = NSView()
333
             let icon = NSView()
316
             icon.wantsLayer = true
334
             icon.wantsLayer = true
317
             icon.layer?.cornerRadius = 10
335
             icon.layer?.cornerRadius = 10
318
-            icon.layer?.backgroundColor = NSColor(calibratedRed: 0.19, green: 0.34, blue: 0.9, alpha: 0.9).cgColor
336
+            icon.layer?.backgroundColor = Theme.iconBackground.cgColor
319
             icon.translatesAutoresizingMaskIntoConstraints = false
337
             icon.translatesAutoresizingMaskIntoConstraints = false
320
             icon.widthAnchor.constraint(equalToConstant: 38).isActive = true
338
             icon.widthAnchor.constraint(equalToConstant: 38).isActive = true
321
             icon.heightAnchor.constraint(equalToConstant: 38).isActive = true
339
             icon.heightAnchor.constraint(equalToConstant: 38).isActive = true
@@ -327,11 +345,11 @@ final class DashboardView: NSView {
327
 
345
 
328
             let title = NSTextField(labelWithString: recommendation.title)
346
             let title = NSTextField(labelWithString: recommendation.title)
329
             title.font = .systemFont(ofSize: 15, weight: .semibold)
347
             title.font = .systemFont(ofSize: 15, weight: .semibold)
330
-            title.textColor = .white
348
+            title.textColor = Theme.primaryText
331
 
349
 
332
             let subtitle = NSTextField(labelWithString: "\(recommendation.company) • \(recommendation.location)")
350
             let subtitle = NSTextField(labelWithString: "\(recommendation.company) • \(recommendation.location)")
333
             subtitle.font = .systemFont(ofSize: 12, weight: .regular)
351
             subtitle.font = .systemFont(ofSize: 12, weight: .regular)
334
-            subtitle.textColor = NSColor.white.withAlphaComponent(0.7)
352
+            subtitle.textColor = Theme.secondaryText
335
 
353
 
336
             textColumn.addArrangedSubview(title)
354
             textColumn.addArrangedSubview(title)
337
             textColumn.addArrangedSubview(subtitle)
355
             textColumn.addArrangedSubview(subtitle)
@@ -346,7 +364,7 @@ final class DashboardView: NSView {
346
 
364
 
347
             let posted = NSTextField(labelWithString: recommendation.postedAgo)
365
             let posted = NSTextField(labelWithString: recommendation.postedAgo)
348
             posted.font = .systemFont(ofSize: 11, weight: .regular)
366
             posted.font = .systemFont(ofSize: 11, weight: .regular)
349
-            posted.textColor = NSColor.white.withAlphaComponent(0.6)
367
+            posted.textColor = Theme.tertiaryText
350
 
368
 
351
             meta.addArrangedSubview(match)
369
             meta.addArrangedSubview(match)
352
             meta.addArrangedSubview(posted)
370
             meta.addArrangedSubview(posted)
@@ -375,16 +393,16 @@ final class DashboardView: NSView {
375
             card.spacing = 4
393
             card.spacing = 4
376
             card.edgeInsets = NSEdgeInsets(top: 10, left: 10, bottom: 10, right: 10)
394
             card.edgeInsets = NSEdgeInsets(top: 10, left: 10, bottom: 10, right: 10)
377
             card.wantsLayer = true
395
             card.wantsLayer = true
378
-            card.layer?.backgroundColor = NSColor(calibratedRed: 0.07, green: 0.12, blue: 0.22, alpha: 1).cgColor
396
+            card.layer?.backgroundColor = Theme.insightCardBackground.cgColor
379
             card.layer?.cornerRadius = 10
397
             card.layer?.cornerRadius = 10
380
 
398
 
381
             let title = NSTextField(labelWithString: insight.title)
399
             let title = NSTextField(labelWithString: insight.title)
382
             title.font = .systemFont(ofSize: 14, weight: .semibold)
400
             title.font = .systemFont(ofSize: 14, weight: .semibold)
383
-            title.textColor = .white
401
+            title.textColor = Theme.primaryText
384
 
402
 
385
             let body = NSTextField(labelWithString: insight.description)
403
             let body = NSTextField(labelWithString: insight.description)
386
             body.font = .systemFont(ofSize: 12, weight: .regular)
404
             body.font = .systemFont(ofSize: 12, weight: .regular)
387
-            body.textColor = NSColor.white.withAlphaComponent(0.7)
405
+            body.textColor = Theme.secondaryText
388
             body.maximumNumberOfLines = 2
406
             body.maximumNumberOfLines = 2
389
             body.lineBreakMode = .byWordWrapping
407
             body.lineBreakMode = .byWordWrapping
390
 
408
 
@@ -401,12 +419,12 @@ final class DashboardView: NSView {
401
         box.alignment = .leading
419
         box.alignment = .leading
402
         box.edgeInsets = NSEdgeInsets(top: 14, left: 14, bottom: 14, right: 14)
420
         box.edgeInsets = NSEdgeInsets(top: 14, left: 14, bottom: 14, right: 14)
403
         box.wantsLayer = true
421
         box.wantsLayer = true
404
-        box.layer?.backgroundColor = NSColor(calibratedRed: 0.05, green: 0.09, blue: 0.19, alpha: 1).cgColor
422
+        box.layer?.backgroundColor = Theme.sectionBackground.cgColor
405
         box.layer?.cornerRadius = 16
423
         box.layer?.cornerRadius = 16
406
 
424
 
407
         let titleLabel = NSTextField(labelWithString: title)
425
         let titleLabel = NSTextField(labelWithString: title)
408
         titleLabel.font = .systemFont(ofSize: 18, weight: .semibold)
426
         titleLabel.font = .systemFont(ofSize: 18, weight: .semibold)
409
-        titleLabel.textColor = .white
427
+        titleLabel.textColor = Theme.primaryText
410
         box.addArrangedSubview(titleLabel)
428
         box.addArrangedSubview(titleLabel)
411
         box.addArrangedSubview(content)
429
         box.addArrangedSubview(content)
412
         return box
430
         return box
@@ -415,9 +433,9 @@ final class DashboardView: NSView {
415
     private func tagBubble(_ text: String) -> NSView {
433
     private func tagBubble(_ text: String) -> NSView {
416
         let label = NSTextField(labelWithString: text)
434
         let label = NSTextField(labelWithString: text)
417
         label.font = .systemFont(ofSize: 11, weight: .medium)
435
         label.font = .systemFont(ofSize: 11, weight: .medium)
418
-        label.textColor = NSColor(calibratedRed: 0.75, green: 0.79, blue: 1, alpha: 1)
436
+        label.textColor = Theme.bubbleText
419
         label.wantsLayer = true
437
         label.wantsLayer = true
420
-        label.layer?.backgroundColor = NSColor(calibratedRed: 0.2, green: 0.24, blue: 0.45, alpha: 0.5).cgColor
438
+        label.layer?.backgroundColor = Theme.bubbleBackground.cgColor
421
         label.layer?.cornerRadius = 7
439
         label.layer?.cornerRadius = 7
422
         label.alignment = .center
440
         label.alignment = .center
423
         label.translatesAutoresizingMaskIntoConstraints = false
441
         label.translatesAutoresizingMaskIntoConstraints = false