Pārlūkot izejas kodu

Match Indeed sidebar icon to other nav items.

Use a template glyph that tints grey when inactive and brand blue when selected, like Home and the SF Symbol rows.

Co-authored-by: Cursor <cursoragent@cursor.com>
AhtashamShahzad1 2 nedēļas atpakaļ
vecāks
revīzija
469025f19a

+ 10 - 3
App for Indeed/Views/DashboardView.swift

@@ -172,6 +172,8 @@ final class DashboardView: NSView, NSTextFieldDelegate, NSSharingServicePickerDe
172 172
     private static let jobsPerSearchDefault = 15
173 173
     private static let jobsPerSearchMin = 1
174 174
     private static let jobsPerSearchMaxCap = 25
175
+    /// Matches SF Symbol nav icon footprint in sidebar rows.
176
+    private static let sidebarNavIconSize: CGFloat = 18
175 177
 
176 178
     private static func clampedJobsPerRequest(_ requested: Int = jobsPerSearchDefault) -> Int {
177 179
         min(jobsPerSearchMaxCap, max(jobsPerSearchMin, requested))
@@ -2615,15 +2617,20 @@ final class DashboardView: NSView, NSTextFieldDelegate, NSSharingServicePickerDe
2615 2617
         row.alignment = .centerY
2616 2618
         row.translatesAutoresizingMaskIntoConstraints = false
2617 2619
 
2618
-        let logo = IndeedLogoView(displayHeight: 18, variant: .compact)
2619
-        logo.translatesAutoresizingMaskIntoConstraints = false
2620
+        let icon = NSImageView()
2621
+        icon.translatesAutoresizingMaskIntoConstraints = false
2622
+        icon.image = IndeedSidebarNavIcon.image(filled: isSelected)
2623
+        icon.imageScaling = .scaleProportionallyUpOrDown
2624
+        icon.contentTintColor = isSelected ? Theme.brandBlue : Theme.secondaryText
2625
+        icon.widthAnchor.constraint(equalToConstant: Self.sidebarNavIconSize).isActive = true
2626
+        icon.heightAnchor.constraint(equalToConstant: Self.sidebarNavIconSize).isActive = true
2620 2627
 
2621 2628
         let text = NSTextField(labelWithString: "Indeed")
2622 2629
         text.font = .systemFont(ofSize: 14, weight: .medium)
2623 2630
         text.textColor = isSelected ? Theme.brandBlue : Theme.secondaryText
2624 2631
         text.refusesFirstResponder = true
2625 2632
 
2626
-        row.addArrangedSubview(logo)
2633
+        row.addArrangedSubview(icon)
2627 2634
         row.addArrangedSubview(text)
2628 2635
 
2629 2636
         rowHost.addSubview(row)

+ 72 - 0
App for Indeed/Views/IndeedLogoView.swift

@@ -22,6 +22,78 @@ enum IndeedBrandLogo {
22 22
     }
23 23
 }
24 24
 
25
+/// Sidebar “Indeed” row icon — outline or filled template glyph tinted like SF Symbols.
26
+enum IndeedSidebarNavIcon {
27
+    private static let canvas: CGFloat = 18
28
+    private static var outlineImage: NSImage?
29
+    private static var filledImage: NSImage?
30
+
31
+    static func image(filled: Bool) -> NSImage {
32
+        if filled {
33
+            if let filledImage { return filledImage }
34
+            let image = makeImage(filled: true)
35
+            filledImage = image
36
+            return image
37
+        }
38
+        if let outlineImage { return outlineImage }
39
+        let image = makeImage(filled: false)
40
+        outlineImage = image
41
+        return image
42
+    }
43
+
44
+    private static func makeImage(filled: Bool) -> NSImage {
45
+        let size = NSSize(width: canvas, height: canvas)
46
+        let image = NSImage(size: size, flipped: true) { _ in
47
+            if filled {
48
+                drawFilledMark()
49
+            } else {
50
+                drawOutlineMark()
51
+            }
52
+            return true
53
+        }
54
+        image.isTemplate = true
55
+        return image
56
+    }
57
+
58
+    /// Stylized “i” mark (dot + stem + brow) aligned with SF Symbol nav icons.
59
+    private static func drawOutlineMark() {
60
+        let stroke: CGFloat = 1.25
61
+        NSColor.black.setStroke()
62
+
63
+        let dot = NSBezierPath(ovalIn: NSRect(x: 7.2, y: 2.8, width: 3.6, height: 3.6))
64
+        dot.lineWidth = stroke
65
+        dot.stroke()
66
+
67
+        let stem = NSBezierPath(roundedRect: NSRect(x: 7.2, y: 7.2, width: 3.6, height: 8.2), xRadius: 1.8, yRadius: 1.8)
68
+        stem.lineWidth = stroke
69
+        stem.stroke()
70
+
71
+        let brow = NSBezierPath()
72
+        brow.move(to: NSPoint(x: 4.6, y: 6.4))
73
+        brow.curve(to: NSPoint(x: 13.4, y: 6.4), controlPoint1: NSPoint(x: 6.2, y: 2.2), controlPoint2: NSPoint(x: 11.8, y: 2.2))
74
+        brow.lineWidth = stroke
75
+        brow.lineCapStyle = .round
76
+        brow.stroke()
77
+    }
78
+
79
+    private static func drawFilledMark() {
80
+        NSColor.black.setFill()
81
+
82
+        let dot = NSBezierPath(ovalIn: NSRect(x: 7.2, y: 2.8, width: 3.6, height: 3.6))
83
+        dot.fill()
84
+
85
+        let stem = NSBezierPath(roundedRect: NSRect(x: 7.2, y: 7.2, width: 3.6, height: 8.2), xRadius: 1.8, yRadius: 1.8)
86
+        stem.fill()
87
+
88
+        let brow = NSBezierPath()
89
+        brow.move(to: NSPoint(x: 4.6, y: 6.4))
90
+        brow.curve(to: NSPoint(x: 13.4, y: 6.4), controlPoint1: NSPoint(x: 6.2, y: 2.2), controlPoint2: NSPoint(x: 11.8, y: 2.2))
91
+        brow.lineWidth = 1.35
92
+        brow.lineCapStyle = .round
93
+        brow.stroke()
94
+    }
95
+}
96
+
25 97
 final class IndeedLogoView: NSView {
26 98
     private let imageView = NSImageView()
27 99
     private let variant: IndeedBrandLogo.Variant