|
|
@@ -136,8 +136,8 @@ final class DashboardView: NSView, NSTextFieldDelegate {
|
|
136
|
136
|
private var isProfileEditorPresented = false
|
|
137
|
137
|
/// When true, the merged CV preview is visible instead of the profiles list or editor.
|
|
138
|
138
|
private var isCVDocumentPreviewPresented = false
|
|
139
|
|
- /// Template id chosen in CV Maker until the user leaves Profile or starts a new CV Maker hand-off.
|
|
140
|
|
- private var pendingCVTemplateID: String?
|
|
|
139
|
+ /// Exact template chosen in CV Maker until the user leaves Profile or starts a new CV Maker hand-off (avoids re-resolving by id and picking a different row).
|
|
|
140
|
+ private var pendingCVTemplate: CVTemplate?
|
|
141
|
141
|
private let cvFilledPreviewPageView = CVFilledPreviewPageView()
|
|
142
|
142
|
|
|
143
|
143
|
private var currentSidebarItems: [SidebarItem] = []
|
|
|
@@ -1344,11 +1344,10 @@ final class DashboardView: NSView, NSTextFieldDelegate {
|
|
1344
|
1344
|
cvMakerPageView.bottomAnchor.constraint(equalTo: cvMakerPageContainer.bottomAnchor)
|
|
1345
|
1345
|
])
|
|
1346
|
1346
|
|
|
1347
|
|
- cvMakerPageView.onContinueToProfileSelection = { [weak self] templateID in
|
|
|
1347
|
+ cvMakerPageView.onContinueToProfileSelection = { [weak self] template in
|
|
1348
|
1348
|
guard let self else { return }
|
|
1349
|
|
- self.pendingCVTemplateID = templateID
|
|
1350
|
|
- let name = self.cvMakerPageView.resolvedTemplate(withID: templateID)?.name ?? "Selected template"
|
|
1351
|
|
- self.profilesListPageView.setPendingCVTemplateDisplayName(name)
|
|
|
1349
|
+ self.pendingCVTemplate = template
|
|
|
1350
|
+ self.profilesListPageView.setPendingCVTemplateDisplayName(template.name)
|
|
1352
|
1351
|
self.selectProfileSidebarForCVMakerFlow()
|
|
1353
|
1352
|
}
|
|
1354
|
1353
|
}
|
|
|
@@ -1400,8 +1399,7 @@ final class DashboardView: NSView, NSTextFieldDelegate {
|
|
1400
|
1399
|
}
|
|
1401
|
1400
|
profilesListPageView.onBuildCVWithProfile = { [weak self] profileID in
|
|
1402
|
1401
|
guard let self,
|
|
1403
|
|
- let tid = self.pendingCVTemplateID,
|
|
1404
|
|
- let template = self.cvMakerPageView.resolvedTemplate(withID: tid),
|
|
|
1402
|
+ let template = self.pendingCVTemplate,
|
|
1405
|
1403
|
let profile = SavedProfilesStore.profile(id: profileID) else { return }
|
|
1406
|
1404
|
self.presentCVDocumentPreview(profile: profile, template: template)
|
|
1407
|
1405
|
}
|
|
|
@@ -1749,7 +1747,7 @@ final class DashboardView: NSView, NSTextFieldDelegate {
|
|
1749
|
1747
|
if !profile {
|
|
1750
|
1748
|
isProfileEditorPresented = false
|
|
1751
|
1749
|
isCVDocumentPreviewPresented = false
|
|
1752
|
|
- pendingCVTemplateID = nil
|
|
|
1750
|
+ pendingCVTemplate = nil
|
|
1753
|
1751
|
profilesListPageView.setPendingCVTemplateDisplayName(nil)
|
|
1754
|
1752
|
cvFilledPreviewPageView.isHidden = true
|
|
1755
|
1753
|
profilesListPageView.isHidden = false
|