Browse Source

Show blue selection border on home Role, Company, and Skill shortcuts.

Tapping a shortcut card highlights it and clears selection on the others so users can see which search mode is active.

Co-authored-by: Cursor <cursoragent@cursor.com>
AhtashamShahzad1 2 weeks ago
parent
commit
639b6f2d69
1 changed files with 30 additions and 5 deletions
  1. 30 5
      App for Indeed/Views/DashboardView.swift

+ 30 - 5
App for Indeed/Views/DashboardView.swift

@@ -100,6 +100,7 @@ final class DashboardView: NSView, NSTextFieldDelegate, NSSharingServicePickerDe
100
     private let welcomeLogoWell = NSView()
100
     private let welcomeLogoWell = NSView()
101
     private let welcomeLogoView = IndeedLogoView(displayHeight: 40, variant: .compact)
101
     private let welcomeLogoView = IndeedLogoView(displayHeight: 40, variant: .compact)
102
     private let featureCardsRow = NSStackView()
102
     private let featureCardsRow = NSStackView()
103
+    private enum FeatureShortcut: Int { case role = 0, company = 1, skill = 2 }
103
     private let clearChatButton = NSButton(title: "Clear chat", target: nil, action: nil)
104
     private let clearChatButton = NSButton(title: "Clear chat", target: nil, action: nil)
104
     private let chatScrollView = NSScrollView()
105
     private let chatScrollView = NSScrollView()
105
     private let chatDocumentView = JobListingsDocumentView()
106
     private let chatDocumentView = JobListingsDocumentView()
@@ -1813,17 +1814,27 @@ final class DashboardView: NSView, NSTextFieldDelegate, NSSharingServicePickerDe
1813
     }
1814
     }
1814
 
1815
 
1815
     @objc private func didTapFeatureRole() {
1816
     @objc private func didTapFeatureRole() {
1817
+        selectFeatureShortcut(.role)
1816
         focusSearchField(seed: "Find roles similar to: ")
1818
         focusSearchField(seed: "Find roles similar to: ")
1817
     }
1819
     }
1818
 
1820
 
1819
     @objc private func didTapFeatureCompany() {
1821
     @objc private func didTapFeatureCompany() {
1822
+        selectFeatureShortcut(.company)
1820
         focusSearchField(seed: "Find jobs at company: ")
1823
         focusSearchField(seed: "Find jobs at company: ")
1821
     }
1824
     }
1822
 
1825
 
1823
     @objc private func didTapFeatureSkill() {
1826
     @objc private func didTapFeatureSkill() {
1827
+        selectFeatureShortcut(.skill)
1824
         focusSearchField(seed: "Find jobs that require skill: ")
1828
         focusSearchField(seed: "Find jobs that require skill: ")
1825
     }
1829
     }
1826
 
1830
 
1831
+    private func selectFeatureShortcut(_ shortcut: FeatureShortcut) {
1832
+        for (index, view) in featureCardsRow.arrangedSubviews.enumerated() {
1833
+            guard let card = view as? FeatureShortcutCardView else { continue }
1834
+            card.isSelected = (index == shortcut.rawValue)
1835
+        }
1836
+    }
1837
+
1827
     @objc private func didTapShareApp(_ sender: NSButton) {
1838
     @objc private func didTapShareApp(_ sender: NSButton) {
1828
         presentAppShareMenu(anchoredTo: sender)
1839
         presentAppShareMenu(anchoredTo: sender)
1829
     }
1840
     }
@@ -3167,6 +3178,9 @@ private final class WelcomeHeroBackgroundView: NSView {
3167
 /// Home welcome row: three tappable shortcuts that seed the main search field (reference: white cards, pastel icon well, arrow at bottom trailing).
3178
 /// Home welcome row: three tappable shortcuts that seed the main search field (reference: white cards, pastel icon well, arrow at bottom trailing).
3168
 private final class FeatureShortcutCardView: NSView {
3179
 private final class FeatureShortcutCardView: NSView {
3169
     private static let cardCornerRadius: CGFloat = 14
3180
     private static let cardCornerRadius: CGFloat = 14
3181
+    private static let primaryBlue = NSColor(srgbRed: 0, green: 82 / 255, blue: 204 / 255, alpha: 1)
3182
+    private static let defaultBorderColor = NSColor(srgbRed: 237 / 255, green: 242 / 255, blue: 247 / 255, alpha: 1)
3183
+    var isSelected = false { didSet { updateSelectionAppearance() } }
3170
     private weak var actionTarget: AnyObject?
3184
     private weak var actionTarget: AnyObject?
3171
     private var actionSelector: Selector
3185
     private var actionSelector: Selector
3172
 
3186
 
@@ -3182,16 +3196,13 @@ private final class FeatureShortcutCardView: NSView {
3182
         }
3196
         }
3183
         layer?.backgroundColor = NSColor.white.cgColor
3197
         layer?.backgroundColor = NSColor.white.cgColor
3184
         layer?.masksToBounds = false
3198
         layer?.masksToBounds = false
3185
-        layer?.borderWidth = 1
3186
-        // `#EDF2F7` — light card stroke.
3187
-        layer?.borderColor = NSColor(srgbRed: 237 / 255, green: 242 / 255, blue: 247 / 255, alpha: 1).cgColor
3188
         layer?.shadowColor = NSColor.black.withAlphaComponent(0.06).cgColor
3199
         layer?.shadowColor = NSColor.black.withAlphaComponent(0.06).cgColor
3189
         layer?.shadowOffset = CGSize(width: 0, height: 2)
3200
         layer?.shadowOffset = CGSize(width: 0, height: 2)
3190
         layer?.shadowRadius = 12
3201
         layer?.shadowRadius = 12
3191
         layer?.shadowOpacity = 1
3202
         layer?.shadowOpacity = 1
3203
+        updateSelectionAppearance()
3192
 
3204
 
3193
-        // `#0052CC` — primary title / icons / arrow (matches welcome hero reference).
3194
-        let primaryBlue = NSColor(srgbRed: 0, green: 82 / 255, blue: 204 / 255, alpha: 1)
3205
+        let primaryBlue = Self.primaryBlue
3195
         // `#EBF2FF` — circular icon well.
3206
         // `#EBF2FF` — circular icon well.
3196
         let iconWellColor = NSColor(srgbRed: 235 / 255, green: 242 / 255, blue: 255 / 255, alpha: 1)
3207
         let iconWellColor = NSColor(srgbRed: 235 / 255, green: 242 / 255, blue: 255 / 255, alpha: 1)
3197
         // `#5D6D7E` — muted description.
3208
         // `#5D6D7E` — muted description.
@@ -3284,6 +3295,20 @@ private final class FeatureShortcutCardView: NSView {
3284
         setAccessibilityLabel("\(title). \(subtitle)")
3295
         setAccessibilityLabel("\(title). \(subtitle)")
3285
     }
3296
     }
3286
 
3297
 
3298
+    private func updateSelectionAppearance() {
3299
+        guard let layer else { return }
3300
+        if isSelected {
3301
+            layer.borderWidth = 2
3302
+            layer.borderColor = Self.primaryBlue.cgColor
3303
+            layer.shadowOpacity = 0.1
3304
+        } else {
3305
+            layer.borderWidth = 1
3306
+            layer.borderColor = Self.defaultBorderColor.cgColor
3307
+            layer.shadowOpacity = 1
3308
+        }
3309
+        setAccessibilitySelected(isSelected)
3310
+    }
3311
+
3287
     @available(*, unavailable)
3312
     @available(*, unavailable)
3288
     required init?(coder: NSCoder) {
3313
     required init?(coder: NSCoder) {
3289
         fatalError("init(coder:) has not been implemented")
3314
         fatalError("init(coder:) has not been implemented")