Reorganize repository

This commit is contained in:
2026-01-23 20:29:44 +01:00
parent 1433e07066
commit a1ddb4a170
40 changed files with 372 additions and 257084 deletions

View File

@@ -0,0 +1,60 @@
use ratatui::layout::{Alignment, Constraint, Layout, Rect};
use ratatui::style::{Color, Style};
use ratatui::text::{Line, Span};
use ratatui::widgets::Paragraph;
use ratatui::Frame;
use super::ModalFrame;
pub struct ConfirmModal<'a> {
title: &'a str,
message: &'a str,
selected: bool,
}
impl<'a> ConfirmModal<'a> {
pub fn new(title: &'a str, message: &'a str, selected: bool) -> Self {
Self {
title,
message,
selected,
}
}
pub fn render_centered(self, frame: &mut Frame, term: Rect) {
let inner = ModalFrame::new(self.title)
.width(30)
.height(5)
.border_color(Color::Yellow)
.render_centered(frame, term);
let rows = Layout::vertical([Constraint::Length(1), Constraint::Length(1)]).split(inner);
frame.render_widget(
Paragraph::new(self.message).alignment(Alignment::Center),
rows[0],
);
let yes_style = if self.selected {
Style::new().fg(Color::Black).bg(Color::Yellow)
} else {
Style::default()
};
let no_style = if !self.selected {
Style::new().fg(Color::Black).bg(Color::Yellow)
} else {
Style::default()
};
let buttons = Line::from(vec![
Span::styled(" Yes ", yes_style),
Span::raw(" "),
Span::styled(" No ", no_style),
]);
frame.render_widget(
Paragraph::new(buttons).alignment(Alignment::Center),
rows[1],
);
}
}