feat(gui): add links with info about backend/node settings

This commit is contained in:
Michael Mallan 2025-07-01 16:54:55 +01:00
parent 0d48f8efee
commit ceec4f9e79
No known key found for this signature in database
GPG Key ID: 5177CDCEDB0EABEB
15 changed files with 133 additions and 1 deletions

37
Cargo.lock generated
View File

@ -2789,6 +2789,25 @@ version = "2.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130"
[[package]]
name = "is-docker"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "928bae27f42bc99b60d9ac7334e3a21d10ad8f1835a4e12ec3ec0464765ed1b3"
dependencies = [
"once_cell",
]
[[package]]
name = "is-wsl"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "173609498df190136aa7dea1a91db051746d339e18476eed5ca40521f02d7aa5"
dependencies = [
"is-docker",
"once_cell",
]
[[package]]
name = "itertools"
version = "0.10.5"
@ -3063,6 +3082,7 @@ dependencies = [
"lianad",
"libc",
"log",
"open",
"reqwest",
"rfd",
"rust-ini",
@ -3852,6 +3872,17 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381"
[[package]]
name = "open"
version = "5.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2483562e62ea94312f3576a7aca397306df7990b8d89033e18766744377ef95"
dependencies = [
"is-wsl",
"libc",
"pathdiff",
]
[[package]]
name = "option-ext"
version = "0.2.0"
@ -4010,6 +4041,12 @@ version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
[[package]]
name = "pathdiff"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3"
[[package]]
name = "percent-encoding"
version = "2.3.1"

View File

@ -55,6 +55,8 @@ reqwest = { version = "0.11", default-features=false, features = ["json", "rustl
rust-ini = "0.19.0"
rfd = "0.15.1"
# Used for opening URLs in browser
open = "5.3"
[target.'cfg(windows)'.dependencies]
zip = { version = "0.6", default-features=false, features = ["bzip2", "deflate"] }

View File

@ -388,6 +388,12 @@ impl App {
)
}
Message::View(view::Message::Menu(menu)) => self.set_current_panel(menu),
Message::View(view::Message::OpenUrl(url)) => {
if let Err(e) = open::that_detached(&url) {
tracing::error!("Error opening '{}': {}", url, e);
}
Task::none()
}
Message::View(view::Message::Clipboard(text)) => clipboard::write(text),
_ => self
.panels

View File

@ -18,6 +18,7 @@ use liana_ui::{component::form, widget::Element};
use crate::{
app::{cache::Cache, error::Error, message::Message, state::settings::State, view},
daemon::Daemon,
help,
node::{
bitcoind::{RpcAuthType, RpcAuthValues},
NodeType,
@ -196,6 +197,10 @@ impl State for BitcoindSettingsState {
},
))
}
setting_panels.push(view::settings::link(
help::CHANGE_BACKEND_OR_NODE_URL,
"I want to change node type or use Liana Connect",
));
setting_panels.push(self.rescan_settings.view(cache, can_do_rescan).map(
move |msg| view::Message::Settings(view::SettingsMessage::RescanSettings(msg)),
));

View File

@ -30,6 +30,7 @@ pub enum Message {
HideRescanWarning,
ExportPsbt,
ImportPsbt,
OpenUrl(String),
}
impl Close for Message {

View File

@ -32,6 +32,7 @@ use crate::{
settings::ProviderKey,
view::{hw, warning::warn},
},
help,
hw::HardwareWallet,
node::{
bitcoind::{RpcAuthType, RpcAuthValues},
@ -165,6 +166,18 @@ pub fn list(cache: &Cache, is_remote_backend: bool) -> Element<Message> {
)
}
pub fn link<'a>(url: &str, link_text: &'static str) -> Element<'a, Message> {
iced_tooltip::Tooltip::new(
button::link(Some(icon::link_icon()), link_text)
.on_press(Message::OpenUrl(url.to_string())),
Container::new(text(url))
.style(theme::card::simple)
.padding(10),
iced_tooltip::Position::Bottom,
)
.into()
}
pub fn bitcoind_settings<'a>(
cache: &'a Cache,
warning: Option<&Error>,
@ -345,7 +358,14 @@ pub fn remote_backend_section<'a>(
&Menu::Settings,
cache,
warning,
Column::new().spacing(20).push(header).push(content),
Column::new()
.spacing(20)
.push(header)
.push(content)
.push(link(
help::CHANGE_BACKEND_OR_NODE_URL,
"I want to connect to my own node",
)),
)
}

3
liana-gui/src/help.rs Normal file
View File

@ -0,0 +1,3 @@
/// URL of help page with information about how to change backend/node.
pub const CHANGE_BACKEND_OR_NODE_URL: &str =
"https://wizardsardine.com/liana/support/nodechoiceandswitch/";

View File

@ -67,6 +67,7 @@ pub enum Message {
WalletFromBackup((HashMap<Fingerprint, settings::KeySetting>, Backup)),
WalletAliasEdited(String),
SelectAccount(Fingerprint, ChildNumber),
OpenUrl(String),
}
impl Close for Message {

View File

@ -250,6 +250,12 @@ impl Installer {
}
},
Message::Clipboard(s) => clipboard::write(s),
Message::OpenUrl(url) => {
if let Err(e) = open::that_detached(&url) {
tracing::error!("Error opening '{}': {}", url, e);
}
Task::none()
}
Message::Next => self.next(),
Message::Previous => self.previous(),
Message::Install => {

View File

@ -34,6 +34,7 @@ use liana_ui::{
use crate::node::electrum::validate_domain_checkbox;
use crate::{
app::settings,
help,
hw::{is_compatible_with_tapminiscript, HardwareWallet, UnsupportedReason},
installer::{
descriptor::{Key, PathSequence, PathWarning},
@ -2075,6 +2076,20 @@ pub fn choose_backend(progress: (usize, usize)) -> Element<'static, Message> {
.width(Length::FillPortion(1)),
),
)
.push(Space::with_height(20)) // ensures mouse cursor is not already on link when arriving at this step
.push(tooltip::Tooltip::new(
button::link(
Some(icon::link_icon()),
"More information about backend and node options",
)
.on_press(Message::OpenUrl(
help::CHANGE_BACKEND_OR_NODE_URL.to_string(),
)),
Container::new(text(help::CHANGE_BACKEND_OR_NODE_URL))
.style(theme::card::simple)
.padding(10),
tooltip::Position::Bottom,
))
.spacing(20),
true,
Some(Message::Previous),

View File

@ -6,6 +6,7 @@ pub mod dir;
pub mod download;
pub mod export;
pub mod gui;
pub mod help;
pub mod hw;
pub mod installer;
pub mod launcher;

View File

@ -63,6 +63,10 @@ pub fn transparent_border<'a, T: 'a>(icon: Option<Text<'a>>, t: &'static str) ->
button(content(icon, text(t))).style(theme::button::container_border)
}
pub fn link<'a, T: 'a>(icon: Option<Text<'a>>, t: &'static str) -> Button<'a, T> {
Button::new(content(icon, text(t))).style(theme::button::link)
}
fn content<'a, T: 'a>(icon: Option<Text<'a>>, text: Text<'a>) -> Container<'a, T> {
match icon {
None => container(text).align_x(Horizontal::Center).padding(5),

View File

@ -131,6 +131,10 @@ pub fn restore_icon() -> Text<'static> {
bootstrap_icon('\u{F358}')
}
pub fn link_icon() -> Text<'static> {
bootstrap_icon('\u{F470}')
}
const ICONEX_ICONS: Font = Font::with_name("Untitled1");
fn iconex_icon(unicode: char) -> Text<'static> {

View File

@ -52,6 +52,10 @@ pub fn transparent_border(theme: &Theme, status: Status) -> Style {
button(&theme.colors.buttons.transparent_border, status)
}
pub fn link(theme: &Theme, status: Status) -> Style {
button(&theme.colors.buttons.link, status)
}
fn button(p: &Button, status: Status) -> Style {
match status {
Status::Active => Style {

View File

@ -46,6 +46,7 @@ pub struct Buttons {
pub container_border: Button,
pub menu: Button,
pub tab: Button,
pub link: Button,
}
#[derive(Debug, Copy, Clone, PartialEq)]
@ -386,6 +387,28 @@ impl std::default::Default for Palette {
border: color::GREY_7.into(),
}),
},
link: Button {
active: ButtonPalette {
background: color::TRANSPARENT,
text: color::GREY_2,
border: color::TRANSPARENT.into(),
},
hovered: ButtonPalette {
background: color::TRANSPARENT,
text: color::GREEN,
border: color::TRANSPARENT.into(),
},
pressed: Some(ButtonPalette {
background: color::TRANSPARENT,
text: color::GREEN,
border: color::TRANSPARENT.into(),
}),
disabled: Some(ButtonPalette {
background: color::TRANSPARENT,
text: color::GREY_2,
border: color::TRANSPARENT.into(),
}),
},
},
cards: Cards {
simple: ContainerPalette {