llm-manager 1.10.0

Terminal UI for managing LLMs
Documentation
use ratatui::{
    Frame,
    layout::{Constraint, Layout, Rect},
    style::Style,
    text::{Line, Span},
    widgets::{Block, BorderType, Borders, Paragraph, Wrap},
};

use crate::tui::app::App;
use crate::tui::colors::*;

pub fn render_panel(f: &mut Frame, area: Rect, app: &App) {
    let chunks = Layout::default()
        .direction(ratatui::layout::Direction::Vertical)
        .constraints([
            Constraint::Length(2), // title
            Constraint::Fill(1),   // scrollable content
            Constraint::Length(1), // footer
        ])
        .split(area);

    // Title
    let title = Paragraph::new(Line::from(vec![
        Span::styled("Help", *TITLE),
        Span::raw(" โ€” "),
        Span::styled("โŽ‹ to close", *DIM_TEXT),
    ]))
    .block(
        Block::default()
            .borders(Borders::ALL)
            .title(" ")
            .border_type(BorderType::Double)
            .border_style(*BORDER_FOCUSED),
    )
    .style(Style::default().fg(WHITE));
    f.render_widget(title, chunks[0]);

    // Scrollable content
    let lines = app.panel_help_lines();
    let paragraph = Paragraph::new(lines)
        .block(
            Block::default()
                .borders(Borders::ALL)
                .title(" ")
                .border_type(BorderType::Double)
                .border_style(*BORDER_FOCUSED),
        )
        .wrap(Wrap { trim: true })
        .scroll((app.ui.panel_help_offset as u16, 0));
    f.render_widget(paragraph, chunks[1]);

    // Footer
    let footer = Paragraph::new("j/k scroll ยท โŽ‹ close").style(Style::default().fg(DIM_GRAY));
    f.render_widget(footer, chunks[2]);
}