Skip to main content

codetether_agent/tui/ui/inspector/
layout.rs

1use ratatui::{
2    Frame,
3    layout::{Constraint, Direction, Layout, Rect},
4    style::{Color, Style},
5    text::Line,
6    widgets::{Block, Borders, Paragraph},
7};
8
9use crate::tui::app::state::AppState;
10
11use super::{metrics::render_metrics, tool_history::render_tool_history};
12
13pub fn render_inspector(f: &mut Frame, state: &AppState) {
14    let area = f.area();
15    let outer = Block::default()
16        .borders(Borders::ALL)
17        .title(" Inspector ")
18        .title_style(Style::default().fg(Color::Cyan));
19    let inner = outer.inner(area);
20    f.render_widget(outer, area);
21
22    let chunks = Layout::default()
23        .direction(Direction::Vertical)
24        .constraints([Constraint::Length(8), Constraint::Min(6)])
25        .split(inner);
26
27    render_metrics(f, state, chunks[0]);
28    render_tool_history(f, state, chunks[1]);
29
30    render_footer(f, state, area);
31}
32
33fn render_footer(f: &mut Frame, state: &AppState, area: Rect) {
34    let footer = Layout::default()
35        .direction(Direction::Vertical)
36        .constraints([Constraint::Min(1), Constraint::Length(1)])
37        .split(area);
38
39    let help = Paragraph::new(Line::styled(
40        format!(
41            " Esc: back to chat │ Model: {} ",
42            state.last_completion_model.as_deref().unwrap_or("auto")
43        ),
44        Style::default().fg(Color::DarkGray),
45    ));
46    f.render_widget(help, footer[1]);
47}