From a65c861dbe376e1f0d21f1a47527bef7fa2ed07d Mon Sep 17 00:00:00 2001 From: Badr Date: Thu, 26 Sep 2024 19:43:43 +0200 Subject: [PATCH] render no alert message --- oryx-tui/src/alerts/alert.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/oryx-tui/src/alerts/alert.rs b/oryx-tui/src/alerts/alert.rs index ac217dc..e305902 100644 --- a/oryx-tui/src/alerts/alert.rs +++ b/oryx-tui/src/alerts/alert.rs @@ -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, }; @@ -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; }