better layout code
This commit is contained in:
parent
2a3eee895d
commit
2f88b3b2c2
2 changed files with 9 additions and 20 deletions
|
@ -266,26 +266,17 @@ static LOGGING_MENU: LazyLock<Line> = LazyLock::new(|| {
|
||||||
|
|
||||||
impl Widget for &App {
|
impl Widget for &App {
|
||||||
fn render(self, area: Rect, buf: &mut Buffer) {
|
fn render(self, area: Rect, buf: &mut Buffer) {
|
||||||
let [top, _middle, bottom] =
|
let main_layout =
|
||||||
Layout::vertical([Constraint::Min(5), Constraint::Min(10), Constraint::Min(3)])
|
Layout::vertical([Constraint::Min(5), Constraint::Min(10), Constraint::Min(3)]);
|
||||||
.split(area)
|
let [top, _middle, bottom] = main_layout.areas(area);
|
||||||
.as_array()
|
|
||||||
.cloned()
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let [footer_left, footer_right] =
|
let footer_layout =
|
||||||
Layout::horizontal([Constraint::Percentage(30), Constraint::Percentage(70)])
|
Layout::horizontal([Constraint::Percentage(30), Constraint::Percentage(70)]);
|
||||||
.split(bottom)
|
let [footer_left, footer_right] = footer_layout.areas(bottom);
|
||||||
.as_array()
|
|
||||||
.cloned()
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let [_header_left, header_right] =
|
let header_layout =
|
||||||
Layout::horizontal([Constraint::Percentage(50), Constraint::Percentage(50)])
|
Layout::horizontal([Constraint::Percentage(50), Constraint::Percentage(50)]);
|
||||||
.split(top)
|
let [_header_left, header_right] = header_layout.areas(top);
|
||||||
.as_array()
|
|
||||||
.cloned()
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let mode = self.screen.last().unwrap();
|
let mode = self.screen.last().unwrap();
|
||||||
match mode {
|
match mode {
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#![feature(slice_as_array)]
|
|
||||||
|
|
||||||
use frontend::App;
|
use frontend::App;
|
||||||
use joecalsend::{Config, error, models::Device};
|
use joecalsend::{Config, error, models::Device};
|
||||||
use local_ip_address::local_ip;
|
use local_ip_address::local_ip;
|
||||||
|
|
Loading…
Reference in a new issue