Просмотр исходного кода

Update dashboard theme to a black-tone palette.

Co-authored-by: Cursor <cursoragent@cursor.com>
AhtashamShahzad1 недель назад: 3
Родитель
Сommit
fc76ae72f9
1 измененных файлов с 46 добавлено и 28 удалено
  1. 46 28
      App for Indeed/Views/DashboardView.swift

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

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