Просмотр исходного кода

Fix CV Maker CTA so Profile navigation always updates the UI.

Force the profiles list when handing off from template selection, alert when Profile is missing or Build CV has no pending template, and keep the bottom CTA above the scroll view on macOS.

Co-authored-by: Cursor <cursoragent@cursor.com>
AhtashamShahzad1 1 день назад
Родитель
Сommit
a10585b8e3
2 измененных файлов с 53 добавлено и 5 удалено
  1. 2 0
      App for Indeed/Views/CVMakerPageView.swift
  2. 51 5
      App for Indeed/Views/DashboardView.swift

+ 2 - 0
App for Indeed/Views/CVMakerPageView.swift

@@ -702,6 +702,8 @@ final class CVMakerPageView: NSView {
702
         super.layout()
702
         super.layout()
703
         pageGradientLayer.frame = bounds
703
         pageGradientLayer.frame = bounds
704
         layoutGridCardsIfNeeded()
704
         layoutGridCardsIfNeeded()
705
+        // Keep the bottom CTA above the scroll view so template-grid scrolling cannot steal clicks.
706
+        addSubview(ctaButton, positioned: .above, relativeTo: nil)
705
     }
707
     }
706
 
708
 
707
     func applyCurrentAppearance() {
709
     func applyCurrentAppearance() {

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

@@ -1752,10 +1752,50 @@ final class DashboardView: NSView, NSTextFieldDelegate, NSSharingServicePickerDe
1752
         }
1752
         }
1753
     }
1753
     }
1754
 
1754
 
1755
+    /// Sidebar index for **Profile** (`person` icon). Stable across language changes unlike title-only matching.
1756
+    private func profileSidebarIndex() -> Int? {
1757
+        if let index = currentSidebarItems.firstIndex(where: { $0.systemImage == "person" }) {
1758
+            return index
1759
+        }
1760
+        return currentSidebarItems.firstIndex(where: { $0.title == L("Profile") })
1761
+    }
1762
+
1755
     /// Switches the main panel to **Profile** so the user can pick a saved CV profile after choosing a template in CV Maker.
1763
     /// Switches the main panel to **Profile** so the user can pick a saved CV profile after choosing a template in CV Maker.
1756
     private func selectProfileSidebarForCVMakerFlow() {
1764
     private func selectProfileSidebarForCVMakerFlow() {
1757
-        guard let index = currentSidebarItems.firstIndex(where: { $0.title == L("Profile") }) else { return }
1758
-        selectSidebarItem(at: index)
1765
+        guard let index = profileSidebarIndex() else {
1766
+            presentDashboardAlert(
1767
+                title: L("Couldn't open Profile"),
1768
+                message: L("The Profile section isn't available right now. Try restarting the app.")
1769
+            )
1770
+            return
1771
+        }
1772
+        applyProfilePageForCVMakerHandoff(selectingSidebarIndex: index)
1773
+    }
1774
+
1775
+    /// Always shows the profiles list for the CV Maker hand-off (avoids `selectSidebarItem` no-op when Profile is already selected).
1776
+    private func applyProfilePageForCVMakerHandoff(selectingSidebarIndex index: Int) {
1777
+        isIndeedSidebarSelected = false
1778
+        dismissIndeedJobBrowserEmbedded()
1779
+        guard index >= 0, index < currentSidebarItems.count else { return }
1780
+
1781
+        isCVDocumentPreviewPresented = false
1782
+        isProfileEditorPresented = false
1783
+        selectedSidebarIndex = index
1784
+        configureSidebar()
1785
+        updateMainContentVisibility()
1786
+    }
1787
+
1788
+    private func presentDashboardAlert(title: String, message: String) {
1789
+        let alert = NSAlert()
1790
+        alert.messageText = title
1791
+        alert.informativeText = message
1792
+        alert.alertStyle = .informational
1793
+        alert.addButton(withTitle: L("OK"))
1794
+        if let window {
1795
+            alert.beginSheetModal(for: window)
1796
+        } else {
1797
+            alert.runModal()
1798
+        }
1759
     }
1799
     }
1760
 
1800
 
1761
     private func configureProfilePage() {
1801
     private func configureProfilePage() {
@@ -1798,9 +1838,15 @@ final class DashboardView: NSView, NSTextFieldDelegate, NSSharingServicePickerDe
1798
             self?.confirmDeleteProfile(id: id)
1838
             self?.confirmDeleteProfile(id: id)
1799
         }
1839
         }
1800
         profilesListPageView.onBuildCVWithProfile = { [weak self] profileID in
1840
         profilesListPageView.onBuildCVWithProfile = { [weak self] profileID in
1801
-            guard let self,
1802
-                  let template = self.pendingCVTemplate,
1803
-                  let profile = SavedProfilesStore.profile(id: profileID) else { return }
1841
+            guard let self else { return }
1842
+            guard let template = self.pendingCVTemplate else {
1843
+                self.presentDashboardAlert(
1844
+                    title: L("No template selected"),
1845
+                    message: L("Choose a template in CV Maker, then tap Use Template & Select Profile before Build CV.")
1846
+                )
1847
+                return
1848
+            }
1849
+            guard let profile = SavedProfilesStore.profile(id: profileID) else { return }
1804
             self.presentCVDocumentPreview(profile: profile, template: template)
1850
             self.presentCVDocumentPreview(profile: profile, template: template)
1805
         }
1851
         }
1806
         cvFilledPreviewPageView.onDismiss = { [weak self] in
1852
         cvFilledPreviewPageView.onDismiss = { [weak self] in