Pass application context to GUI. #11

Merged
shaunrd0 merged 9 commits from app-context into main 2026-01-31 04:25:16 +00:00
2 changed files with 25 additions and 25 deletions
Showing only changes of commit a75dad7985 - Show all commits

View File

@ -1,4 +1,3 @@
use log::info;
use ratatui::buffer::Buffer;
use ratatui::layout::{Constraint, Direction, Layout, Rect};
use ratatui::text::{Line, Span};
@ -21,14 +20,6 @@ impl Widget for About {
where
Self: Sized,
{
let kilroy_rect = Rect {
x: area.x,
y: area.y + 8,
width: 85,
height: 35,
};
info!(target: About::ID, "Created rect: {kilroy_rect:?}");
let chunks = Layout::default()
.direction(Direction::Vertical)
.constraints([
@ -40,9 +31,17 @@ impl Widget for About {
" * ",
" |.===. ",
" {}o o{} ",
"-----------------------ooO--(_)--Ooo---------------------------",
"-ooO--(_)--Ooo",
"CLIDE WAS HERE",
];
let kilroy_rect = Rect {
x: area.x,
y: area.y + 7,
width: area.width,
height: kilroy.len() as u16,
};
// info!(target: About::ID, "Created rect: {kilroy_rect:?}");
let kilroy_lines: Vec<Line> = kilroy.iter().map(|l| Line::from(Span::raw(*l))).collect();
let about_text = [
"Clide",
@ -65,16 +64,8 @@ impl Widget for About {
.map(|l| Line::from(Span::raw(*l)))
.collect();
Clear::default().render(area, buf);
Paragraph::new(kilroy_lines)
.block(
Block::default()
.borders(Borders::NONE)
.padding(Padding::bottom(0)),
)
.wrap(Wrap { trim: false })
.centered()
.render(kilroy_rect, buf);
Clear::default().render(kilroy_rect, buf);
Clear::default().render(chunks[1], buf);
Paragraph::new(about_lines)
.block(
Block::default()
@ -84,5 +75,14 @@ impl Widget for About {
)
.wrap(Wrap { trim: false })
.render(chunks[1], buf);
Paragraph::new(kilroy_lines)
.block(
Block::default()
.borders(Borders::NONE)
.padding(Padding::bottom(0)),
)
.wrap(Wrap { trim: false })
.centered()
.render(kilroy_rect, buf);
}
}

View File

@ -230,7 +230,7 @@ impl<'a> Widget for &mut App<'a> {
}
if self.about {
let about_area = area.centered(Constraint::Percentage(40), Constraint::Percentage(60));
let about_area = area.centered(Constraint::Percentage(40), Constraint::Percentage(50));
About::new().render(about_area, buf);
}
}