ghost-eye/src/components/explorer/layouts.rs
Uncle Stretch 0f9c0aa1f6
more use of generic components
Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
2025-08-26 20:58:30 +03:00

51 lines
1.5 KiB
Rust

use ratatui::layout::{Constraint, Flex, Layout, Rect};
pub fn explorer_layout(area: Rect) -> [Rect; 3] {
Layout::vertical([
Constraint::Percentage(30),
Constraint::Percentage(40),
Constraint::Percentage(30),
]).areas(area)
}
pub fn explorer_header_layout(area: Rect) -> [Rect; 2] {
let [header, _, _] = explorer_layout(area);
Layout::horizontal([
Constraint::Percentage(50),
Constraint::Percentage(50),
]).areas(header)
}
pub fn explorer_info_layout(area: Rect) -> [Rect; 2] {
let [info, _] = explorer_header_layout(area);
Layout::vertical([
Constraint::Percentage(100),
Constraint::Percentage(100),
]).areas(info)
}
pub fn explorer_block_info_layout(area: Rect) -> [Rect; 3] {
let [blocks, _] = explorer_info_layout(area);
Layout::horizontal([
Constraint::Percentage(33),
Constraint::Percentage(33),
Constraint::Percentage(33),
]).flex(Flex::SpaceBetween).areas(blocks)
}
pub fn explorer_era_info_layout(area: Rect) -> [Rect; 2] {
let [_, blocks] = explorer_info_layout(area);
Layout::horizontal([
Constraint::Percentage(50),
Constraint::Percentage(50),
]).flex(Flex::SpaceBetween).areas(blocks)
}
pub fn explorer_scrollbars_layout(area: Rect) -> [Rect; 2] {
let [_, place, _] = explorer_layout(area);
Layout::horizontal([
Constraint::Percentage(50),
Constraint::Percentage(50),
]).areas(place)
}