Adjust openweathermap layout
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Isaac Mills 2025-07-28 18:10:37 -06:00
parent 4d251067c8
commit 55c0912608
Signed by: fnmain
GPG key ID: B67D7410F33A0F61

View file

@ -203,7 +203,7 @@ impl<E: AppExecutor> App<E> {
}
pub fn draw_first_tab(&mut self, frame: &mut Frame, layout_outer: Rect) {
let layout = Layout::new(
let first_tab_layout = Layout::new(
if layout_outer.width < (layout_outer.height * 2) {
Direction::Vertical
} else {
@ -212,6 +212,7 @@ impl<E: AppExecutor> App<E> {
[Constraint::Ratio(1, 2), Constraint::Ratio(1, 2)],
)
.split(layout_outer);
let weather_area = first_tab_layout[0];
if let Some(weather) = self.weather.get() {
frame.render_widget(
Block::new()
@ -219,14 +220,14 @@ impl<E: AppExecutor> App<E> {
.borders(Borders::all())
.fg(Color::Rgb(226, 190, 89))
.bg(Color::Black),
layout[0],
weather_area,
);
let layout = Layout::new(
Direction::Vertical,
[Constraint::Length(12), Constraint::Min(0)],
)
.split(layout[0].inner(Margin::new(2, 2)));
.split(weather_area.inner(Margin::new(2, 2)));
let layout_upper = Layout::new(
Direction::Horizontal,
@ -262,14 +263,11 @@ impl<E: AppExecutor> App<E> {
))
.fg(Color::Rgb(226, 190, 89))
.bg(Color::Black),
layout_upper[1],
);
frame.render_widget(
Block::new()
.borders(Borders::all())
.fg(Color::Rgb(226, 190, 89))
.bg(Color::Black),
layout[1],
if weather_area.width < (weather_area.height * 2) {
layout[1]
} else {
layout_upper[1]
},
);
} else {
frame.render_widget(
@ -278,7 +276,7 @@ impl<E: AppExecutor> App<E> {
.fg(Color::Rgb(226, 190, 89))
.bg(Color::Black)
.block(Block::new().title("Weather").borders(Borders::all())),
layout[0],
weather_area,
);
}
frame.render_widget(
@ -287,7 +285,7 @@ impl<E: AppExecutor> App<E> {
.fg(Color::Rgb(226, 190, 89))
.bg(Color::Black)
.block(Block::new().borders(Borders::all())),
layout[1],
first_tab_layout[1],
);
}