mirror of
https://github.com/mikedilger/gossip.git
synced 2024-09-19 11:43:43 +00:00
Show key copy button in person list
This commit is contained in:
parent
0297cdf4ae
commit
6acff785c6
@ -5,7 +5,7 @@ use crate::ui::widgets::{CopyButton, ReplyButton};
|
||||
use eframe::egui;
|
||||
use egui::{
|
||||
Align, Color32, Context, Frame, Image, Label, Layout, RichText, ScrollArea, Sense, TextEdit,
|
||||
TextStyle, Ui, Vec2,
|
||||
Ui, Vec2,
|
||||
};
|
||||
use nostr_types::{EventKind, Id, PublicKeyHex};
|
||||
|
||||
@ -273,10 +273,6 @@ fn render_post(
|
||||
|
||||
ui.add_space(8.0);
|
||||
|
||||
ui.label(RichText::new("🔑").text_style(TextStyle::Small).weak());
|
||||
if ui.add(CopyButton {}).clicked() {
|
||||
ui.output().copied_text = GossipUi::pubkey_long(&event.pubkey);
|
||||
}
|
||||
if event.pow() > 0 {
|
||||
ui.label(format!("POW={}", event.pow()));
|
||||
}
|
||||
|
@ -13,8 +13,11 @@ use crate::db::DbPerson;
|
||||
use crate::error::Error;
|
||||
use crate::globals::GLOBALS;
|
||||
use crate::settings::Settings;
|
||||
use crate::ui::widgets::CopyButton;
|
||||
use eframe::{egui, IconData, Theme};
|
||||
use egui::{ColorImage, Context, ImageData, RichText, TextureHandle, TextureOptions, Ui};
|
||||
use egui::{
|
||||
ColorImage, Context, ImageData, RichText, TextStyle, TextureHandle, TextureOptions, Ui,
|
||||
};
|
||||
use nostr_types::{Id, PublicKey, PublicKeyHex};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::time::{Duration, Instant};
|
||||
@ -226,6 +229,7 @@ impl GossipUi {
|
||||
)
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn pubkey_long(pubkey: &PublicKey) -> String {
|
||||
let hex: PublicKeyHex = (*pubkey).into();
|
||||
hex.0
|
||||
@ -251,6 +255,10 @@ impl GossipUi {
|
||||
ui.label(RichText::new(dns_id).monospace().small().strikethrough());
|
||||
}
|
||||
}
|
||||
ui.label(RichText::new("🔑").text_style(TextStyle::Small).weak());
|
||||
if ui.add(CopyButton {}).clicked() {
|
||||
ui.output().copied_text = person.pubkey.0.to_owned();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user