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:
1 parent
dea695fa8e
commit
72d696beb2
1 file changed
+23
-18
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user