From cf541ee8ede8c3aa2f676bd883c5f4518e65bcd5 Mon Sep 17 00:00:00 2001 From: ardocrat Date: Sun, 5 May 2024 16:01:29 +0300 Subject: [PATCH] ui: move connections add button from panel, wallet settings titles lines color --- src/gui/views/network/connections.rs | 17 ++++++++++--- src/gui/views/network/content.rs | 6 +---- src/gui/views/wallets/setup/common.rs | 6 ++--- src/gui/views/wallets/setup/connection.rs | 31 +++++++++++++---------- src/gui/views/wallets/setup/recovery.rs | 4 +-- 5 files changed, 35 insertions(+), 29 deletions(-) diff --git a/src/gui/views/network/connections.rs b/src/gui/views/network/connections.rs index 60469cb..6331f07 100644 --- a/src/gui/views/network/connections.rs +++ b/src/gui/views/network/connections.rs @@ -17,7 +17,7 @@ use url::Url; use crate::AppConfig; use crate::gui::Colors; -use crate::gui::icons::{CARET_RIGHT, CHECK_CIRCLE, COMPUTER_TOWER, DOTS_THREE_CIRCLE, GLOBE_SIMPLE, PENCIL, POWER, TRASH, X_CIRCLE}; +use crate::gui::icons::{CARET_RIGHT, CHECK_CIRCLE, COMPUTER_TOWER, DOTS_THREE_CIRCLE, GLOBE_SIMPLE, PENCIL, PLUS_CIRCLE, POWER, TRASH, X_CIRCLE}; use crate::gui::platform::PlatformCallbacks; use crate::gui::views::{Modal, NodeSetup, View}; use crate::gui::views::types::{ModalContainer, ModalPosition, TextEditOptions}; @@ -100,11 +100,20 @@ impl ConnectionsContent { Self::integrated_node_item_ui(ui); // Show external connections. + ui.add_space(8.0); + ui.label(RichText::new(t!("wallets.ext_conn")).size(16.0).color(Colors::GRAY)); + ui.add_space(6.0); + + // Show button to add new external node connection. + let add_node_text = format!("{} {}", PLUS_CIRCLE, t!("wallets.add_node")); + View::button(ui, add_node_text, Colors::WHITE, || { + self.show_add_ext_conn_modal(None, cb); + }); + + ui.add_space(12.0); + let ext_conn_list = ConnectionsConfig::ext_conn_list(); if !ext_conn_list.is_empty() { - ui.add_space(6.0); - ui.label(RichText::new(t!("wallets.ext_conn")).size(16.0).color(Colors::GRAY)); - ui.add_space(6.0); for (index, conn) in ext_conn_list.iter().enumerate() { ui.horizontal_wrapped(|ui| { // Draw connection list item. diff --git a/src/gui/views/network/content.rs b/src/gui/views/network/content.rs index b248b10..7d704a5 100644 --- a/src/gui/views/network/content.rs +++ b/src/gui/views/network/content.rs @@ -16,7 +16,7 @@ use egui::{Margin, RichText, ScrollArea, Stroke}; use crate::AppConfig; use crate::gui::Colors; -use crate::gui::icons::{BRIEFCASE, DATABASE, DOTS_THREE_OUTLINE_VERTICAL, FACTORY, FADERS, GAUGE, PLUS_CIRCLE, POWER}; +use crate::gui::icons::{BRIEFCASE, DATABASE, DOTS_THREE_OUTLINE_VERTICAL, FACTORY, FADERS, GAUGE, POWER}; use crate::gui::platform::PlatformCallbacks; use crate::gui::views::{ConnectionsContent, NetworkMetrics, NetworkMining, NetworkNode, NetworkSettings, Root, TitlePanel, View}; use crate::gui::views::network::types::{NetworkTab, NetworkTabType}; @@ -212,10 +212,6 @@ impl NetworkContent { ExternalConnection::start_ext_conn_availability_check(); } }); - } else { - View::title_button(ui, PLUS_CIRCLE, || { - self.connections.show_add_ext_conn_modal(None, cb); - }); } }, |ui, _| { if !Root::is_dual_panel_mode(ui) { diff --git a/src/gui/views/wallets/setup/common.rs b/src/gui/views/wallets/setup/common.rs index 91ada28..878392e 100644 --- a/src/gui/views/wallets/setup/common.rs +++ b/src/gui/views/wallets/setup/common.rs @@ -12,10 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -use egui::{Align, Id, Layout, RichText, TextStyle, Widget}; +use egui::{Id, RichText, Widget}; use crate::gui::Colors; -use crate::gui::icons::{CLOCK_COUNTDOWN, EYE, EYE_SLASH, PASSWORD, PENCIL}; +use crate::gui::icons::{CLOCK_COUNTDOWN, PASSWORD, PENCIL}; use crate::gui::platform::PlatformCallbacks; use crate::gui::views::{Modal, View}; use crate::gui::views::types::{ModalPosition, TextEditOptions}; @@ -131,7 +131,7 @@ impl CommonSetup { }); ui.add_space(12.0); - View::horizontal_line(ui, Colors::ITEM_STROKE); + View::horizontal_line(ui, Colors::STROKE); ui.add_space(4.0); }); } diff --git a/src/gui/views/wallets/setup/connection.rs b/src/gui/views/wallets/setup/connection.rs index f8c16c8..8df4fa9 100644 --- a/src/gui/views/wallets/setup/connection.rs +++ b/src/gui/views/wallets/setup/connection.rs @@ -149,28 +149,28 @@ impl ConnectionSetup { ui.add_space(2.0); View::sub_title(ui, format!("{} {}", GLOBE, t!("wallets.conn_method"))); - View::horizontal_line(ui, Colors::ITEM_STROKE); - ui.add_space(4.0); + View::horizontal_line(ui, Colors::STROKE); + ui.add_space(6.0); ui.vertical_centered(|ui| { // Show integrated node selection. ui.add_space(6.0); self.integrated_node_item_ui(ui); + // Show external connections. + ui.add_space(8.0); + ui.label(RichText::new(t!("wallets.ext_conn")).size(16.0).color(Colors::GRAY)); + ui.add_space(6.0); + + // Show button to add new external node connection. + let add_node_text = format!("{} {}", PLUS_CIRCLE, t!("wallets.add_node")); + View::button(ui, add_node_text, Colors::WHITE, || { + self.show_add_ext_conn_modal(cb); + }); + ui.add_space(12.0); + let ext_conn_list = ConnectionsConfig::ext_conn_list(); if !ext_conn_list.is_empty() { - ui.add_space(6.0); - ui.label(RichText::new(t!("wallets.ext_conn")).size(16.0).color(Colors::GRAY)); - ui.add_space(6.0); - - // Show button to add new external node connection. - let add_node_text = format!("{} {}", PLUS_CIRCLE, t!("wallets.add_node")); - View::button(ui, add_node_text, Colors::WHITE, || { - self.show_add_ext_conn_modal(cb); - }); - ui.add_space(12.0); - - // Show external connections. for (index, conn) in ext_conn_list.iter().enumerate() { ui.horizontal_wrapped(|ui| { // Draw connection list item. @@ -179,6 +179,9 @@ impl ConnectionSetup { } } }); + + ui.add_space(10.0); + View::horizontal_line(ui, Colors::STROKE); } /// Draw integrated node connection item content. diff --git a/src/gui/views/wallets/setup/recovery.rs b/src/gui/views/wallets/setup/recovery.rs index bcb004b..2d086a7 100644 --- a/src/gui/views/wallets/setup/recovery.rs +++ b/src/gui/views/wallets/setup/recovery.rs @@ -59,11 +59,9 @@ impl RecoverySetup { // Show modal content for this ui container. self.modal_content_ui(ui, wallet, cb); - ui.add_space(10.0); - View::horizontal_line(ui, Colors::ITEM_STROKE); ui.add_space(6.0); View::sub_title(ui, format!("{} {}", WRENCH, t!("wallets.recovery"))); - View::horizontal_line(ui, Colors::ITEM_STROKE); + View::horizontal_line(ui, Colors::STROKE); ui.add_space(4.0); ui.vertical_centered(|ui| {