contact name
This commit is contained in:
18
src/app.rs
18
src/app.rs
@@ -317,12 +317,18 @@ fn pfp_image(ui: &mut egui::Ui, img: &RetainedImage, size: f32) -> egui::Respons
|
|||||||
img.show_max_size(ui, egui::vec2(size, size))
|
img.show_max_size(ui, egui::vec2(size, size))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_username(ui: &mut egui::Ui, pk: &str) {
|
fn render_username(ui: &mut egui::Ui, contacts: &Contacts, pk: &Pubkey) {
|
||||||
ui.horizontal(|ui| {
|
ui.horizontal(|ui| {
|
||||||
ui.spacing_mut().item_spacing.x = 0.0;
|
//ui.spacing_mut().item_spacing.x = 0.0;
|
||||||
ui.label(&pk[0..8]);
|
if let Some(prof) = contacts.profiles.get(pk) {
|
||||||
|
if let Some(display_name) = prof.display_name() {
|
||||||
|
ui.label(display_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ui.label(&pk.as_ref()[0..8]);
|
||||||
ui.label(":");
|
ui.label(":");
|
||||||
ui.label(&pk[64 - 8..]);
|
ui.label(&pk.as_ref()[64 - 8..]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -345,12 +351,14 @@ fn render_events(ui: &mut egui::Ui, damus: &mut Damus) {
|
|||||||
.get(&ev.pubkey)
|
.get(&ev.pubkey)
|
||||||
.and_then(|p| p.picture())
|
.and_then(|p| p.picture())
|
||||||
{
|
{
|
||||||
|
// these have different lifetimes and types,
|
||||||
|
// so the calls must be separate
|
||||||
Some(pic) => render_pfp(ui, &mut damus.img_cache, pic),
|
Some(pic) => render_pfp(ui, &mut damus.img_cache, pic),
|
||||||
None => render_pfp(ui, &mut damus.img_cache, no_pfp_url()),
|
None => render_pfp(ui, &mut damus.img_cache, no_pfp_url()),
|
||||||
}
|
}
|
||||||
|
|
||||||
ui.with_layout(egui::Layout::top_down(egui::Align::LEFT), |ui| {
|
ui.with_layout(egui::Layout::top_down(egui::Align::LEFT), |ui| {
|
||||||
render_username(ui, ev.pubkey.as_ref());
|
render_username(ui, &damus.contacts, &ev.pubkey);
|
||||||
|
|
||||||
ui.label(&ev.content);
|
ui.label(&ev.content);
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user