Gesprächsvorschläge: Übernehmen-Button pro Sektion
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 <noreply@anthropic.com>
This commit is contained in:
@@ -37,6 +37,7 @@ struct AddMomentView: View {
|
|||||||
@State private var conversationState: ConversationSuggestionUIState = .idle
|
@State private var conversationState: ConversationSuggestionUIState = .idle
|
||||||
@State private var showConversationPaywall = false
|
@State private var showConversationPaywall = false
|
||||||
@State private var showConversationConsent = false
|
@State private var showConversationConsent = false
|
||||||
|
@State private var insertedSectionKey: String? = nil // für kurzes Checkmark-Feedback
|
||||||
|
|
||||||
// Vorhaben: Erinnerung
|
// Vorhaben: Erinnerung
|
||||||
@State private var addReminder = false
|
@State private var addReminder = false
|
||||||
@@ -558,11 +559,11 @@ struct AddMomentView: View {
|
|||||||
|
|
||||||
private func conversationResultView(result: ConversationSuggestionResult) -> some View {
|
private func conversationResultView(result: ConversationSuggestionResult) -> some View {
|
||||||
VStack(alignment: .leading, spacing: 0) {
|
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()
|
RowDivider()
|
||||||
conversationSection(icon: "lifepreserver", title: "Gesprächsretter", text: result.rescue)
|
conversationSection(icon: "lifepreserver", title: "Gesprächsretter", sectionKey: "rescue", content: result.rescue)
|
||||||
RowDivider()
|
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()
|
RowDivider()
|
||||||
Button {
|
Button {
|
||||||
Task { await loadConversationSuggestions() }
|
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) {
|
HStack(alignment: .top, spacing: 12) {
|
||||||
Image(systemName: icon)
|
Image(systemName: icon)
|
||||||
.font(.system(size: 13))
|
.font(.system(size: 13))
|
||||||
@@ -589,16 +590,39 @@ struct AddMomentView: View {
|
|||||||
Text(LocalizedStringKey(title))
|
Text(LocalizedStringKey(title))
|
||||||
.font(.system(size: 13, weight: .semibold))
|
.font(.system(size: 13, weight: .semibold))
|
||||||
.foregroundStyle(theme.contentSecondary)
|
.foregroundStyle(theme.contentSecondary)
|
||||||
Text(text)
|
Text(content)
|
||||||
.font(.system(size: 14, design: theme.displayDesign))
|
.font(.system(size: 14, design: theme.displayDesign))
|
||||||
.foregroundStyle(theme.contentPrimary)
|
.foregroundStyle(theme.contentPrimary)
|
||||||
.fixedSize(horizontal: false, vertical: true)
|
.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(.horizontal, 16)
|
||||||
.padding(.vertical, 12)
|
.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 {
|
private func conversationErrorView(message: String) -> some View {
|
||||||
VStack(alignment: .leading, spacing: 8) {
|
VStack(alignment: .leading, spacing: 8) {
|
||||||
Label("Vorschläge fehlgeschlagen", systemImage: "exclamationmark.triangle")
|
Label("Vorschläge fehlgeschlagen", systemImage: "exclamationmark.triangle")
|
||||||
|
|||||||
Reference in New Issue
Block a user