mod chain;
mod detail;
mod footer;
mod format;
mod header;
mod modals;
mod overview;
mod toasts;
use ratatui::Frame;
use ratatui::layout::{Constraint, Direction, Layout};
use ratatui::widgets::Block;
use super::app::{App, Screen};
use super::theme;
pub(super) const LOGO_HEIGHT: u16 = 3;
pub(crate) fn draw(frame: &mut Frame<'_>, app: &App) {
let area = frame.area();
let background = Block::default().style(theme::base());
frame.render_widget(background, area);
let chunks = Layout::default()
.direction(Direction::Vertical)
.constraints([
Constraint::Length(LOGO_HEIGHT),
Constraint::Min(5),
Constraint::Length(1),
])
.split(area);
header::draw(frame, chunks[0], app);
match app.screen {
Screen::Overview => overview::draw(frame, chunks[1], app),
Screen::Chain => chain::draw(frame, chunks[1], app),
Screen::ProfileDetail { profile_index } => {
detail::draw(frame, chunks[1], app, profile_index)
}
}
footer::draw(frame, chunks[2], app);
toasts::draw(frame, area, app);
if let Some(modal) = app.modals.last() {
modals::draw(frame, area, app, modal);
}
}