2026-07-19 17:05:27 +07:00
|
|
|
//! Overlay: confirm-before-clear dialog for the chat transcript.
|
|
|
|
|
//!
|
|
|
|
|
//! Flow: shows a warning-coloured confirmation prompt; user presses Enter to
|
|
|
|
|
//! confirm or Esc to cancel (handled by the input controller, not this renderer).
|
|
|
|
|
|
2026-07-17 09:03:37 +07:00
|
|
|
use ratatui::style::{Modifier, Style};
|
|
|
|
|
use ratatui::text::{Line, Span};
|
|
|
|
|
use ratatui::widgets::{Block, Paragraph};
|
|
|
|
|
use ratatui::Frame;
|
|
|
|
|
use crate::view::theme::Theme;
|
2026-07-19 17:05:27 +07:00
|
|
|
use tracing;
|
2026-07-17 09:03:37 +07:00
|
|
|
|
2026-07-19 17:05:27 +07:00
|
|
|
/// Render the Clear Transcript confirmation dialog.
|
|
|
|
|
///
|
|
|
|
|
/// This overlay has no interactive state of its own — it just renders the
|
|
|
|
|
/// prompt and instructions; the caller (`controller/input.rs`) interprets
|
|
|
|
|
/// Enter/Esc and applies the action.
|
2026-07-17 09:03:37 +07:00
|
|
|
pub fn render(
|
|
|
|
|
frame: &mut Frame,
|
|
|
|
|
area: ratatui::layout::Rect,
|
|
|
|
|
block: Block<'static>,
|
|
|
|
|
_state: &crate::app::state::rest::AppStateRest,
|
|
|
|
|
) {
|
2026-07-19 17:05:27 +07:00
|
|
|
tracing::debug!("overlay: Clear Confirm");
|
2026-07-17 09:03:37 +07:00
|
|
|
let block = block
|
|
|
|
|
.title(Span::styled(
|
|
|
|
|
" Clear Transcript ",
|
|
|
|
|
Style::default()
|
|
|
|
|
.fg(Theme::WARNING)
|
|
|
|
|
.add_modifier(Modifier::BOLD),
|
|
|
|
|
))
|
|
|
|
|
.border_style(Style::default().fg(Theme::WARNING));
|
|
|
|
|
let lines = vec![
|
|
|
|
|
Line::from(Span::styled(
|
|
|
|
|
" Clear all messages from the transcript?",
|
|
|
|
|
Style::default().fg(Theme::TEXT),
|
|
|
|
|
)),
|
|
|
|
|
Line::from(Span::raw("")),
|
|
|
|
|
Line::from(Span::styled(
|
|
|
|
|
" Enter to confirm · Esc to cancel",
|
|
|
|
|
Style::default().fg(Theme::TEXT_DIM),
|
|
|
|
|
)),
|
|
|
|
|
];
|
|
|
|
|
let paragraph = Paragraph::new(lines).block(block);
|
|
|
|
|
frame.render_widget(paragraph, area);
|
|
|
|
|
}
|