From c36879e22f6b77ed87d7b3444ada0e86cfe8b167 Mon Sep 17 00:00:00 2001 From: nyx Date: Wed, 6 Nov 2024 15:01:19 -0500 Subject: [PATCH] Implement Rounded corners (#918) * add rounded corners * more * apply rounded corners to script boxes as well --- tui/src/confirmation.rs | 1 + tui/src/filter.rs | 7 ++++++- tui/src/floating_text.rs | 1 + tui/src/running_command.rs | 2 ++ tui/src/state.rs | 37 ++++++++++++++++++++++--------------- 5 files changed, 32 insertions(+), 16 deletions(-) diff --git a/tui/src/confirmation.rs b/tui/src/confirmation.rs index d883fd2f..91d86c28 100644 --- a/tui/src/confirmation.rs +++ b/tui/src/confirmation.rs @@ -60,6 +60,7 @@ impl FloatContent for ConfirmPrompt { fn draw(&mut self, frame: &mut Frame, area: Rect) { let block = Block::default() .borders(Borders::ALL) + .border_set(ratatui::symbols::border::ROUNDED) .title(" Confirm selections ") .title_bottom(" [y] to continue, [n] to abort ") .title_alignment(Alignment::Center) diff --git a/tui/src/filter.rs b/tui/src/filter.rs index 898fee74..0d9920de 100644 --- a/tui/src/filter.rs +++ b/tui/src/filter.rs @@ -123,7 +123,12 @@ impl Filter { //Create the search bar widget let search_bar = Paragraph::new(display_text) - .block(Block::default().borders(Borders::ALL).title(" Search ")) + .block( + Block::default() + .borders(Borders::ALL) + .border_set(ratatui::symbols::border::ROUNDED) + .title(" Search "), + ) .style(Style::default().fg(search_color)); //Render the search bar (First chunk of the screen) diff --git a/tui/src/floating_text.rs b/tui/src/floating_text.rs index c7bb059f..a43361af 100644 --- a/tui/src/floating_text.rs +++ b/tui/src/floating_text.rs @@ -216,6 +216,7 @@ impl FloatContent for FloatingText { // Define the Block with a border and background color let block = Block::default() .borders(Borders::ALL) + .border_set(ratatui::symbols::border::ROUNDED) .title(self.mode_title.clone()) .title_alignment(ratatui::layout::Alignment::Center) .title_style(Style::default().reversed()) diff --git a/tui/src/running_command.rs b/tui/src/running_command.rs index f2471778..e55690fe 100644 --- a/tui/src/running_command.rs +++ b/tui/src/running_command.rs @@ -53,6 +53,7 @@ impl FloatContent for RunningCommand { // Display a block indicating the command is running Block::default() .borders(Borders::ALL) + .border_set(ratatui::symbols::border::ROUNDED) .title_top(Line::from("Running the command....").centered()) .title_style(Style::default().reversed()) .title_bottom(Line::from("Press Ctrl-C to KILL the command")) @@ -80,6 +81,7 @@ impl FloatContent for RunningCommand { Block::default() .borders(Borders::ALL) + .border_set(ratatui::symbols::border::ROUNDED) .title_top(title_line.centered()) }; diff --git a/tui/src/state.rs b/tui/src/state.rs index 058dcc20..2e3933fb 100644 --- a/tui/src/state.rs +++ b/tui/src/state.rs @@ -217,19 +217,19 @@ impl AppState { self.drawable = true; } - let label_block = - Block::default() - .borders(Borders::all()) - .border_set(ratatui::symbols::border::Set { - top_left: " ", - top_right: " ", - bottom_left: " ", - bottom_right: " ", - vertical_left: " ", - vertical_right: " ", - horizontal_top: "*", - horizontal_bottom: "*", - }); + let label_block = Block::default() + .borders(Borders::ALL) + .border_set(ratatui::symbols::border::ROUNDED) + .border_set(ratatui::symbols::border::Set { + top_left: " ", + top_right: " ", + bottom_left: " ", + bottom_right: " ", + vertical_left: " ", + vertical_right: " ", + horizontal_top: "*", + horizontal_bottom: "*", + }); let str1 = "Linutil "; let str2 = "by Chris Titus"; let label = Paragraph::new(Line::from(vec![ @@ -253,7 +253,8 @@ impl AppState { let keybinds_block = Block::default() .title(format!(" {} ", keybind_scope)) - .borders(Borders::all()); + .borders(Borders::ALL) + .border_set(ratatui::symbols::border::ROUNDED); let keybinds = create_shortcut_list(shortcuts, keybind_render_width); let n_lines = keybinds.len() as u16; @@ -297,7 +298,11 @@ impl AppState { }; let list = List::new(tabs) - .block(Block::default().borders(Borders::ALL)) + .block( + Block::default() + .borders(Borders::ALL) + .border_set(ratatui::symbols::border::ROUNDED), + ) .highlight_style(tab_hl_style) .highlight_symbol(self.theme.tab_icon()); frame.render_stateful_widget(list, left_chunks[1], &mut self.current_tab); @@ -409,6 +414,7 @@ impl AppState { .block( Block::default() .borders(Borders::ALL & !Borders::RIGHT) + .border_set(ratatui::symbols::border::ROUNDED) .title(title) .title_bottom(bottom_title), ) @@ -418,6 +424,7 @@ impl AppState { let disclaimer_list = List::new(task_items).highlight_style(style).block( Block::default() .borders(Borders::ALL & !Borders::LEFT) + .border_set(ratatui::symbols::border::ROUNDED) .title(task_list_title), );