mirror of
https://github.com/mikedilger/gossip.git
synced 2024-09-19 19:46:50 +00:00
Add copy button to pubkey of post
This commit is contained in:
parent
8d07305875
commit
d4b70fd85c
@ -160,6 +160,10 @@ fn render_post(
|
|||||||
|
|
||||||
ui.label(RichText::new(GossipUi::pubkey_short(&event.pubkey)).weak());
|
ui.label(RichText::new(GossipUi::pubkey_short(&event.pubkey)).weak());
|
||||||
|
|
||||||
|
if ui.add(CopyButton { }).clicked() {
|
||||||
|
ui.output().copied_text = GossipUi::pubkey_long(&event.pubkey);
|
||||||
|
}
|
||||||
|
|
||||||
ui.with_layout(Layout::right_to_left(Align::TOP), |ui| {
|
ui.with_layout(Layout::right_to_left(Align::TOP), |ui| {
|
||||||
ui.label(
|
ui.label(
|
||||||
RichText::new(crate::date_ago::date_ago(event.created_at))
|
RichText::new(crate::date_ago::date_ago(event.created_at))
|
||||||
|
@ -198,4 +198,9 @@ impl GossipUi {
|
|||||||
let hex: PublicKeyHex = (*pubkey).into();
|
let hex: PublicKeyHex = (*pubkey).into();
|
||||||
Self::hex_pubkey_short(&hex)
|
Self::hex_pubkey_short(&hex)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn pubkey_long(pubkey: &PublicKey) -> String {
|
||||||
|
let hex: PublicKeyHex = (*pubkey).into();
|
||||||
|
hex.0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user