Merge #249: fix inconsistencies between spend and coins panel

aa32444318ebe44d4cf38c15f08ccec061b9cb0c fix inconsistencies between spend and coins panel (edouard)

Pull request description:

  Add remaining timelock and unconfirmed label.

  close #232

ACKs for top commit:
  edouardparis:
    Self-ACK aa32444318ebe44d4cf38c15f08ccec061b9cb0c

Tree-SHA512: 61dcceb55d175c98927f89ffd8a357dadb50b5c987b50b5981da4be7a94768de4df9a27c71ff15f81862921a2f62d40721f377bcd128889f234c935f01646ee5
This commit is contained in:
edouard 2022-12-16 17:44:11 +01:00
commit 0cb2a30186
No known key found for this signature in database
GPG Key ID: E65F7A089C20DC8F
2 changed files with 36 additions and 6 deletions

View File

@ -113,6 +113,15 @@ fn coin_list_view(
))
}
})
.push_maybe(if coin.block_height.is_none() {
Some(
Container::new(text(" Unconfirmed ").small())
.padding(3)
.style(badge::PillStyle::Simple),
)
} else {
None
})
.spacing(10)
.align_items(Alignment::Center)
.width(Length::Fill),

View File

@ -11,7 +11,7 @@ use crate::{
error::Error,
view::{message::*, modal},
},
daemon::model::Coin,
daemon::model::{remaining_sequence, Coin},
ui::{
color,
component::{
@ -198,8 +198,15 @@ fn coin_list_view<'a>(
icon::square_icon()
})
.push(badge::coin())
.push_maybe(if let Some(b) = coin.block_height {
if blockheight > b as u32 + timelock {
.push_maybe(if coin.spend_info.is_some() {
Some(
Container::new(text(" Spent ").small())
.padding(3)
.style(badge::PillStyle::Success),
)
} else {
let seq = remaining_sequence(coin, blockheight, timelock);
if seq == 0 {
Some(Container::new(
Row::new()
.spacing(5)
@ -209,18 +216,32 @@ fn coin_list_view<'a>(
)
.align_items(Alignment::Center),
))
} else {
} else if seq < timelock * 10 / 100 {
Some(Container::new(
Row::new()
.spacing(5)
.push(
text(format!(" {}", b as u32 + timelock - blockheight))
.small(),
text(format!(" {}", seq)).small().style(color::WARNING),
)
.push(icon::hourglass_icon().small().style(color::WARNING))
.align_items(Alignment::Center),
))
} else {
Some(Container::new(
Row::new()
.spacing(5)
.push(text(format!(" {}", seq)).small())
.push(icon::hourglass_icon().small())
.align_items(Alignment::Center),
))
}
})
.push_maybe(if coin.block_height.is_none() {
Some(
Container::new(text(" Unconfirmed ").small())
.padding(3)
.style(badge::PillStyle::Simple),
)
} else {
None
})