.
Some checks failed
Rust / build (ubuntu-latest, stable) (push) Failing after 1m50s
Rust / build (ubuntu-latest, stable) (pull_request) Failing after 1m51s
Rust / build (macos-latest, stable) (push) Has been cancelled
Rust / build (windows-latest, stable) (push) Has been cancelled
Rust / build (macos-latest, stable) (pull_request) Has been cancelled
Rust / build (windows-latest, stable) (pull_request) Has been cancelled
Some checks failed
Rust / build (ubuntu-latest, stable) (push) Failing after 1m50s
Rust / build (ubuntu-latest, stable) (pull_request) Failing after 1m51s
Rust / build (macos-latest, stable) (push) Has been cancelled
Rust / build (windows-latest, stable) (push) Has been cancelled
Rust / build (macos-latest, stable) (pull_request) Has been cancelled
Rust / build (windows-latest, stable) (pull_request) Has been cancelled
This commit is contained in:
@@ -648,13 +648,20 @@ impl ChatPanel {
|
||||
.w_full()
|
||||
.py_2()
|
||||
.px_3()
|
||||
.bg(cx.theme().warning_background)
|
||||
.child(
|
||||
h_flex()
|
||||
.gap_3()
|
||||
.text_sm()
|
||||
.text_color(cx.theme().warning_foreground)
|
||||
.child(Avatar::new("brand/system.png").size(rems(2.)))
|
||||
.child(
|
||||
h_flex()
|
||||
.flex_shrink_0()
|
||||
.size_8()
|
||||
.justify_center()
|
||||
.rounded_full()
|
||||
.bg(cx.theme().warning_background)
|
||||
.text_color(cx.theme().warning_foreground)
|
||||
.child(Icon::new(IconName::Warning).small()),
|
||||
)
|
||||
.child(content),
|
||||
)
|
||||
.child(
|
||||
|
||||
@@ -41,7 +41,7 @@ pub struct BackupPanel {
|
||||
impl BackupPanel {
|
||||
pub fn new(window: &mut Window, cx: &mut Context<Self>) -> Self {
|
||||
let npub_input = cx.new(|cx| InputState::new(window, cx).disabled(true));
|
||||
let nsec_input = cx.new(|cx| InputState::new(window, cx).disabled(true));
|
||||
let nsec_input = cx.new(|cx| InputState::new(window, cx).disabled(true).masked(true));
|
||||
|
||||
// Run at the end of current cycle
|
||||
cx.defer_in(window, |this, window, cx| {
|
||||
@@ -81,11 +81,14 @@ impl BackupPanel {
|
||||
}));
|
||||
}
|
||||
|
||||
fn copy_secret_key(&mut self, cx: &mut Context<Self>) {
|
||||
fn copy_secret(&mut self, cx: &mut Context<Self>) {
|
||||
let value = self.nsec_input.read(cx).value();
|
||||
let item = ClipboardItem::new_string(value.to_string());
|
||||
|
||||
// Copy to clipboard
|
||||
#[cfg(target_os = "linux")]
|
||||
cx.write_to_primary(item);
|
||||
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
cx.write_to_clipboard(item);
|
||||
|
||||
// Set the copied status to true
|
||||
@@ -157,7 +160,12 @@ impl Render for BackupPanel {
|
||||
.text_color(cx.theme().text_muted)
|
||||
.child(SharedString::from("Public Key:")),
|
||||
)
|
||||
.child(TextInput::new(&self.npub_input).small().bordered(false)),
|
||||
.child(
|
||||
TextInput::new(&self.npub_input)
|
||||
.small()
|
||||
.bordered(false)
|
||||
.disabled(true),
|
||||
),
|
||||
)
|
||||
.child(
|
||||
v_flex()
|
||||
@@ -170,7 +178,12 @@ impl Render for BackupPanel {
|
||||
.text_color(cx.theme().text_muted)
|
||||
.child(SharedString::from("Secret Key:")),
|
||||
)
|
||||
.child(TextInput::new(&self.nsec_input).small().bordered(false)),
|
||||
.child(
|
||||
TextInput::new(&self.nsec_input)
|
||||
.small()
|
||||
.bordered(false)
|
||||
.disabled(true),
|
||||
),
|
||||
)
|
||||
.child(
|
||||
Button::new("copy")
|
||||
@@ -186,7 +199,7 @@ impl Render for BackupPanel {
|
||||
.small()
|
||||
.font_semibold()
|
||||
.on_click(cx.listener(move |this, _ev, _window, cx| {
|
||||
this.copy_secret_key(cx);
|
||||
this.copy_secret(cx);
|
||||
})),
|
||||
),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user