Skip to content

Commit

Permalink
gui(settings): add a copy button to auth fields
Browse files Browse the repository at this point in the history
  • Loading branch information
pythcoiner committed Nov 18, 2024
1 parent 1b00cdf commit a989b96
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion liana-gui/src/app/state/settings/bitcoind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::str::FromStr;
use std::sync::Arc;

use chrono::{NaiveDate, Utc};
use iced::Command;
use iced::{clipboard, Command};
use tracing::info;

use liana::{
Expand Down Expand Up @@ -363,6 +363,7 @@ impl BitcoindSettings {
});
}
}
view::SettingsEditMessage::Clipboard(text) => return clipboard::write(text),
};
Command::none()
}
Expand Down
1 change: 1 addition & 0 deletions liana-gui/src/app/view/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ pub enum SettingsEditMessage {
BitcoindRpcAuthTypeSelected(RpcAuthType),
Cancel,
Confirm,
Clipboard(String),
}

#[derive(Debug, Clone)]
Expand Down
9 changes: 8 additions & 1 deletion liana-gui/src/app/view/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,14 @@ pub fn bitcoind<'a>(
col_fields = col_fields.push(
Row::new()
.push(Container::new(text(k).bold().small()).width(Length::Fill))
.push(text(v).small()),
.push(text(v.clone()).small())
.push(Space::with_width(10))
.push(
Button::new(icon::clipboard_icon())
.style(theme::Button::TransparentBorder)
.on_press(SettingsEditMessage::Clipboard(v.to_string())),
)
.align_items(Alignment::Center),
);
}

Expand Down

0 comments on commit a989b96

Please sign in to comment.