|
@@ -1752,10 +1752,50 @@ final class DashboardView: NSView, NSTextFieldDelegate, NSSharingServicePickerDe
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /// Sidebar index for **Profile** (`person` icon). Stable across language changes unlike title-only matching.
|
|
|
|
|
+ private func profileSidebarIndex() -> Int? {
|
|
|
|
|
+ if let index = currentSidebarItems.firstIndex(where: { $0.systemImage == "person" }) {
|
|
|
|
|
+ return index
|
|
|
|
|
+ }
|
|
|
|
|
+ return currentSidebarItems.firstIndex(where: { $0.title == L("Profile") })
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/// Switches the main panel to **Profile** so the user can pick a saved CV profile after choosing a template in CV Maker.
|
|
/// Switches the main panel to **Profile** so the user can pick a saved CV profile after choosing a template in CV Maker.
|
|
|
private func selectProfileSidebarForCVMakerFlow() {
|
|
private func selectProfileSidebarForCVMakerFlow() {
|
|
|
- guard let index = currentSidebarItems.firstIndex(where: { $0.title == L("Profile") }) else { return }
|
|
|
|
|
- selectSidebarItem(at: index)
|
|
|
|
|
|
|
+ guard let index = profileSidebarIndex() else {
|
|
|
|
|
+ presentDashboardAlert(
|
|
|
|
|
+ title: L("Couldn't open Profile"),
|
|
|
|
|
+ message: L("The Profile section isn't available right now. Try restarting the app.")
|
|
|
|
|
+ )
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ applyProfilePageForCVMakerHandoff(selectingSidebarIndex: index)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /// Always shows the profiles list for the CV Maker hand-off (avoids `selectSidebarItem` no-op when Profile is already selected).
|
|
|
|
|
+ private func applyProfilePageForCVMakerHandoff(selectingSidebarIndex index: Int) {
|
|
|
|
|
+ isIndeedSidebarSelected = false
|
|
|
|
|
+ dismissIndeedJobBrowserEmbedded()
|
|
|
|
|
+ guard index >= 0, index < currentSidebarItems.count else { return }
|
|
|
|
|
+
|
|
|
|
|
+ isCVDocumentPreviewPresented = false
|
|
|
|
|
+ isProfileEditorPresented = false
|
|
|
|
|
+ selectedSidebarIndex = index
|
|
|
|
|
+ configureSidebar()
|
|
|
|
|
+ updateMainContentVisibility()
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private func presentDashboardAlert(title: String, message: String) {
|
|
|
|
|
+ let alert = NSAlert()
|
|
|
|
|
+ alert.messageText = title
|
|
|
|
|
+ alert.informativeText = message
|
|
|
|
|
+ alert.alertStyle = .informational
|
|
|
|
|
+ alert.addButton(withTitle: L("OK"))
|
|
|
|
|
+ if let window {
|
|
|
|
|
+ alert.beginSheetModal(for: window)
|
|
|
|
|
+ } else {
|
|
|
|
|
+ alert.runModal()
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private func configureProfilePage() {
|
|
private func configureProfilePage() {
|
|
@@ -1798,9 +1838,15 @@ final class DashboardView: NSView, NSTextFieldDelegate, NSSharingServicePickerDe
|
|
|
self?.confirmDeleteProfile(id: id)
|
|
self?.confirmDeleteProfile(id: id)
|
|
|
}
|
|
}
|
|
|
profilesListPageView.onBuildCVWithProfile = { [weak self] profileID in
|
|
profilesListPageView.onBuildCVWithProfile = { [weak self] profileID in
|
|
|
- guard let self,
|
|
|
|
|
- let template = self.pendingCVTemplate,
|
|
|
|
|
- let profile = SavedProfilesStore.profile(id: profileID) else { return }
|
|
|
|
|
|
|
+ guard let self else { return }
|
|
|
|
|
+ guard let template = self.pendingCVTemplate else {
|
|
|
|
|
+ self.presentDashboardAlert(
|
|
|
|
|
+ title: L("No template selected"),
|
|
|
|
|
+ message: L("Choose a template in CV Maker, then tap Use Template & Select Profile before Build CV.")
|
|
|
|
|
+ )
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ guard let profile = SavedProfilesStore.profile(id: profileID) else { return }
|
|
|
self.presentCVDocumentPreview(profile: profile, template: template)
|
|
self.presentCVDocumentPreview(profile: profile, template: template)
|
|
|
}
|
|
}
|
|
|
cvFilledPreviewPageView.onDismiss = { [weak self] in
|
|
cvFilledPreviewPageView.onDismiss = { [weak self] in
|