diff --git a/WorterBuch/NotesListView.swift b/WorterBuch/NotesListView.swift index 8b43044..c1a8a6c 100644 --- a/WorterBuch/NotesListView.swift +++ b/WorterBuch/NotesListView.swift @@ -175,6 +175,7 @@ struct NoteEditorContentView: View { @ObservedObject var note: Note @Environment(\.managedObjectContext) private var viewContext let onAddNote: () -> Void + @State private var showTranscription = false var body: some View { VStack(spacing: 0) { @@ -194,6 +195,17 @@ struct NoteEditorContentView: View { Spacer() + Button(action: { + withAnimation { + showTranscription.toggle() + } + }) { + Image(systemName: showTranscription ? "text.bubble.fill" : "text.bubble") + .font(.body) + .foregroundColor(showTranscription ? .blue : .primary) + } + .padding(.trailing, 8) + Button(action: onAddNote) { Image(systemName: "plus") .font(.body) @@ -219,7 +231,8 @@ struct NoteEditorContentView: View { // Note editor content NoteEditorContentOnly( drawing: bindingForDrawing(), - text: bindingForText() + text: bindingForText(), + showTranscription: $showTranscription ) } .background(Color(.systemGroupedBackground)) @@ -258,9 +271,9 @@ struct NoteEditorContentView: View { struct NoteEditorContentOnly: View { @Binding var drawing: PKDrawing @Binding var text: String + @Binding var showTranscription: Bool @State private var isRecognizing = false - @State private var showTranscription = false @State private var viewAppeared = false @State private var recognitionWorkItem: DispatchWorkItem? @@ -334,24 +347,6 @@ struct NoteEditorContentOnly: View { .padding() .transition(.move(edge: .bottom).combined(with: .opacity)) } - - // Toggle transcription button - if !showTranscription { - Button(action: { - withAnimation { - showTranscription = true - } - }) { - HStack { - Image(systemName: "text.bubble") - Text("Show Transcription") - } - .font(.subheadline) - .foregroundColor(.blue) - .padding(.vertical, 8) - } - .padding(.bottom) - } } }