notedeck

One damus client to rule them all
git clone git://jb55.com/notedeck
Log | Files | Refs | README | LICENSE

commit db1642bc31fcb27e49abae6044c0d0d413fc0ad5
parent eb294bb4d36c0dca731bae009d6a536415e0d54f
Author: William Casarin <jb55@jb55.com>
Date:   Thu, 13 Jun 2024 09:10:31 -0700

remove useless struct

we can just use tuples for compound ids

Signed-off-by: William Casarin <jb55@jb55.com>

Diffstat:
Msrc/timeline.rs | 2+-
Msrc/ui/note/mod.rs | 21++-------------------
2 files changed, 3 insertions(+), 20 deletions(-)

diff --git a/src/timeline.rs b/src/timeline.rs @@ -271,7 +271,7 @@ pub fn timeline_view(ui: &mut egui::Ui, app: &mut Damus, timeline: usize) { // need this for some reason?? ui.add_space(3.0); - let scroll_id = ui.id().with(app.timelines[timeline].selected_view); + let scroll_id = egui::Id::new(("tlscroll", app.timelines[timeline].selected_view, timeline)); egui::ScrollArea::vertical() .id_source(scroll_id) .animated(false) diff --git a/src/ui/note/mod.rs b/src/ui/note/mod.rs @@ -7,7 +7,6 @@ pub use options::NoteOptions; use crate::{colors, notecache::CachedNote, ui, ui::View, Damus}; use egui::{Label, RichText, Sense}; use nostrdb::{NoteKey, Transaction}; -use std::hash::{Hash, Hasher}; pub struct Note<'a> { app: &'a mut Damus, @@ -26,20 +25,6 @@ impl<'a> View for Note<'a> { } } -#[derive(Eq, PartialEq, Debug, Clone, Copy)] -struct ProfileAnimId { - profile_key: u64, - note_key: u64, -} - -impl Hash for ProfileAnimId { - fn hash<H: Hasher>(&self, state: &mut H) { - state.write_u8(0x12); - self.profile_key.hash(state); - self.note_key.hash(state); - } -} - fn reply_desc( ui: &mut egui::Ui, txn: &Transaction, @@ -224,10 +209,7 @@ impl<'a> Note<'a> { } else { let (rect, size) = ui::anim::hover_expand( ui, - egui::Id::new(ProfileAnimId { - profile_key, - note_key, - }), + egui::Id::new((profile_key, note_key)), pfp_size, expand_size, anim_speed, @@ -345,6 +327,7 @@ fn render_note_actionbar(ui: &mut egui::Ui) -> egui::InnerResponse<Option<BarAct egui::Button::image(egui::Image::new(img_data).max_width(10.0)) //.stroke(egui::Stroke::NONE) .frame(false) + .stroke(egui::Stroke::NONE) .fill(ui.style().visuals.panel_fill), ) .clicked()