Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add spacing before and after for tui titles #706

Merged
merged 4 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tui/src/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ 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).title(" Search "))
.style(Style::default().fg(search_color));

//Render the search bar (First chunk of the screen)
Expand Down
2 changes: 1 addition & 1 deletion tui/src/running_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl FloatContent for RunningCommand {

title_line.push_span(
Span::default()
.content(" press <ENTER> to close this window ")
.content(" Press <ENTER> to close this window ")
.style(Style::default()),
);

Expand Down
16 changes: 8 additions & 8 deletions tui/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use ratatui::{

const MIN_WIDTH: u16 = 77;
const MIN_HEIGHT: u16 = 19;
const TITLE: &str = concat!("Linux Toolbox - ", env!("BUILD_DATE"));
const TITLE: &str = concat!(" Linux Toolbox - ", env!("BUILD_DATE"), " ");
const ACTIONS_GUIDE: &str = "List of important tasks performed by commands' names:

D - disk modifications (ex. partitioning) (privileged)
Expand Down Expand Up @@ -56,7 +56,7 @@ pub struct AppState {
selected_commands: Vec<Command>,
drawable: bool,
#[cfg(feature = "tips")]
tip: &'static str,
tip: String,
}

pub enum Focus {
Expand Down Expand Up @@ -357,17 +357,17 @@ impl AppState {
};

let title = if self.multi_select {
&format!("{} [Multi-Select]", TITLE)
&format!("{}[Multi-Select] ", TITLE)
} else {
TITLE
};

#[cfg(feature = "tips")]
let bottom_title = Line::from(self.tip.bold().blue()).right_aligned();
let bottom_title = Line::from(self.tip.clone().bold().blue()).right_aligned();
jeevithakannan2 marked this conversation as resolved.
Show resolved Hide resolved
#[cfg(not(feature = "tips"))]
let bottom_title = "";

let task_list_title = Line::from("Important Actions ").right_aligned();
let task_list_title = Line::from(" Important Actions ").right_aligned();

// Create the list widget with items
let list = List::new(items)
Expand Down Expand Up @@ -686,13 +686,13 @@ impl AppState {
const TIPS: &str = include_str!("../cool_tips.txt");

#[cfg(feature = "tips")]
fn get_random_tip() -> &'static str {
fn get_random_tip() -> String {
let tips: Vec<&str> = TIPS.lines().collect();
if tips.is_empty() {
return "";
return "".to_string();
}

let mut rng = rand::thread_rng();
let random_index = rng.gen_range(0..tips.len());
tips[random_index]
format!(" {} ", tips[random_index])
}