|
|
@@ -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
|
1763
|
/// Switches the main panel to **Profile** so the user can pick a saved CV profile after choosing a template in CV Maker.
|
|
1756
|
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
|
1801
|
private func configureProfilePage() {
|
|
|
@@ -1798,9 +1838,15 @@ final class DashboardView: NSView, NSTextFieldDelegate, NSSharingServicePickerDe
|
|
1798
|
1838
|
self?.confirmDeleteProfile(id: id)
|
|
1799
|
1839
|
}
|
|
1800
|
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
|
1850
|
self.presentCVDocumentPreview(profile: profile, template: template)
|
|
1805
|
1851
|
}
|
|
1806
|
1852
|
cvFilledPreviewPageView.onDismiss = { [weak self] in
|