codetether_agent/tui/ui/chat_view/status_text.rs
1//! Status text span (yellow when processing, green when idle).
2
3use ratatui::{
4 style::{Color, Style},
5 text::Span,
6};
7
8use crate::tui::app::state::App;
9
10/// Status text colored yellow (processing) or green (idle).
11///
12/// # Examples
13///
14/// ```rust,no_run
15/// use codetether_agent::tui::ui::chat_view::status_text::status_text_span;
16/// # fn demo(app: &codetether_agent::tui::app::state::App) {
17/// let span = status_text_span(app);
18/// assert!(!span.content.is_empty() || app.state.status.is_empty());
19/// # }
20/// ```
21pub fn status_text_span(app: &App) -> Span<'static> {
22 Span::styled(
23 app.state.status.clone(),
24 Style::default().fg(if app.state.processing {
25 Color::Yellow
26 } else {
27 Color::Green
28 }),
29 )
30}