Change pending label for unconfirmed

close #230
close #231
This commit is contained in:
edouard 2023-02-16 10:41:29 +01:00
parent 200d3777e0
commit 120f87462f
6 changed files with 54 additions and 45 deletions

View File

@ -70,11 +70,7 @@ fn coin_list_view(
Row::new()
.push(badge::coin())
.push_maybe(if coin.spend_info.is_some() {
Some(
Container::new(text(" Spent ").small())
.padding(3)
.style(badge::PillStyle::Success),
)
Some(badge::spent())
} else {
let seq = remaining_sequence(coin, blockheight, timelock);
if seq == 0 {
@ -116,11 +112,7 @@ fn coin_list_view(
}
})
.push_maybe(if coin.block_height.is_none() {
Some(
Container::new(text(" Unconfirmed ").small())
.padding(3)
.style(badge::PillStyle::Simple),
)
Some(badge::unconfirmed())
} else {
None
})

View File

@ -130,9 +130,7 @@ fn event_list_view<'a>(i: usize, event: &HistoryTransaction) -> Element<'a, Mess
.small(),
)
} else {
Container::new(text(" Pending ").small())
.padding(3)
.style(badge::PillStyle::Success)
badge::unconfirmed()
})
.spacing(10)
.align_items(Alignment::Center)

View File

@ -210,16 +210,8 @@ fn spend_header<'a>(tx: &SpendTx) -> Element<'a, Message> {
.align_items(Alignment::Center),
)
.push_maybe(match tx.status {
SpendStatus::Deprecated => Some(
Container::new(text(" Deprecated ").small())
.padding(3)
.style(badge::PillStyle::Simple),
),
SpendStatus::Broadcast => Some(
Container::new(text(" Broadcast ").small())
.padding(3)
.style(badge::PillStyle::Success),
),
SpendStatus::Deprecated => Some(badge::deprecated()),
SpendStatus::Broadcast => Some(badge::unconfirmed()),
_ => None,
})
.push(

View File

@ -156,16 +156,8 @@ fn spend_tx_list_view<'a>(i: usize, tx: &SpendTx) -> Element<'a, Message> {
.width(Length::Fill),
)
.push_maybe(match tx.status {
SpendStatus::Deprecated => Some(
Container::new(text(" Deprecated ").small())
.padding(3)
.style(badge::PillStyle::Simple),
),
SpendStatus::Broadcast => Some(
Container::new(text(" Broadcast ").small())
.padding(3)
.style(badge::PillStyle::Success),
),
SpendStatus::Deprecated => Some(badge::deprecated()),
SpendStatus::Broadcast => Some(badge::unconfirmed()),
_ => None,
})
.push(

View File

@ -206,11 +206,7 @@ fn coin_list_view<'a>(
})
.push(badge::coin())
.push_maybe(if coin.spend_info.is_some() {
Some(
Container::new(text(" Spent ").small())
.padding(3)
.style(badge::PillStyle::Success),
)
Some(badge::spent())
} else {
let seq = remaining_sequence(coin, blockheight, timelock);
if seq == 0 {
@ -244,11 +240,7 @@ fn coin_list_view<'a>(
}
})
.push_maybe(if coin.block_height.is_none() {
Some(
Container::new(text(" Unconfirmed ").small())
.padding(3)
.style(badge::PillStyle::Simple),
)
Some(badge::unconfirmed())
} else {
None
})

View File

@ -1,9 +1,13 @@
use iced::{
widget::{self, Container},
widget::{self, tooltip, Container},
Element, Length,
};
use crate::ui::{color, icon};
use crate::ui::{
color,
component::{card, text::*},
icon,
};
pub enum Style {
Standard,
@ -164,3 +168,42 @@ impl From<PillStyle> for iced::theme::Container {
iced::theme::Container::Custom(i.into())
}
}
pub fn unconfirmed<'a, T: 'a>() -> widget::container::Container<'a, T> {
Container::new(
tooltip::Tooltip::new(
Container::new(text(" Unconfirmed ").small())
.padding(3)
.style(PillStyle::Simple),
"Do not treat this as a payment until it is confirmed",
tooltip::Position::Top,
)
.style(card::SimpleCardStyle),
)
}
pub fn deprecated<'a, T: 'a>() -> widget::container::Container<'a, T> {
Container::new(
tooltip::Tooltip::new(
Container::new(text(" Deprecated ").small())
.padding(3)
.style(PillStyle::Simple),
"This spend cannot be included anymore in the blockchain",
tooltip::Position::Top,
)
.style(card::SimpleCardStyle),
)
}
pub fn spent<'a, T: 'a>() -> widget::container::Container<'a, T> {
Container::new(
tooltip::Tooltip::new(
Container::new(text(" Spent ").small())
.padding(3)
.style(PillStyle::Simple),
"The spend transaction was included in the blockchain",
tooltip::Position::Top,
)
.style(card::SimpleCardStyle),
)
}