Browse Source

Update dashboard theme to a black-tone palette.

Co-authored-by: Cursor <cursoragent@cursor.com>
AhtashamShahzad1 2 tháng trước cách đây
mục cha
commit
fc76ae72f9
1 tập tin đã thay đổi với 46 bổ sung28 xóa
  1. 46 28
      App for Indeed/Views/DashboardView.swift

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

@@ -6,6 +6,24 @@
 import Cocoa
 
 final class DashboardView: NSView {
+    private enum Theme {
+        static let pageBackground = NSColor(calibratedRed: 0.02, green: 0.02, blue: 0.03, alpha: 1)
+        static let chromeBackground = NSColor(calibratedRed: 0.05, green: 0.05, blue: 0.06, alpha: 1)
+        static let sidebarBackground = NSColor(calibratedRed: 0.07, green: 0.07, blue: 0.09, alpha: 1)
+        static let heroBackground = NSColor(calibratedRed: 0.09, green: 0.09, blue: 0.12, alpha: 1)
+        static let sectionBackground = NSColor(calibratedRed: 0.08, green: 0.08, blue: 0.1, alpha: 1)
+        static let statCardBackground = NSColor(calibratedRed: 0.1, green: 0.1, blue: 0.12, alpha: 1)
+        static let insightCardBackground = NSColor(calibratedRed: 0.09, green: 0.09, blue: 0.11, alpha: 1)
+        static let accent = NSColor(calibratedRed: 0.3, green: 0.48, blue: 1.0, alpha: 1)
+        static let accentMuted = NSColor(calibratedRed: 0.3, green: 0.48, blue: 1.0, alpha: 0.3)
+        static let iconBackground = NSColor(calibratedRed: 0.3, green: 0.48, blue: 1.0, alpha: 0.24)
+        static let primaryText = NSColor(calibratedRed: 0.95, green: 0.95, blue: 0.97, alpha: 1)
+        static let secondaryText = NSColor(calibratedRed: 0.73, green: 0.74, blue: 0.79, alpha: 1)
+        static let tertiaryText = NSColor(calibratedRed: 0.56, green: 0.57, blue: 0.62, alpha: 1)
+        static let bubbleText = NSColor(calibratedRed: 0.86, green: 0.89, blue: 0.98, alpha: 1)
+        static let bubbleBackground = NSColor(calibratedRed: 0.16, green: 0.2, blue: 0.33, alpha: 0.45)
+    }
+
     private let contentStack = NSStackView()
     private let documentContainer = NSView()
     private let chromeContainer = NSView()
@@ -47,7 +65,7 @@ final class DashboardView: NSView {
 
     private func setupLayout() {
         wantsLayer = true
-        layer?.backgroundColor = NSColor(calibratedRed: 0.03, green: 0.06, blue: 0.14, alpha: 1).cgColor
+        layer?.backgroundColor = Theme.pageBackground.cgColor
 
         scrollView.translatesAutoresizingMaskIntoConstraints = false
         scrollView.hasVerticalScroller = true
@@ -65,7 +83,7 @@ final class DashboardView: NSView {
         documentContainer.frame = NSRect(x: 0, y: 0, width: 1040, height: 900)
         chromeContainer.translatesAutoresizingMaskIntoConstraints = false
         chromeContainer.wantsLayer = true
-        chromeContainer.layer?.backgroundColor = NSColor(calibratedRed: 0.03, green: 0.08, blue: 0.2, alpha: 1).cgColor
+        chromeContainer.layer?.backgroundColor = Theme.chromeBackground.cgColor
         chromeContainer.layer?.cornerRadius = 18
         documentContainer.addSubview(chromeContainer)
         chromeContainer.addSubview(contentStack)
@@ -75,7 +93,7 @@ final class DashboardView: NSView {
         sidebar.spacing = 10
         sidebar.alignment = .leading
         sidebar.wantsLayer = true
-        sidebar.layer?.backgroundColor = NSColor(calibratedRed: 0.06, green: 0.09, blue: 0.2, alpha: 1).cgColor
+        sidebar.layer?.backgroundColor = Theme.sidebarBackground.cgColor
         sidebar.layer?.cornerRadius = 16
         sidebar.edgeInsets = NSEdgeInsets(top: 18, left: 14, bottom: 18, right: 14)
         sidebar.translatesAutoresizingMaskIntoConstraints = false
@@ -86,12 +104,12 @@ final class DashboardView: NSView {
         mainColumn.translatesAutoresizingMaskIntoConstraints = false
 
         greetingLabel.font = .systemFont(ofSize: 30, weight: .bold)
-        greetingLabel.textColor = .white
+        greetingLabel.textColor = Theme.primaryText
         subtitleLabel.font = .systemFont(ofSize: 14, weight: .regular)
-        subtitleLabel.textColor = NSColor.white.withAlphaComponent(0.75)
+        subtitleLabel.textColor = Theme.secondaryText
 
         heroCard.wantsLayer = true
-        heroCard.layer?.backgroundColor = NSColor(calibratedRed: 0.08, green: 0.11, blue: 0.28, alpha: 1).cgColor
+        heroCard.layer?.backgroundColor = Theme.heroBackground.cgColor
         heroCard.layer?.cornerRadius = 18
         heroCard.translatesAutoresizingMaskIntoConstraints = false
         let hero = buildHeroContent()
@@ -174,16 +192,16 @@ final class DashboardView: NSView {
 
         let title = NSTextField(labelWithString: "AI Job Search Assistant")
         title.font = .systemFont(ofSize: 24, weight: .semibold)
-        title.textColor = .white
+        title.textColor = Theme.primaryText
 
         let body = NSTextField(labelWithString: "Let AI find the best jobs for you on Indeed based on your preferences.")
         body.font = .systemFont(ofSize: 12, weight: .regular)
-        body.textColor = NSColor.white.withAlphaComponent(0.72)
+        body.textColor = Theme.secondaryText
 
         let action = NSButton(title: "Find Jobs with AI", target: nil, action: nil)
         action.bezelStyle = .rounded
         action.wantsLayer = true
-        action.layer?.backgroundColor = NSColor(calibratedRed: 0.27, green: 0.42, blue: 1.0, alpha: 1).cgColor
+        action.layer?.backgroundColor = Theme.accent.cgColor
         action.layer?.cornerRadius = 8
         action.contentTintColor = .white
         action.font = .systemFont(ofSize: 13, weight: .semibold)
@@ -212,7 +230,7 @@ final class DashboardView: NSView {
 
         let brand = NSTextField(labelWithString: "Indeed AI\nJob Finder")
         brand.font = .systemFont(ofSize: 18, weight: .bold)
-        brand.textColor = .white
+        brand.textColor = Theme.primaryText
         sidebar.addArrangedSubview(brand)
 
         let spacer = NSView()
@@ -229,17 +247,17 @@ final class DashboardView: NSView {
             row.layer?.cornerRadius = 8
             row.edgeInsets = NSEdgeInsets(top: 8, left: 10, bottom: 8, right: 10)
             if index == 0 {
-                row.layer?.backgroundColor = NSColor(calibratedRed: 0.22, green: 0.31, blue: 0.85, alpha: 0.4).cgColor
+                row.layer?.backgroundColor = Theme.accentMuted.cgColor
             }
 
             let icon = NSImageView()
             icon.symbolConfiguration = NSImage.SymbolConfiguration(pointSize: 13, weight: .medium)
             icon.image = NSImage(systemSymbolName: item.systemImage, accessibilityDescription: item.title)
-            icon.contentTintColor = .white
+            icon.contentTintColor = Theme.primaryText
 
             let text = NSTextField(labelWithString: item.title)
             text.font = .systemFont(ofSize: 14, weight: .medium)
-            text.textColor = .white
+            text.textColor = Theme.primaryText
 
             row.addArrangedSubview(icon)
             row.addArrangedSubview(text)
@@ -249,7 +267,7 @@ final class DashboardView: NSView {
                 badgeField.font = .systemFont(ofSize: 11, weight: .semibold)
                 badgeField.textColor = .white
                 badgeField.wantsLayer = true
-                badgeField.layer?.backgroundColor = NSColor.systemPurple.cgColor
+                badgeField.layer?.backgroundColor = Theme.accent.cgColor
                 badgeField.layer?.cornerRadius = 8
                 badgeField.alignment = .center
                 badgeField.maximumNumberOfLines = 1
@@ -271,16 +289,16 @@ final class DashboardView: NSView {
             card.spacing = 6
             card.edgeInsets = NSEdgeInsets(top: 14, left: 14, bottom: 14, right: 14)
             card.wantsLayer = true
-            card.layer?.backgroundColor = NSColor(calibratedRed: 0.06, green: 0.11, blue: 0.24, alpha: 1).cgColor
+            card.layer?.backgroundColor = Theme.statCardBackground.cgColor
             card.layer?.cornerRadius = 14
 
             let value = NSTextField(labelWithString: stat.value)
             value.font = .systemFont(ofSize: 30, weight: .bold)
-            value.textColor = .white
+            value.textColor = Theme.primaryText
 
             let title = NSTextField(labelWithString: stat.title)
             title.font = .systemFont(ofSize: 13, weight: .medium)
-            title.textColor = NSColor.white.withAlphaComponent(0.74)
+            title.textColor = Theme.secondaryText
 
             let trend = NSTextField(labelWithString: stat.trend)
             trend.font = .systemFont(ofSize: 12, weight: .semibold)
@@ -315,7 +333,7 @@ final class DashboardView: NSView {
             let icon = NSView()
             icon.wantsLayer = true
             icon.layer?.cornerRadius = 10
-            icon.layer?.backgroundColor = NSColor(calibratedRed: 0.19, green: 0.34, blue: 0.9, alpha: 0.9).cgColor
+            icon.layer?.backgroundColor = Theme.iconBackground.cgColor
             icon.translatesAutoresizingMaskIntoConstraints = false
             icon.widthAnchor.constraint(equalToConstant: 38).isActive = true
             icon.heightAnchor.constraint(equalToConstant: 38).isActive = true
@@ -327,11 +345,11 @@ final class DashboardView: NSView {
 
             let title = NSTextField(labelWithString: recommendation.title)
             title.font = .systemFont(ofSize: 15, weight: .semibold)
-            title.textColor = .white
+            title.textColor = Theme.primaryText
 
             let subtitle = NSTextField(labelWithString: "\(recommendation.company) • \(recommendation.location)")
             subtitle.font = .systemFont(ofSize: 12, weight: .regular)
-            subtitle.textColor = NSColor.white.withAlphaComponent(0.7)
+            subtitle.textColor = Theme.secondaryText
 
             textColumn.addArrangedSubview(title)
             textColumn.addArrangedSubview(subtitle)
@@ -346,7 +364,7 @@ final class DashboardView: NSView {
 
             let posted = NSTextField(labelWithString: recommendation.postedAgo)
             posted.font = .systemFont(ofSize: 11, weight: .regular)
-            posted.textColor = NSColor.white.withAlphaComponent(0.6)
+            posted.textColor = Theme.tertiaryText
 
             meta.addArrangedSubview(match)
             meta.addArrangedSubview(posted)
@@ -375,16 +393,16 @@ final class DashboardView: NSView {
             card.spacing = 4
             card.edgeInsets = NSEdgeInsets(top: 10, left: 10, bottom: 10, right: 10)
             card.wantsLayer = true
-            card.layer?.backgroundColor = NSColor(calibratedRed: 0.07, green: 0.12, blue: 0.22, alpha: 1).cgColor
+            card.layer?.backgroundColor = Theme.insightCardBackground.cgColor
             card.layer?.cornerRadius = 10
 
             let title = NSTextField(labelWithString: insight.title)
             title.font = .systemFont(ofSize: 14, weight: .semibold)
-            title.textColor = .white
+            title.textColor = Theme.primaryText
 
             let body = NSTextField(labelWithString: insight.description)
             body.font = .systemFont(ofSize: 12, weight: .regular)
-            body.textColor = NSColor.white.withAlphaComponent(0.7)
+            body.textColor = Theme.secondaryText
             body.maximumNumberOfLines = 2
             body.lineBreakMode = .byWordWrapping
 
@@ -401,12 +419,12 @@ final class DashboardView: NSView {
         box.alignment = .leading
         box.edgeInsets = NSEdgeInsets(top: 14, left: 14, bottom: 14, right: 14)
         box.wantsLayer = true
-        box.layer?.backgroundColor = NSColor(calibratedRed: 0.05, green: 0.09, blue: 0.19, alpha: 1).cgColor
+        box.layer?.backgroundColor = Theme.sectionBackground.cgColor
         box.layer?.cornerRadius = 16
 
         let titleLabel = NSTextField(labelWithString: title)
         titleLabel.font = .systemFont(ofSize: 18, weight: .semibold)
-        titleLabel.textColor = .white
+        titleLabel.textColor = Theme.primaryText
         box.addArrangedSubview(titleLabel)
         box.addArrangedSubview(content)
         return box
@@ -415,9 +433,9 @@ final class DashboardView: NSView {
     private func tagBubble(_ text: String) -> NSView {
         let label = NSTextField(labelWithString: text)
         label.font = .systemFont(ofSize: 11, weight: .medium)
-        label.textColor = NSColor(calibratedRed: 0.75, green: 0.79, blue: 1, alpha: 1)
+        label.textColor = Theme.bubbleText
         label.wantsLayer = true
-        label.layer?.backgroundColor = NSColor(calibratedRed: 0.2, green: 0.24, blue: 0.45, alpha: 0.5).cgColor
+        label.layer?.backgroundColor = Theme.bubbleBackground.cgColor
         label.layer?.cornerRadius = 7
         label.alignment = .center
         label.translatesAutoresizingMaskIntoConstraints = false