use ratatui::{
layout::Rect,
style::{Color, Modifier, Style},
text::{Line, Span},
widgets::Paragraph,
Frame,
};
use crate::app::ActiveView;
const KEY_STYLE: Style = Style::new().fg(Color::Yellow).add_modifier(Modifier::BOLD);
const DESC_STYLE: Style = Style::new().fg(Color::DarkGray);
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);
}