From 7057ccb607d99ff96265f78a161a10b3e47dbe47 Mon Sep 17 00:00:00 2001 From: Sven Date: Wed, 22 Apr 2026 06:22:02 +0200 Subject: [PATCH] =?UTF-8?q?Gespr=C3=A4chsvorschl=C3=A4ge:=20=C3=9Cbernehme?= =?UTF-8?q?n-Button=20pro=20Sektion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Jede der drei Vorschlags-Sektionen hat jetzt einen kleinen Button (Pfeil-Icon), der den jeweiligen Text ins Notizfeld übernimmt. Kurzes Checkmark-Feedback zeigt die erfolgreiche Übernahme an. Co-Authored-By: Claude Sonnet 4.6 --- nahbar/nahbar/AddMomentView.swift | 34 ++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/nahbar/nahbar/AddMomentView.swift b/nahbar/nahbar/AddMomentView.swift index 2997ef4..95db431 100644 --- a/nahbar/nahbar/AddMomentView.swift +++ b/nahbar/nahbar/AddMomentView.swift @@ -37,6 +37,7 @@ struct AddMomentView: View { @State private var conversationState: ConversationSuggestionUIState = .idle @State private var showConversationPaywall = false @State private var showConversationConsent = false + @State private var insertedSectionKey: String? = nil // für kurzes Checkmark-Feedback // Vorhaben: Erinnerung @State private var addReminder = false @@ -558,11 +559,11 @@ struct AddMomentView: View { private func conversationResultView(result: ConversationSuggestionResult) -> some View { VStack(alignment: .leading, spacing: 0) { - conversationSection(icon: "text.bubble", title: "Themenvorschläge", text: result.topics) + conversationSection(icon: "text.bubble", title: "Themenvorschläge", sectionKey: "topics", content: result.topics) RowDivider() - conversationSection(icon: "lifepreserver", title: "Gesprächsretter", text: result.rescue) + conversationSection(icon: "lifepreserver", title: "Gesprächsretter", sectionKey: "rescue", content: result.rescue) RowDivider() - conversationSection(icon: "arrow.down.heart", title: "Tiefe erreichen", text: result.depth) + conversationSection(icon: "arrow.down.heart", title: "Tiefe erreichen", sectionKey: "depth", content: result.depth) RowDivider() Button { Task { await loadConversationSuggestions() } @@ -578,7 +579,7 @@ struct AddMomentView: View { } } - private func conversationSection(icon: String, title: String, text: String) -> some View { + private func conversationSection(icon: String, title: String, sectionKey: String, content: String) -> some View { HStack(alignment: .top, spacing: 12) { Image(systemName: icon) .font(.system(size: 13)) @@ -589,16 +590,39 @@ struct AddMomentView: View { Text(LocalizedStringKey(title)) .font(.system(size: 13, weight: .semibold)) .foregroundStyle(theme.contentSecondary) - Text(text) + Text(content) .font(.system(size: 14, design: theme.displayDesign)) .foregroundStyle(theme.contentPrimary) .fixedSize(horizontal: false, vertical: true) } + Spacer(minLength: 8) + // Übernehmen-Button + Button { + appendSuggestion(content, key: sectionKey) + } label: { + Image(systemName: insertedSectionKey == sectionKey ? "checkmark" : "arrow.up.doc") + .font(.system(size: 13)) + .foregroundStyle(insertedSectionKey == sectionKey ? theme.accent : theme.contentTertiary) + .frame(width: 28, height: 28) + .contentShape(Rectangle()) + .animation(.easeInOut(duration: 0.2), value: insertedSectionKey) + } + .buttonStyle(.plain) + .padding(.top, 2) } .padding(.horizontal, 16) .padding(.vertical, 12) } + private func appendSuggestion(_ content: String, key: String) { + let prefix = text.isEmpty ? "" : "\n\n" + text += prefix + content + withAnimation { insertedSectionKey = key } + DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) { + withAnimation { insertedSectionKey = nil } + } + } + private func conversationErrorView(message: String) -> some View { VStack(alignment: .leading, spacing: 8) { Label("Vorschläge fehlgeschlagen", systemImage: "exclamationmark.triangle")