Jelajahi Sumber

Add placeholder actions for About settings rows.

Wire Support, Terms of Use, and Privacy Policy rows to temporary handlers that show a coming-soon alert when tapped.

Co-authored-by: Cursor <cursoragent@cursor.com>
AhtashamShahzad1 2 bulan lalu
induk
melakukan
76018eed85
1 mengubah file dengan 47 tambahan dan 4 penghapusan
  1. 47 4
      App for Indeed/Views/DashboardView.swift

+ 47 - 4
App for Indeed/Views/DashboardView.swift

@@ -1118,9 +1118,9 @@ final class DashboardView: NSView, NSTextFieldDelegate {
         aboutTitle.alignment = .left
 
         let aboutSection = makeSettingsSection(rows: [
-            makeSettingsRow(title: "Support", systemImage: "questionmark.circle", accessory: nil),
-            makeSettingsRow(title: "Terms of Use", systemImage: "doc.text", accessory: nil),
-            makeSettingsRow(title: "Privacy Policy", systemImage: "shield", accessory: nil)
+            makeSettingsRow(title: "Support", systemImage: "questionmark.circle", accessory: nil, tapAction: #selector(didTapSupport)),
+            makeSettingsRow(title: "Terms of Use", systemImage: "doc.text", accessory: nil, tapAction: #selector(didTapTermsOfUse)),
+            makeSettingsRow(title: "Privacy Policy", systemImage: "shield", accessory: nil, tapAction: #selector(didTapPrivacyPolicy))
         ])
 
         let aboutStack = NSStackView(views: [aboutTitle, aboutSection])
@@ -1207,7 +1207,7 @@ final class DashboardView: NSView, NSTextFieldDelegate {
         return section
     }
 
-    private func makeSettingsRow(title: String, systemImage: String, accessory: NSView?) -> NSView {
+    private func makeSettingsRow(title: String, systemImage: String, accessory: NSView?, tapAction: Selector? = nil) -> NSView {
         let row = NSView()
         row.translatesAutoresizingMaskIntoConstraints = false
         row.wantsLayer = true
@@ -1262,6 +1262,24 @@ final class DashboardView: NSView, NSTextFieldDelegate {
             rowStack.bottomAnchor.constraint(equalTo: row.bottomAnchor)
         ])
 
+        if let tapAction {
+            let rowButton = NSButton(title: "", target: self, action: tapAction)
+            rowButton.translatesAutoresizingMaskIntoConstraints = false
+            rowButton.isBordered = false
+            rowButton.bezelStyle = .regularSquare
+            rowButton.setButtonType(.momentaryChange)
+            rowButton.focusRingType = .none
+            rowButton.wantsLayer = true
+            rowButton.layer?.backgroundColor = .clear
+            row.addSubview(rowButton)
+            NSLayoutConstraint.activate([
+                rowButton.leadingAnchor.constraint(equalTo: row.leadingAnchor),
+                rowButton.trailingAnchor.constraint(equalTo: row.trailingAnchor),
+                rowButton.topAnchor.constraint(equalTo: row.topAnchor),
+                rowButton.bottomAnchor.constraint(equalTo: row.bottomAnchor)
+            ])
+        }
+
         return row
     }
 
@@ -1368,6 +1386,31 @@ final class DashboardView: NSView, NSTextFieldDelegate {
         focusSearchField(seed: "Find jobs that require skill: ")
     }
 
+    @objc private func didTapSupport() {
+        presentSettingsPlaceholderAlert(for: "Support")
+    }
+
+    @objc private func didTapTermsOfUse() {
+        presentSettingsPlaceholderAlert(for: "Terms of Use")
+    }
+
+    @objc private func didTapPrivacyPolicy() {
+        presentSettingsPlaceholderAlert(for: "Privacy Policy")
+    }
+
+    private func presentSettingsPlaceholderAlert(for featureName: String) {
+        let alert = NSAlert()
+        alert.messageText = "\(featureName) coming soon"
+        alert.informativeText = "This section is a placeholder for now."
+        alert.alertStyle = .informational
+        alert.addButton(withTitle: "OK")
+        if let window {
+            alert.beginSheetModal(for: window)
+        } else {
+            alert.runModal()
+        }
+    }
+
     private func focusSearchField(seed: String) {
         jobKeywordsField.stringValue = seed
         window?.makeFirstResponder(jobKeywordsField)