diff --git a/node-launchpad/src/app.rs b/node-launchpad/src/app.rs index 4d90edd2eb..b8a718c5e1 100644 --- a/node-launchpad/src/app.rs +++ b/node-launchpad/src/app.rs @@ -49,10 +49,10 @@ impl App { tick_rate, frame_rate, components: vec![ - Box::new(home), - Box::new(discord_username_input), Box::new(tab), Box::new(footer), + Box::new(home), + Box::new(discord_username_input), ], should_quit: false, should_suspend: false, diff --git a/node-launchpad/src/components/discord_username.rs b/node-launchpad/src/components/discord_username.rs index 15193e6e55..4d4332dcaf 100644 --- a/node-launchpad/src/components/discord_username.rs +++ b/node-launchpad/src/components/discord_username.rs @@ -6,7 +6,7 @@ // KIND, either express or implied. Please review the Licences for the specific language governing // permissions and limitations relating to use of the SAFE Network Software. -use super::{utils::centered_rect, Component}; +use super::{utils::centered_rect_fixed, Component}; use crate::{ action::Action, mode::{InputMode, Scene}, @@ -100,8 +100,7 @@ impl Component for DiscordUsernameInputBox { return Ok(()); } - // todo: y should be set to a min value, so it doesnt become too small - let layer_zero = centered_rect(25, 15, area); + let layer_zero = centered_rect_fixed(40, 5, area); let layer_one = Layout::new( Direction::Vertical, @@ -120,6 +119,8 @@ impl Component for DiscordUsernameInputBox { let pop_up_border = Paragraph::new("").block( Block::default() .borders(Borders::ALL) + .border_type(BorderType::Double) + .border_style(Style::new().bold()) .title("Enter Discord Username"), ); f.render_widget(Clear, layer_zero); diff --git a/node-launchpad/src/components/home.rs b/node-launchpad/src/components/home.rs index 6f96be1915..0d34286636 100644 --- a/node-launchpad/src/components/home.rs +++ b/node-launchpad/src/components/home.rs @@ -6,7 +6,7 @@ // KIND, either express or implied. Please review the Licences for the specific language governing // permissions and limitations relating to use of the SAFE Network Software. -use super::{utils::centered_rect, Component, Frame}; +use super::{utils::centered_rect_fixed, Component, Frame}; use crate::{ action::{Action, HomeActions}, config::Config, @@ -255,7 +255,7 @@ impl Component for Home { ], ) .split(area); - let popup_area = centered_rect(25, 25, area); + let popup_area = centered_rect_fixed(25, 3, area); // top section // @@ -317,7 +317,8 @@ impl Component for Home { .block( Block::default() .borders(Borders::ALL) - .style(Style::default().bg(Color::Reset)), + .border_type(BorderType::Double) + .border_style(Style::new().bold()), ), popup_area, ); diff --git a/node-launchpad/src/components/utils.rs b/node-launchpad/src/components/utils.rs index d35eb28401..0c5393f023 100644 --- a/node-launchpad/src/components/utils.rs +++ b/node-launchpad/src/components/utils.rs @@ -24,3 +24,20 @@ pub fn centered_rect(percent_x: u16, percent_y: u16, r: Rect) -> Rect { ]) .split(popup_layout[1])[1] } + +/// Helper function to create a centered rect using a fixed x,y constraint. +pub fn centered_rect_fixed(x: u16, y: u16, r: Rect) -> Rect { + let popup_layout = Layout::vertical([ + Constraint::Fill(1), + Constraint::Length(y), + Constraint::Fill(1), + ]) + .split(r); + + Layout::horizontal([ + Constraint::Fill(1), + Constraint::Length(x), + Constraint::Fill(1), + ]) + .split(popup_layout[1])[1] +}