ui + build: fix secret modal padding, add paste button to peer, update grin dependency version

This commit is contained in:
ardocrat 2023-07-15 22:37:34 +03:00
parent e951fbab73
commit 6d3d0c76ef
3 changed files with 52 additions and 32 deletions

20
Cargo.lock generated
View file

@ -1867,7 +1867,7 @@ dependencies = [
[[package]] [[package]]
name = "grin_api" name = "grin_api"
version = "5.2.0-beta.1" version = "5.2.0-beta.2"
dependencies = [ dependencies = [
"bytes 0.5.6", "bytes 0.5.6",
"easy-jsonrpc-mw", "easy-jsonrpc-mw",
@ -1898,7 +1898,7 @@ dependencies = [
[[package]] [[package]]
name = "grin_chain" name = "grin_chain"
version = "5.2.0-beta.1" version = "5.2.0-beta.2"
dependencies = [ dependencies = [
"bit-vec", "bit-vec",
"bitflags 1.3.2", "bitflags 1.3.2",
@ -1920,7 +1920,7 @@ dependencies = [
[[package]] [[package]]
name = "grin_config" name = "grin_config"
version = "5.2.0-beta.1" version = "5.2.0-beta.2"
dependencies = [ dependencies = [
"dirs 2.0.2", "dirs 2.0.2",
"grin_core", "grin_core",
@ -1935,7 +1935,7 @@ dependencies = [
[[package]] [[package]]
name = "grin_core" name = "grin_core"
version = "5.2.0-beta.1" version = "5.2.0-beta.2"
dependencies = [ dependencies = [
"blake2-rfc", "blake2-rfc",
"byteorder", "byteorder",
@ -1960,7 +1960,7 @@ dependencies = [
[[package]] [[package]]
name = "grin_keychain" name = "grin_keychain"
version = "5.2.0-beta.1" version = "5.2.0-beta.2"
dependencies = [ dependencies = [
"blake2-rfc", "blake2-rfc",
"byteorder", "byteorder",
@ -1981,7 +1981,7 @@ dependencies = [
[[package]] [[package]]
name = "grin_p2p" name = "grin_p2p"
version = "5.2.0-beta.1" version = "5.2.0-beta.2"
dependencies = [ dependencies = [
"bitflags 1.3.2", "bitflags 1.3.2",
"bytes 0.5.6", "bytes 0.5.6",
@ -2002,7 +2002,7 @@ dependencies = [
[[package]] [[package]]
name = "grin_pool" name = "grin_pool"
version = "5.2.0-beta.1" version = "5.2.0-beta.2"
dependencies = [ dependencies = [
"blake2-rfc", "blake2-rfc",
"chrono", "chrono",
@ -2034,7 +2034,7 @@ dependencies = [
[[package]] [[package]]
name = "grin_servers" name = "grin_servers"
version = "5.2.0-beta.1" version = "5.2.0-beta.2"
dependencies = [ dependencies = [
"chrono", "chrono",
"fs2", "fs2",
@ -2063,7 +2063,7 @@ dependencies = [
[[package]] [[package]]
name = "grin_store" name = "grin_store"
version = "5.2.0-beta.1" version = "5.2.0-beta.2"
dependencies = [ dependencies = [
"byteorder", "byteorder",
"croaring", "croaring",
@ -2081,7 +2081,7 @@ dependencies = [
[[package]] [[package]]
name = "grin_util" name = "grin_util"
version = "5.2.0-beta.1" version = "5.2.0-beta.2"
dependencies = [ dependencies = [
"backtrace", "backtrace",
"base64 0.12.3", "base64 0.12.3",

View file

@ -353,11 +353,8 @@ impl NodeSetup {
Self::API_SECRET_MODAL => t!("network_settings.api_secret"), Self::API_SECRET_MODAL => t!("network_settings.api_secret"),
_ => t!("network_settings.foreign_api_secret") _ => t!("network_settings.foreign_api_secret")
}; };
ui.label(RichText::new(description) ui.label(RichText::new(description).size(17.0).color(Colors::GRAY));
.size(17.0) ui.add_space(8.0);
.color(Colors::GRAY));
ui.add_space(6.0);
StripBuilder::new(ui) StripBuilder::new(ui)
.size(Size::exact(42.0)) .size(Size::exact(42.0))
.vertical(|mut strip| { .vertical(|mut strip| {
@ -368,10 +365,11 @@ impl NodeSetup {
.size(Size::exact(48.0)) .size(Size::exact(48.0))
.horizontal(|mut strip| { .horizontal(|mut strip| {
strip.cell(|ui| { strip.cell(|ui| {
ui.add_space(2.0);
// Draw API port text edit. // Draw API port text edit.
let edit = egui::TextEdit::singleline(&mut self.secret_edit) let edit = egui::TextEdit::singleline(&mut self.secret_edit)
.id(Id::from(modal.id)) .id(Id::from(modal.id))
.font(TextStyle::Heading) .font(TextStyle::Button)
.cursor_at_end(true) .cursor_at_end(true)
.ui(ui); .ui(ui);
edit.request_focus(); edit.request_focus();

View file

@ -18,7 +18,7 @@ use grin_core::global::ChainTypes;
use crate::AppConfig; use crate::AppConfig;
use crate::gui::Colors; use crate::gui::Colors;
use crate::gui::icons::{HANDSHAKE, PLUG, TRASH, GLOBE_SIMPLE, PLUS_CIRCLE, ARROW_FAT_LINES_UP, ARROW_FAT_LINES_DOWN, ARROW_FAT_LINE_UP, PROHIBIT_INSET}; use crate::gui::icons::{HANDSHAKE, PLUG, TRASH, GLOBE_SIMPLE, PLUS_CIRCLE, ARROW_FAT_LINES_UP, ARROW_FAT_LINES_DOWN, ARROW_FAT_LINE_UP, PROHIBIT_INSET, CLIPBOARD_TEXT};
use crate::gui::platform::PlatformCallbacks; use crate::gui::platform::PlatformCallbacks;
use crate::gui::views::{Modal, ModalPosition, View}; use crate::gui::views::{Modal, ModalPosition, View};
use crate::gui::views::network::settings::NetworkSettings; use crate::gui::views::network::settings::NetworkSettings;
@ -46,9 +46,9 @@ pub struct P2PSetup {
/// Flag to check if entered peer address is correct and/or available. /// Flag to check if entered peer address is correct and/or available.
is_correct_address_edit: bool, is_correct_address_edit: bool,
/// Peer edit value for modal. /// Peer edit value for modal.
peer_edit: String, peer_edit: String,
/// Default main network seeds. /// Default main network seeds.
default_main_seeds: Vec<String>, default_main_seeds: Vec<String>,
/// Default test network seeds. /// Default test network seeds.
@ -391,28 +391,50 @@ impl P2PSetup {
}; };
ui.label(RichText::new(label_text).size(17.0).color(Colors::GRAY)); ui.label(RichText::new(label_text).size(17.0).color(Colors::GRAY));
ui.add_space(8.0); ui.add_space(8.0);
StripBuilder::new(ui)
// Draw peer address text edit. .size(Size::exact(42.0))
let text_edit_resp = egui::TextEdit::singleline(&mut self.peer_edit) .vertical(|mut strip| {
.id(Id::from(modal.id)) strip.strip(|builder| {
.font(TextStyle::Heading) builder
.desired_width(ui.available_width()) .size(Size::remainder())
.cursor_at_end(true) .size(Size::exact(48.0))
.ui(ui); .horizontal(|mut strip| {
text_edit_resp.request_focus(); strip.cell(|ui| {
if text_edit_resp.clicked() { ui.add_space(2.0);
cb.show_keyboard(); // Draw peer address text edit.
} let text_edit = egui::TextEdit::singleline(&mut self.peer_edit)
.id(Id::from(modal.id))
.font(TextStyle::Button)
.desired_width(ui.available_width())
.cursor_at_end(true)
.ui(ui);
text_edit.request_focus();
if text_edit.clicked() {
cb.show_keyboard();
}
});
strip.cell(|ui| {
ui.vertical_centered(|ui| {
// Draw paste button.
let paste_icon = CLIPBOARD_TEXT.to_string();
View::button(ui, paste_icon, Colors::WHITE, || {
self.peer_edit = cb.get_string_from_buffer();
});
});
});
});
})
});
// Show error when specified address is incorrect. // Show error when specified address is incorrect.
if !self.is_correct_address_edit { if !self.is_correct_address_edit {
ui.add_space(12.0);
ui.label(RichText::new(t!("network_settings.peer_address_error")) ui.label(RichText::new(t!("network_settings.peer_address_error"))
.size(16.0) .size(16.0)
.color(Colors::RED)); .color(Colors::RED));
ui.add_space(6.0);
} }
ui.add_space(12.0); ui.add_space(4.0);
// Show modal buttons. // Show modal buttons.
ui.scope(|ui| { ui.scope(|ui| {