|
|
@@ -102,6 +102,7 @@ final class DashboardView: NSView, NSTextFieldDelegate {
|
|
|
WelcomeSparkleClusterView(iconWell: Theme.welcomeHeroIconWell, tint: Theme.welcomeHeroHeadingBlue)
|
|
|
}()
|
|
|
private let featureCardsRow = NSStackView()
|
|
|
+ private let clearChatButton = NSButton(title: "Clear chat", target: nil, action: nil)
|
|
|
private let chatScrollView = NSScrollView()
|
|
|
private let chatDocumentView = JobListingsDocumentView()
|
|
|
private let chatStack = NSStackView()
|
|
|
@@ -322,6 +323,26 @@ final class DashboardView: NSView, NSTextFieldDelegate {
|
|
|
mainOverlay.addArrangedSubview(featureCardsRow)
|
|
|
mainOverlay.addArrangedSubview(midSpacer)
|
|
|
mainOverlay.addArrangedSubview(chatTopSpacer)
|
|
|
+
|
|
|
+ let chatHeaderRow = NSStackView()
|
|
|
+ chatHeaderRow.orientation = .horizontal
|
|
|
+ chatHeaderRow.spacing = 8
|
|
|
+ chatHeaderRow.alignment = .centerY
|
|
|
+ chatHeaderRow.distribution = .fill
|
|
|
+ chatHeaderRow.translatesAutoresizingMaskIntoConstraints = false
|
|
|
+ let chatHeaderLeadingSpacer = NSView()
|
|
|
+ chatHeaderLeadingSpacer.translatesAutoresizingMaskIntoConstraints = false
|
|
|
+ chatHeaderLeadingSpacer.setContentHuggingPriority(.defaultLow, for: .horizontal)
|
|
|
+ clearChatButton.translatesAutoresizingMaskIntoConstraints = false
|
|
|
+ clearChatButton.bezelStyle = .rounded
|
|
|
+ clearChatButton.font = .systemFont(ofSize: 12, weight: .medium)
|
|
|
+ clearChatButton.target = self
|
|
|
+ clearChatButton.action = #selector(didTapClearChat)
|
|
|
+ clearChatButton.toolTip = "Remove all messages and start a new conversation"
|
|
|
+ clearChatButton.setContentHuggingPriority(.required, for: .horizontal)
|
|
|
+ chatHeaderRow.addArrangedSubview(chatHeaderLeadingSpacer)
|
|
|
+ chatHeaderRow.addArrangedSubview(clearChatButton)
|
|
|
+ mainOverlay.addArrangedSubview(chatHeaderRow)
|
|
|
mainOverlay.addArrangedSubview(chatScrollView)
|
|
|
mainOverlay.addArrangedSubview(chatBottomSpacer)
|
|
|
mainOverlay.addArrangedSubview(searchBarShadowHost)
|
|
|
@@ -368,6 +389,7 @@ final class DashboardView: NSView, NSTextFieldDelegate {
|
|
|
|
|
|
searchBarShadowHost.widthAnchor.constraint(equalTo: mainOverlay.widthAnchor, multiplier: 0.92),
|
|
|
featureCardsRow.widthAnchor.constraint(equalTo: mainOverlay.widthAnchor, multiplier: 0.92),
|
|
|
+ chatHeaderRow.widthAnchor.constraint(equalTo: mainOverlay.widthAnchor, multiplier: 0.92),
|
|
|
chatScrollView.widthAnchor.constraint(equalTo: mainOverlay.widthAnchor, multiplier: 0.92),
|
|
|
|
|
|
welcomeHeroHost.leadingAnchor.constraint(equalTo: mainOverlay.leadingAnchor),
|
|
|
@@ -1562,9 +1584,14 @@ final class DashboardView: NSView, NSTextFieldDelegate {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /// Restores the main job-search experience: cleared query and a fresh chat history.
|
|
|
+ /// Restores the main job-search field when returning to Home; chat history is kept until the user chooses **Clear chat**.
|
|
|
private func applyHomeState() {
|
|
|
jobKeywordsField.stringValue = ""
|
|
|
+ window?.makeFirstResponder(nil)
|
|
|
+ }
|
|
|
+
|
|
|
+ @objc private func didTapClearChat() {
|
|
|
+ guard !isAwaitingResponse else { return }
|
|
|
resetChatState()
|
|
|
window?.makeFirstResponder(nil)
|
|
|
}
|
|
|
@@ -2092,6 +2119,8 @@ final class DashboardView: NSView, NSTextFieldDelegate {
|
|
|
jobKeywordsField.isEnabled = enabled
|
|
|
findJobsButton.isEnabled = enabled
|
|
|
findJobsButton.alphaValue = enabled ? 1 : 0.65
|
|
|
+ clearChatButton.isEnabled = enabled
|
|
|
+ clearChatButton.alphaValue = enabled ? 1 : 0.65
|
|
|
trailingLoadMoreJobsButton?.isEnabled = enabled
|
|
|
trailingLoadMoreJobsButton?.alphaValue = enabled ? 1 : 0.65
|
|
|
}
|