mirror of
https://github.com/aljazceru/notedeck.git
synced 2025-12-23 19:24:18 +01:00
fix formatting
This commit is contained in:
@@ -398,7 +398,11 @@ impl<'a> NavTitle<'a> {
|
|||||||
.as_ref()
|
.as_ref()
|
||||||
.ok()
|
.ok()
|
||||||
.and_then(move |p| {
|
.and_then(move |p| {
|
||||||
Some(ui::ProfilePic::from_profile(self.img_cache, p)?.size(pfp_size).border(2.0))
|
Some(
|
||||||
|
ui::ProfilePic::from_profile(self.img_cache, p)?
|
||||||
|
.size(pfp_size)
|
||||||
|
.border(2.0),
|
||||||
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -228,14 +228,19 @@ impl<'a> NoteView<'a> {
|
|||||||
anim_speed,
|
anim_speed,
|
||||||
);
|
);
|
||||||
|
|
||||||
ui.put(rect, ui::ProfilePic::new(self.img_cache, pic).size(size).border(2.0))
|
ui.put(
|
||||||
.on_hover_ui_at_pointer(|ui| {
|
rect,
|
||||||
ui.set_max_width(300.0);
|
ui::ProfilePic::new(self.img_cache, pic)
|
||||||
ui.add(ui::ProfilePreview::new(
|
.size(size)
|
||||||
profile.as_ref().unwrap(),
|
.border(2.0),
|
||||||
self.img_cache,
|
)
|
||||||
));
|
.on_hover_ui_at_pointer(|ui| {
|
||||||
});
|
ui.set_max_width(300.0);
|
||||||
|
ui.add(ui::ProfilePreview::new(
|
||||||
|
profile.as_ref().unwrap(),
|
||||||
|
self.img_cache,
|
||||||
|
));
|
||||||
|
});
|
||||||
|
|
||||||
if resp.hovered() || resp.clicked() {
|
if resp.hovered() || resp.clicked() {
|
||||||
ui::show_pointer(ui);
|
ui::show_pointer(ui);
|
||||||
|
|||||||
@@ -113,9 +113,13 @@ impl<'a> PostView<'a> {
|
|||||||
.get_profile_by_pubkey(txn, self.poster.pubkey.bytes())
|
.get_profile_by_pubkey(txn, self.poster.pubkey.bytes())
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.ok()
|
.ok()
|
||||||
.and_then(|p| Some(ui::ProfilePic::from_profile(self.img_cache, p)?
|
.and_then(|p| {
|
||||||
.size(pfp_size)
|
Some(
|
||||||
.border(2.0)));
|
ui::ProfilePic::from_profile(self.img_cache, p)?
|
||||||
|
.size(pfp_size)
|
||||||
|
.border(2.0),
|
||||||
|
)
|
||||||
|
});
|
||||||
|
|
||||||
if let Some(pfp) = poster_pfp {
|
if let Some(pfp) = poster_pfp {
|
||||||
ui.add(pfp);
|
ui.add(pfp);
|
||||||
|
|||||||
@@ -62,7 +62,9 @@ impl<'a> EditProfileView<'a> {
|
|||||||
});
|
});
|
||||||
ui.put(
|
ui.put(
|
||||||
pfp_rect,
|
pfp_rect,
|
||||||
ProfilePic::new(self.img_cache, pfp_url).size(size).border(2.0),
|
ProfilePic::new(self.img_cache, pfp_url)
|
||||||
|
.size(size)
|
||||||
|
.border(2.0),
|
||||||
);
|
);
|
||||||
|
|
||||||
in_frame(ui, |ui| {
|
in_frame(ui, |ui| {
|
||||||
|
|||||||
@@ -22,7 +22,12 @@ impl egui::Widget for ProfilePic<'_, '_> {
|
|||||||
impl<'cache, 'url> ProfilePic<'cache, 'url> {
|
impl<'cache, 'url> ProfilePic<'cache, 'url> {
|
||||||
pub fn new(cache: &'cache mut ImageCache, url: &'url str) -> Self {
|
pub fn new(cache: &'cache mut ImageCache, url: &'url str) -> Self {
|
||||||
let size = Self::default_size();
|
let size = Self::default_size();
|
||||||
ProfilePic { cache, url, size, border: None }
|
ProfilePic {
|
||||||
|
cache,
|
||||||
|
url,
|
||||||
|
size,
|
||||||
|
border: None,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_profile(
|
pub fn from_profile(
|
||||||
@@ -117,8 +122,12 @@ fn render_pfp(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn pfp_image(ui: &mut egui::Ui, img: &TextureHandle, size: f32, border: Option<f32>)
|
fn pfp_image(
|
||||||
-> egui::Response {
|
ui: &mut egui::Ui,
|
||||||
|
img: &TextureHandle,
|
||||||
|
size: f32,
|
||||||
|
border: Option<f32>,
|
||||||
|
) -> egui::Response {
|
||||||
#[cfg(feature = "profiling")]
|
#[cfg(feature = "profiling")]
|
||||||
puffin::profile_function!();
|
puffin::profile_function!();
|
||||||
|
|
||||||
@@ -198,11 +207,16 @@ mod preview {
|
|||||||
anim_speed,
|
anim_speed,
|
||||||
);
|
);
|
||||||
|
|
||||||
ui.put(rect, ui::ProfilePic::new(app.img_cache, url).size(size).border(2.0))
|
ui.put(
|
||||||
.on_hover_ui_at_pointer(|ui| {
|
rect,
|
||||||
ui.set_max_width(300.0);
|
ui::ProfilePic::new(app.img_cache, url)
|
||||||
ui.add(ui::ProfilePreview::new(&profile, app.img_cache));
|
.size(size)
|
||||||
});
|
.border(2.0),
|
||||||
|
)
|
||||||
|
.on_hover_ui_at_pointer(|ui| {
|
||||||
|
ui.set_max_width(300.0);
|
||||||
|
ui.add(ui::ProfilePreview::new(&profile, app.img_cache));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -91,9 +91,11 @@ impl egui::Widget for SimpleProfilePreview<'_, '_> {
|
|||||||
fn ui(self, ui: &mut egui::Ui) -> egui::Response {
|
fn ui(self, ui: &mut egui::Ui) -> egui::Response {
|
||||||
Frame::none()
|
Frame::none()
|
||||||
.show(ui, |ui| {
|
.show(ui, |ui| {
|
||||||
ui.add(ProfilePic::new(self.cache, get_profile_url(self.profile))
|
ui.add(
|
||||||
.size(48.0)
|
ProfilePic::new(self.cache, get_profile_url(self.profile))
|
||||||
.border(1.5));
|
.size(48.0)
|
||||||
|
.border(2.0),
|
||||||
|
);
|
||||||
ui.vertical(|ui| {
|
ui.vertical(|ui| {
|
||||||
ui.add(display_name_widget(get_display_name(self.profile), true));
|
ui.add(display_name_widget(get_display_name(self.profile), true));
|
||||||
if !self.is_nsec {
|
if !self.is_nsec {
|
||||||
|
|||||||
@@ -266,7 +266,9 @@ impl<'a> DesktopSidePanel<'a> {
|
|||||||
let txn = nostrdb::Transaction::new(self.ndb).expect("should be able to create txn");
|
let txn = nostrdb::Transaction::new(self.ndb).expect("should be able to create txn");
|
||||||
let profile_url = get_account_url(&txn, self.ndb, self.selected_account);
|
let profile_url = get_account_url(&txn, self.ndb, self.selected_account);
|
||||||
|
|
||||||
let widget = ProfilePic::new(self.img_cache, profile_url).size(cur_pfp_size).border(2.0);
|
let widget = ProfilePic::new(self.img_cache, profile_url)
|
||||||
|
.size(cur_pfp_size)
|
||||||
|
.border(2.0);
|
||||||
|
|
||||||
ui.put(helper.get_animation_rect(), widget);
|
ui.put(helper.get_animation_rect(), widget);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user