|
|
@@ -948,6 +948,22 @@ final class DashboardView: NSView, NSTextFieldDelegate, NSSharingServicePickerDe
|
|
|
return host.contains(".indeed.")
|
|
|
}
|
|
|
|
|
|
+ private static let indeedBrowseHomeURL = URL(string: "https://www.indeed.com/")!
|
|
|
+
|
|
|
+ private static let externalIndeedAppURLSchemes = ["indeed://", "indeedjobs://"]
|
|
|
+
|
|
|
+ /// Opens the installed Indeed app when a handler is registered; otherwise loads Indeed in the embedded browser.
|
|
|
+ private func openIndeedFromSidebar() {
|
|
|
+ for scheme in Self.externalIndeedAppURLSchemes {
|
|
|
+ guard let url = URL(string: scheme) else { continue }
|
|
|
+ if NSWorkspace.shared.urlForApplication(toOpen: url) != nil {
|
|
|
+ NSWorkspace.shared.open(url)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ presentIndeedJobBrowser(url: Self.indeedBrowseHomeURL)
|
|
|
+ }
|
|
|
+
|
|
|
private func presentIndeedJobBrowser(url: URL) {
|
|
|
guard let parentVC = hostingViewController else { return }
|
|
|
|
|
|
@@ -2380,6 +2396,50 @@ final class DashboardView: NSView, NSTextFieldDelegate, NSSharingServicePickerDe
|
|
|
trailingLoadMoreJobsButton?.alphaValue = enabled ? 1 : 0.65
|
|
|
}
|
|
|
|
|
|
+ private func addIndeedSidebarLaunchRow() {
|
|
|
+ let rowHost = SidebarNavRowView { [weak self] in
|
|
|
+ self?.openIndeedFromSidebar()
|
|
|
+ }
|
|
|
+ rowHost.translatesAutoresizingMaskIntoConstraints = false
|
|
|
+ rowHost.wantsLayer = true
|
|
|
+ rowHost.layer?.cornerRadius = 8
|
|
|
+ rowHost.restingBackgroundColor = nil
|
|
|
+ rowHost.hoverBackgroundColor = Theme.sidebarRowHoverFill
|
|
|
+ rowHost.setAccessibilityLabel("Indeed")
|
|
|
+ rowHost.setAccessibilityRole(.button)
|
|
|
+ rowHost.setAccessibilityHelp("Open Indeed to search and apply for jobs")
|
|
|
+
|
|
|
+ let row = NSStackView()
|
|
|
+ row.orientation = .horizontal
|
|
|
+ row.spacing = 8
|
|
|
+ row.alignment = .centerY
|
|
|
+ row.translatesAutoresizingMaskIntoConstraints = false
|
|
|
+
|
|
|
+ let logo = IndeedLogoView(displayHeight: 18, variant: .compact)
|
|
|
+ logo.translatesAutoresizingMaskIntoConstraints = false
|
|
|
+
|
|
|
+ let text = NSTextField(labelWithString: "Indeed")
|
|
|
+ text.font = .systemFont(ofSize: 14, weight: .medium)
|
|
|
+ text.textColor = Theme.secondaryText
|
|
|
+ text.refusesFirstResponder = true
|
|
|
+
|
|
|
+ row.addArrangedSubview(logo)
|
|
|
+ row.addArrangedSubview(text)
|
|
|
+
|
|
|
+ rowHost.addSubview(row)
|
|
|
+ NSLayoutConstraint.activate([
|
|
|
+ row.leadingAnchor.constraint(equalTo: rowHost.leadingAnchor, constant: 10),
|
|
|
+ row.trailingAnchor.constraint(equalTo: rowHost.trailingAnchor, constant: -10),
|
|
|
+ row.topAnchor.constraint(equalTo: rowHost.topAnchor, constant: 8),
|
|
|
+ row.bottomAnchor.constraint(equalTo: rowHost.bottomAnchor, constant: -8)
|
|
|
+ ])
|
|
|
+ rowHost.setContentHuggingPriority(.defaultLow, for: .horizontal)
|
|
|
+ sidebar.addArrangedSubview(rowHost)
|
|
|
+ let sidebarHorizontalInset = sidebar.edgeInsets.left + sidebar.edgeInsets.right
|
|
|
+ rowHost.widthAnchor.constraint(equalTo: sidebar.widthAnchor, constant: -sidebarHorizontalInset).isActive = true
|
|
|
+ sidebar.setCustomSpacing(10, after: rowHost)
|
|
|
+ }
|
|
|
+
|
|
|
private func configureSidebar() {
|
|
|
let items = currentSidebarItems
|
|
|
sidebar.arrangedSubviews.forEach {
|
|
|
@@ -2405,6 +2465,8 @@ final class DashboardView: NSView, NSTextFieldDelegate, NSSharingServicePickerDe
|
|
|
sidebar.addArrangedSubview(brandHeader)
|
|
|
sidebar.setCustomSpacing(22, after: brandHeader)
|
|
|
|
|
|
+ addIndeedSidebarLaunchRow()
|
|
|
+
|
|
|
items.enumerated().forEach { index, item in
|
|
|
let isSelected = index == selectedSidebarIndex
|
|
|
|