notedeck

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

commit 83753ccc7d3969fc70844baaf8736f4f56ffdcb0
parent c66c5725ced4625f86fbe5712d165a4fe838b967
Author: kernelkind <kernelkind@gmail.com>
Date:   Fri, 17 Oct 2025 15:20:12 -0400

feat(ui): add like button

Signed-off-by: kernelkind <kernelkind@gmail.com>

Diffstat:
Mcrates/notedeck_ui/src/note/mod.rs | 36++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+), 0 deletions(-)

diff --git a/crates/notedeck_ui/src/note/mod.rs b/crates/notedeck_ui/src/note/mod.rs @@ -918,6 +918,42 @@ fn reply_button(ui: &mut egui::Ui, i18n: &mut Localization, note_key: NoteKey) - resp.union(put_resp) } +fn like_button( + ui: &mut egui::Ui, + i18n: &mut Localization, + note_key: NoteKey, + filled: bool, +) -> egui::Response { + let img = { + let img = if filled { + app_images::like_image_filled() + } else { + app_images::like_image() + }; + + if ui.visuals().dark_mode { + img.tint(ui.visuals().text_color()) + } else { + img + } + }; + + let (rect, size, resp) = + crate::anim::hover_expand_small(ui, ui.id().with(("like_anim", note_key))); + + // align rect to note contents + let expand_size = 5.0; // from hover_expand_small + let rect = rect.translate(egui::vec2(-(expand_size / 2.0), 0.0)); + + let put_resp = ui.put(rect, img.max_width(size)).on_hover_text(tr!( + i18n, + "Like this note", + "Hover text for like button" + )); + + resp.union(put_resp) +} + fn repost_icon(dark_mode: bool) -> egui::Image<'static> { if dark_mode { app_images::repost_dark_image()