commit 72d696beb23899c3c2e8c70af42741bb93f7862b
parent dea695fa8e53bf430e7871e9da26f5919e00568a
Author: kernelkind <kernelkind@gmail.com>
Date: Sun, 31 Aug 2025 19:34:51 -0400
actionbar: reintroduce error messages
there was a regression that caused error messages to not be displayed
any more when zapping.
Now when you click the zap button and the zap fails for some reason, the
zap button will be replaced with an X and hovering over the X displays
the error message
Signed-off-by: kernelkind <kernelkind@gmail.com>
Diffstat:
1 file changed, 23 insertions(+), 18 deletions(-)
diff --git a/crates/notedeck_ui/src/note/mod.rs b/crates/notedeck_ui/src/note/mod.rs
@@ -875,34 +875,39 @@ fn render_note_actionbar(
zap_recipient: Pubkey::new(*note_pubkey),
};
- if zap_state.is_err() {
- action = Some(NoteAction::Zap(ZapAction::ClearError(target.clone())));
- }
-
- let zap_resp = {
+ {
cur_acc.secret_key.as_ref()?;
match zap_state {
- Ok(any_zap_state) => ui.add(zap_button(i18n, any_zap_state, note_id)),
+ Ok(any_zap_state) => {
+ let zap_resp = ui.add(zap_button(i18n, any_zap_state, note_id));
+
+ if zap_resp.secondary_clicked() {
+ action = Some(NoteAction::Zap(ZapAction::CustomizeAmount(target.clone())));
+ }
+
+ if zap_resp.clicked() {
+ action = Some(NoteAction::Zap(ZapAction::Send(ZapTargetAmount {
+ target,
+ specified_msats: None,
+ })));
+ }
+
+ zap_resp
+ }
Err(err) => {
let (rect, _) = ui.allocate_at_least(egui::vec2(10.0, 10.0), egui::Sense::click());
- ui.add(x_button(rect)).on_hover_text(err.to_string())
+ let x_button = ui.add(x_button(rect)).on_hover_text(err.to_string());
+
+ if x_button.clicked() {
+ action = Some(NoteAction::Zap(ZapAction::ClearError(target.clone())));
+ }
+ x_button
}
}
}
.on_hover_cursor(egui::CursorIcon::PointingHand);
- if zap_resp.secondary_clicked() {
- action = Some(NoteAction::Zap(ZapAction::CustomizeAmount(target.clone())));
- }
-
- if zap_resp.clicked() {
- action = Some(NoteAction::Zap(ZapAction::Send(ZapTargetAmount {
- target,
- specified_msats: None,
- })))
- }
-
action
}