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

View file

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

View file

@ -18,7 +18,7 @@ use grin_core::global::ChainTypes;
use crate::AppConfig;
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::views::{Modal, ModalPosition, View};
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.
is_correct_address_edit: bool,
/// Peer edit value for modal.
peer_edit: String,
/// Default main network seeds.
default_main_seeds: Vec<String>,
/// Default test network seeds.
@ -391,28 +391,50 @@ impl P2PSetup {
};
ui.label(RichText::new(label_text).size(17.0).color(Colors::GRAY));
ui.add_space(8.0);
StripBuilder::new(ui)
.size(Size::exact(42.0))
.vertical(|mut strip| {
strip.strip(|builder| {
builder
.size(Size::remainder())
.size(Size::exact(48.0))
.horizontal(|mut strip| {
strip.cell(|ui| {
ui.add_space(2.0);
// Draw peer address text edit.
let text_edit_resp = egui::TextEdit::singleline(&mut self.peer_edit)
let text_edit = egui::TextEdit::singleline(&mut self.peer_edit)
.id(Id::from(modal.id))
.font(TextStyle::Heading)
.font(TextStyle::Button)
.desired_width(ui.available_width())
.cursor_at_end(true)
.ui(ui);
text_edit_resp.request_focus();
if text_edit_resp.clicked() {
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.
if !self.is_correct_address_edit {
ui.add_space(12.0);
ui.label(RichText::new(t!("network_settings.peer_address_error"))
.size(16.0)
.color(Colors::RED));
ui.add_space(6.0);
}
ui.add_space(12.0);
ui.add_space(4.0);
// Show modal buttons.
ui.scope(|ui| {