Skip to content

Commit

Permalink
render no alert message
Browse files Browse the repository at this point in the history
  • Loading branch information
pythops committed Sep 26, 2024
1 parent caf61a1 commit a65c861
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion oryx-tui/src/alerts/alert.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use ratatui::{
layout::{Alignment, Constraint, Direction, Layout, Margin, Rect},
style::{Color, Style, Stylize},
text::{Line, Span},
text::{Line, Span, Text},
widgets::{Block, BorderType, Borders, Padding},
Frame,
};
Expand Down Expand Up @@ -73,6 +73,19 @@ impl Alert {
);

if !self.detected {
let text_block = Layout::default()
.direction(Direction::Vertical)
.constraints([
Constraint::Fill(1),
Constraint::Length(3),
Constraint::Fill(1),
])
.flex(ratatui::layout::Flex::SpaceBetween)
.margin(2)
.split(block)[1];

let text = Text::from("No alerts").bold().centered();
frame.render_widget(text, text_block);
return;
}

Expand Down

0 comments on commit a65c861

Please sign in to comment.