Open panels above the notch; chat paperclip and in-chat file drop

- NSOpenPanel opened from BroV appeared under the notch (BroV floats above the menu
  bar): presentAboveNotch shows it one level higher, non-modally. Used by the terminal
  paperclip, the chat paperclip and the chat folder picker in Settings.
- Chat: paperclip next to the input attaches a file; dropping a file over the open
  chat attaches it directly instead of the shelf animation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
maksarsanjeev
2026-10-10 01:48:12 +03:00
parent 817c837f5a
commit 9ebc4552c0
5 changed files with 50 additions and 6 deletions
@@ -1253,6 +1253,14 @@ struct PromptView: View {
.padding(.horizontal, 10)
HStack(spacing: 8) {
Button(action: attachFile) {
Image(systemName: "paperclip")
.font(.system(size: 12, weight: .semibold))
.foregroundColor(Color(hex: state.promptContext == nil ? "#8E939C" : "#D97757"))
}
.buttonStyle(.plain)
.help("Прикрепить файл (или перетащи его в чат)")
TextField(state.chatHistory.isEmpty ? "Спроси что угодно…" : "Продолжить…", text: $text)
.textFieldStyle(.plain)
.font(.system(size: 13))
@@ -1303,6 +1311,19 @@ struct PromptView: View {
}
}
private func attachFile() {
let panel = NSOpenPanel()
panel.canChooseFiles = true
panel.canChooseDirectories = false
panel.allowsMultipleSelection = false
panel.prompt = "Прикрепить"
panel.presentAboveNotch { urls in
guard let url = urls.first else { return }
state.promptContext = .file(name: url.lastPathComponent, fileURL: url)
focused = true
}
}
private func sendMessage() {
let query = text.trimmingCharacters(in: .whitespacesAndNewlines)
guard !query.isEmpty else { return }