Преглед изворни кода

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 пре 3 недеља
родитељ
комит
76018eed85
1 измењених фајлова са 47 додато и 4 уклоњено
  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 {
1118 1118
         aboutTitle.alignment = .left
1119 1119
 
1120 1120
         let aboutSection = makeSettingsSection(rows: [
1121
-            makeSettingsRow(title: "Support", systemImage: "questionmark.circle", accessory: nil),
1122
-            makeSettingsRow(title: "Terms of Use", systemImage: "doc.text", accessory: nil),
1123
-            makeSettingsRow(title: "Privacy Policy", systemImage: "shield", accessory: nil)
1121
+            makeSettingsRow(title: "Support", systemImage: "questionmark.circle", accessory: nil, tapAction: #selector(didTapSupport)),
1122
+            makeSettingsRow(title: "Terms of Use", systemImage: "doc.text", accessory: nil, tapAction: #selector(didTapTermsOfUse)),
1123
+            makeSettingsRow(title: "Privacy Policy", systemImage: "shield", accessory: nil, tapAction: #selector(didTapPrivacyPolicy))
1124 1124
         ])
1125 1125
 
1126 1126
         let aboutStack = NSStackView(views: [aboutTitle, aboutSection])
@@ -1207,7 +1207,7 @@ final class DashboardView: NSView, NSTextFieldDelegate {
1207 1207
         return section
1208 1208
     }
1209 1209
 
1210
-    private func makeSettingsRow(title: String, systemImage: String, accessory: NSView?) -> NSView {
1210
+    private func makeSettingsRow(title: String, systemImage: String, accessory: NSView?, tapAction: Selector? = nil) -> NSView {
1211 1211
         let row = NSView()
1212 1212
         row.translatesAutoresizingMaskIntoConstraints = false
1213 1213
         row.wantsLayer = true
@@ -1262,6 +1262,24 @@ final class DashboardView: NSView, NSTextFieldDelegate {
1262 1262
             rowStack.bottomAnchor.constraint(equalTo: row.bottomAnchor)
1263 1263
         ])
1264 1264
 
1265
+        if let tapAction {
1266
+            let rowButton = NSButton(title: "", target: self, action: tapAction)
1267
+            rowButton.translatesAutoresizingMaskIntoConstraints = false
1268
+            rowButton.isBordered = false
1269
+            rowButton.bezelStyle = .regularSquare
1270
+            rowButton.setButtonType(.momentaryChange)
1271
+            rowButton.focusRingType = .none
1272
+            rowButton.wantsLayer = true
1273
+            rowButton.layer?.backgroundColor = .clear
1274
+            row.addSubview(rowButton)
1275
+            NSLayoutConstraint.activate([
1276
+                rowButton.leadingAnchor.constraint(equalTo: row.leadingAnchor),
1277
+                rowButton.trailingAnchor.constraint(equalTo: row.trailingAnchor),
1278
+                rowButton.topAnchor.constraint(equalTo: row.topAnchor),
1279
+                rowButton.bottomAnchor.constraint(equalTo: row.bottomAnchor)
1280
+            ])
1281
+        }
1282
+
1265 1283
         return row
1266 1284
     }
1267 1285
 
@@ -1368,6 +1386,31 @@ final class DashboardView: NSView, NSTextFieldDelegate {
1368 1386
         focusSearchField(seed: "Find jobs that require skill: ")
1369 1387
     }
1370 1388
 
1389
+    @objc private func didTapSupport() {
1390
+        presentSettingsPlaceholderAlert(for: "Support")
1391
+    }
1392
+
1393
+    @objc private func didTapTermsOfUse() {
1394
+        presentSettingsPlaceholderAlert(for: "Terms of Use")
1395
+    }
1396
+
1397
+    @objc private func didTapPrivacyPolicy() {
1398
+        presentSettingsPlaceholderAlert(for: "Privacy Policy")
1399
+    }
1400
+
1401
+    private func presentSettingsPlaceholderAlert(for featureName: String) {
1402
+        let alert = NSAlert()
1403
+        alert.messageText = "\(featureName) coming soon"
1404
+        alert.informativeText = "This section is a placeholder for now."
1405
+        alert.alertStyle = .informational
1406
+        alert.addButton(withTitle: "OK")
1407
+        if let window {
1408
+            alert.beginSheetModal(for: window)
1409
+        } else {
1410
+            alert.runModal()
1411
+        }
1412
+    }
1413
+
1371 1414
     private func focusSearchField(seed: String) {
1372 1415
         jobKeywordsField.stringValue = seed
1373 1416
         window?.makeFirstResponder(jobKeywordsField)