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>
This commit is contained in:
kernelkind
2025-08-31 19:34:51 -04:00
parent dea695fa8e
commit 72d696beb2

View File

@@ -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
}