use crate::tui::app::state::AppState;
pub fn drain_voice_transcription(state: &mut AppState) {
let slot = match &state.pending_voice_text {
Some(s) => s.clone(),
None => return,
};
let text = match slot.try_lock().ok().and_then(|mut g| g.take()) {
Some(t) => t,
None => return,
};
state.pending_voice_text = None;
if text.is_empty() {
state.status = "Voice transcription produced no text".into();
return;
}
state.insert_text(&text);
state.status = "Voice transcribed ✓".into();
}