notedeck

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

commit 11611a11d8e2a1f61aee5a867995313a36885fdf
parent 3f5264b4ab1a0cd4fe039bd6b38e5e78aefe7407
Author: kernelkind <kernelkind@gmail.com>
Date:   Fri, 17 Oct 2025 15:23:40 -0400

feat(reaction): user can send reactions

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

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

diff --git a/crates/notedeck_ui/src/note/mod.rs b/crates/notedeck_ui/src/note/mod.rs @@ -10,7 +10,7 @@ use crate::{widgets::x_button, ProfilePic, ProfilePreview, PulseAlpha, Username} pub use contents::{render_note_preview, NoteContents}; pub use context::NoteContextButton; use notedeck::get_current_wallet; -use notedeck::note::ZapTargetAmount; +use notedeck::note::{reaction_sent_id, ZapTargetAmount}; use notedeck::ui::is_narrow; use notedeck::Accounts; use notedeck::GlobalWallet; @@ -26,7 +26,7 @@ use egui::{Id, Pos2, Rect, Response, Sense}; use enostr::{KeypairUnowned, NoteId, Pubkey}; use nostrdb::{Ndb, Note, NoteKey, ProfileRecord, Transaction}; use notedeck::{ - note::{NoteAction, NoteContext, ZapAction}, + note::{NoteAction, NoteContext, ReactAction, ZapAction}, tr, AnyZapState, ContextSelection, NoteZapTarget, NoteZapTargetOwned, ZapTarget, Zaps, }; @@ -461,6 +461,7 @@ impl<'a, 'd> NoteView<'a, 'd> { ), self.note.id(), self.note.pubkey(), + self.note_context.accounts.selected_account_pubkey(), note_key, self.note_context.i18n, ) @@ -549,6 +550,7 @@ impl<'a, 'd> NoteView<'a, 'd> { ), self.note.id(), self.note.pubkey(), + self.note_context.accounts.selected_account_pubkey(), note_key, self.note_context.i18n, ) @@ -848,6 +850,7 @@ fn render_note_actionbar( zapper: Option<Zapper<'_>>, note_id: &[u8; 32], note_pubkey: &[u8; 32], + current_user_pubkey: &Pubkey, note_key: NoteKey, i18n: &mut Localization, ) -> Option<NoteAction> { @@ -859,6 +862,14 @@ fn render_note_actionbar( let reply_resp = reply_button(ui, i18n, note_key).on_hover_cursor(egui::CursorIcon::PointingHand); + let filled = ui + .ctx() + .data(|d| d.get_temp(reaction_sent_id(current_user_pubkey, note_id))) + == Some(true); + + let like_resp = + like_button(ui, i18n, note_key, filled).on_hover_cursor(egui::CursorIcon::PointingHand); + let quote_resp = quote_repost_button(ui, i18n, note_key).on_hover_cursor(egui::CursorIcon::PointingHand); @@ -866,6 +877,13 @@ fn render_note_actionbar( action = Some(NoteAction::Reply(NoteId::new(*note_id))); } + if like_resp.clicked() { + action = Some(NoteAction::React(ReactAction::new( + NoteId::new(*note_id), + "🤙🏻", + ))); + } + if quote_resp.clicked() { action = Some(NoteAction::Repost(NoteId::new(*note_id))); }