agentop 0.2.1

A TUI process inspector for Claude Code and OpenAI Codex CLI — like top for AI coding agents
use ratatui::{
    layout::Rect,
    style::{Color, Modifier, Style},
    text::{Line, Span},
    widgets::Paragraph,
    Frame,
};

use crate::app::ActiveView;

/// Style for key bindings (e.g. "q", "Enter").
const KEY_STYLE: Style = Style::new().fg(Color::Yellow).add_modifier(Modifier::BOLD);

/// Style for the description text following each key (e.g. ": Quit").
const DESC_STYLE: Style = Style::new().fg(Color::DarkGray);

/// Render a one-line footer showing context-sensitive key binding hints.
pub fn render_footer(f: &mut Frame, area: Rect, active_view: &ActiveView) {
    let hints: &[(&str, &str)] = match active_view {
        ActiveView::Tree => &[
            ("q", ": Quit"),
            ("  ↑/↓", ": Navigate"),
            ("  Enter", ": Details"),
            ("  Space", ": Expand"),
            ("  Tab", ": Sort"),
            ("  s", ": Dir"),
            ("  x", ": Kill"),
        ],
        ActiveView::Detail => &[
            ("Esc", ": Back"),
            ("  q", ": Quit"),
            ("  x", ": Kill"),
        ],
    };

    let spans: Vec<Span> = hints
        .iter()
        .flat_map(|(key, desc)| {
            [
                Span::styled(*key, KEY_STYLE),
                Span::styled(*desc, DESC_STYLE),
            ]
        })
        .collect();

    f.render_widget(Paragraph::new(Line::from(spans)), area);
}