pub mod diagnostics;
pub mod gauge;
pub mod graph;
pub mod history_view;
pub mod layout;
pub mod theme;
pub mod widgets;
use ratatui::prelude::*;
pub use theme::{Theme, ThemeName};
pub fn render(frame: &mut Frame, app: &crate::app::App) {
let theme = app.get_theme();
let area = frame.area();
frame.render_widget(
ratatui::widgets::Block::default().style(Style::default().bg(theme.background)),
area,
);
let chunks = layout::create_main_layout(area);
layout::render_header(frame, chunks[0], app, &theme);
match app.current_view {
crate::app::View::Main => {
layout::render_main_view(frame, chunks[1], app, &theme);
}
crate::app::View::History => {
history_view::render(frame, chunks[1], app, &theme);
}
crate::app::View::Diagnostics => {
diagnostics::render(frame, chunks[1], app, &theme);
}
crate::app::View::Settings => {
layout::render_settings_view(frame, chunks[1], app, &theme);
}
}
layout::render_footer(frame, chunks[2], app, &theme);
if app.show_provider_popup {
widgets::render_provider_popup(frame, app, &theme);
}
if app.show_theme_popup {
widgets::render_theme_popup(frame, app, &theme);
}
if app.show_help_popup {
widgets::render_help_popup(frame, &theme);
}
if app.show_results_popup {
widgets::render_results_popup(frame, app, &theme);
}
}