// Copyright 2025 David Weikersdorfer

use crate::InspectorModel;
use ratatui::{
    prelude::*,
    widgets::{Paragraph, Widget},
};
use std::{cell::RefCell, sync::Arc};

pub struct HelpView {
    pub model: Arc<RefCell<InspectorModel>>,
}

impl Widget for &HelpView {
    fn render(self, area: Rect, buf: &mut Buffer) {
        let help_text = Text::from(vec![
            Line::from(" q - Quit"),
            Line::from(" ← / → - Switch between tabs"),
            Line::from(" ↑ / ↓ - Move between rows"),
            Line::from(" Enter - Expand / unexpand group"),
            Line::from(" h - Show help"),
        ]);

        let paragraph = Paragraph::new(help_text)
            .alignment(Alignment::Center)
            .block(ratatui::widgets::Block::default().borders(ratatui::widgets::Borders::ALL));

        paragraph.render(area, buf);
    }
}
