fix: tx items height
This commit is contained in:
parent
2a0b4903cd
commit
bc29a29b83
1 changed files with 71 additions and 70 deletions
|
@ -316,84 +316,85 @@ impl WalletTransactions {
|
||||||
};
|
};
|
||||||
ui.painter().rect(bg_rect, rounding, color, View::item_stroke());
|
ui.painter().rect(bg_rect, rounding, color, View::item_stroke());
|
||||||
|
|
||||||
ui.allocate_ui_with_layout(rect.size(), Layout::right_to_left(Align::Center), |ui| {
|
ui.allocate_ui_with_layout(rect.size(), Layout::right_to_left(Align::Max), |ui| {
|
||||||
// Draw button to show transaction info.
|
ui.horizontal_centered(|ui| {
|
||||||
if can_show_info && tx.from_node && tx.data.tx_slate_id.is_some() {
|
// Draw button to show transaction info.
|
||||||
rounding.nw = 0.0;
|
if can_show_info && tx.from_node && tx.data.tx_slate_id.is_some() {
|
||||||
rounding.sw = 0.0;
|
|
||||||
View::item_button(ui, rounding, FILE_TEXT, None, || {
|
|
||||||
self.tx_info_finalize = false;
|
|
||||||
self.show_tx_info_modal(wallet, tx);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Draw finalization button for tx that can be finalized.
|
|
||||||
let show_finalization = ((!can_show_info && !self.tx_info_finalizing) || can_show_info)
|
|
||||||
&& tx.can_finalize;
|
|
||||||
if show_finalization {
|
|
||||||
let (icon, color) = if !can_show_info && self.tx_info_finalize {
|
|
||||||
(FILE_TEXT, None)
|
|
||||||
} else {
|
|
||||||
(CHECK, Some(Colors::green()))
|
|
||||||
};
|
|
||||||
let final_rounding = if can_show_info {
|
|
||||||
Rounding::default()
|
|
||||||
} else {
|
|
||||||
rounding.nw = 0.0;
|
rounding.nw = 0.0;
|
||||||
rounding.sw = 0.0;
|
rounding.sw = 0.0;
|
||||||
rounding
|
View::item_button(ui, rounding, FILE_TEXT, None, || {
|
||||||
};
|
|
||||||
View::item_button(ui, final_rounding, icon, color, || {
|
|
||||||
if !can_show_info && self.tx_info_finalize {
|
|
||||||
self.tx_info_finalize = false;
|
self.tx_info_finalize = false;
|
||||||
return;
|
|
||||||
}
|
|
||||||
self.tx_info_finalize = true;
|
|
||||||
// Show transaction information modal.
|
|
||||||
if can_show_info {
|
|
||||||
self.show_tx_info_modal(wallet, tx);
|
self.show_tx_info_modal(wallet, tx);
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Draw cancel button for tx that can be reposted and canceled.
|
// Draw finalization button for tx that can be finalized.
|
||||||
let wallet_loaded = tx.from_node && wallet.foreign_api_port().is_some();
|
let show_finalization = ((!can_show_info && !self.tx_info_finalizing) || can_show_info)
|
||||||
if wallet_loaded && ((!can_show_info && !self.tx_info_finalizing) || can_show_info) &&
|
&& tx.can_finalize;
|
||||||
(tx.can_repost(data) || tx.can_cancel()) {
|
if show_finalization {
|
||||||
View::item_button(ui, Rounding::default(), PROHIBIT, Some(Colors::red()), || {
|
let (icon, color) = if !can_show_info && self.tx_info_finalize {
|
||||||
if can_show_info {
|
(FILE_TEXT, None)
|
||||||
self.confirm_cancel_tx_id = Some(tx.data.id);
|
|
||||||
// Show transaction cancellation confirmation modal.
|
|
||||||
Modal::new(CANCEL_TX_CONFIRMATION_MODAL)
|
|
||||||
.position(ModalPosition::Center)
|
|
||||||
.title(t!("modal.confirmation"))
|
|
||||||
.show();
|
|
||||||
} else {
|
} else {
|
||||||
wallet.cancel(tx.data.id);
|
(CHECK, Some(Colors::green()))
|
||||||
}
|
};
|
||||||
});
|
let final_rounding = if can_show_info {
|
||||||
}
|
Rounding::default()
|
||||||
|
} else {
|
||||||
|
rounding.nw = 0.0;
|
||||||
|
rounding.sw = 0.0;
|
||||||
|
rounding
|
||||||
|
};
|
||||||
|
View::item_button(ui, final_rounding, icon, color, || {
|
||||||
|
if !can_show_info && self.tx_info_finalize {
|
||||||
|
self.tx_info_finalize = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
self.tx_info_finalize = true;
|
||||||
|
// Show transaction information modal.
|
||||||
|
if can_show_info {
|
||||||
|
self.show_tx_info_modal(wallet, tx);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Draw button to repost transaction.
|
// Draw cancel button for tx that can be reposted and canceled.
|
||||||
if ((!can_show_info && !self.tx_info_finalizing) || can_show_info) &&
|
let wallet_loaded = tx.from_node && wallet.foreign_api_port().is_some();
|
||||||
tx.can_repost(data) {
|
if wallet_loaded && ((!can_show_info && !self.tx_info_finalizing) || can_show_info) &&
|
||||||
let repost_rounding = if show_finalization || can_show_info {
|
(tx.can_repost(data) || tx.can_cancel()) {
|
||||||
Rounding::default()
|
View::item_button(ui, Rounding::default(), PROHIBIT, Some(Colors::red()), || {
|
||||||
} else {
|
if can_show_info {
|
||||||
rounding.nw = 0.0;
|
self.confirm_cancel_tx_id = Some(tx.data.id);
|
||||||
rounding.sw = 0.0;
|
// Show transaction cancellation confirmation modal.
|
||||||
rounding
|
Modal::new(CANCEL_TX_CONFIRMATION_MODAL)
|
||||||
};
|
.position(ModalPosition::Center)
|
||||||
View::item_button(ui, repost_rounding, ARROW_CLOCKWISE, Some(Colors::green()), || {
|
.title(t!("modal.confirmation"))
|
||||||
// Post tx after getting slate from slatepack file.
|
.show();
|
||||||
if let Some((s, _)) = wallet.read_slate_by_tx(tx) {
|
} else {
|
||||||
let _ = wallet.post(&s, wallet.can_use_dandelion());
|
wallet.cancel(tx.data.id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
let layout_size = ui.available_size();
|
// Draw button to repost transaction.
|
||||||
ui.allocate_ui_with_layout(layout_size, Layout::left_to_right(Align::Center), |ui| {
|
if ((!can_show_info && !self.tx_info_finalizing) || can_show_info) &&
|
||||||
|
tx.can_repost(data) {
|
||||||
|
let repost_rounding = if show_finalization || can_show_info {
|
||||||
|
Rounding::default()
|
||||||
|
} else {
|
||||||
|
rounding.nw = 0.0;
|
||||||
|
rounding.sw = 0.0;
|
||||||
|
rounding
|
||||||
|
};
|
||||||
|
View::item_button(ui, repost_rounding, ARROW_CLOCKWISE, Some(Colors::green()), || {
|
||||||
|
// Post tx after getting slate from slatepack file.
|
||||||
|
if let Some((s, _)) = wallet.read_slate_by_tx(tx) {
|
||||||
|
let _ = wallet.post(&s, wallet.can_use_dandelion());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ui.with_layout(Layout::left_to_right(Align::Min), |ui| {
|
||||||
ui.add_space(6.0);
|
ui.add_space(6.0);
|
||||||
ui.vertical(|ui| {
|
ui.vertical(|ui| {
|
||||||
ui.add_space(3.0);
|
ui.add_space(3.0);
|
||||||
|
|
Loading…
Reference in a new issue