spend steps: add total sent
This commit is contained in:
parent
f0758d28ab
commit
c88c39a8b9
@ -75,6 +75,7 @@ impl State for Home {
|
||||
false,
|
||||
self.warning.as_ref(),
|
||||
view::home::event_view(cache, &self.events[i]),
|
||||
None::<Element<view::Message>>,
|
||||
);
|
||||
}
|
||||
view::dashboard(
|
||||
|
||||
@ -94,6 +94,12 @@ impl Step for ChooseRecipients {
|
||||
.enumerate()
|
||||
.map(|(i, recipient)| recipient.view(i).map(view::Message::CreateSpend))
|
||||
.collect(),
|
||||
Amount::from_sat(
|
||||
self.recipients
|
||||
.iter()
|
||||
.map(|r| r.amount().unwrap_or(0_u64))
|
||||
.sum(),
|
||||
),
|
||||
!self.recipients.iter().any(|recipient| !recipient.valid()),
|
||||
)
|
||||
}
|
||||
|
||||
@ -273,10 +273,11 @@ fn main_section<'a, T: 'a>(menu: widget::Container<'a, T>) -> widget::Container<
|
||||
.height(Length::Fill)
|
||||
}
|
||||
|
||||
pub fn modal<'a, T: Into<Element<'a, Message>>>(
|
||||
pub fn modal<'a, T: Into<Element<'a, Message>>, F: Into<Element<'a, Message>>>(
|
||||
is_previous: bool,
|
||||
warning: Option<&Error>,
|
||||
content: T,
|
||||
fixed_footer: Option<F>,
|
||||
) -> Element<'a, Message> {
|
||||
Column::new()
|
||||
.push(warn(warning))
|
||||
@ -299,6 +300,7 @@ pub fn modal<'a, T: Into<Element<'a, Message>>>(
|
||||
.style(container::Style::Background),
|
||||
)
|
||||
.push(modal_section(Container::new(scrollable(content))))
|
||||
.push_maybe(fixed_footer)
|
||||
.width(Length::Fill)
|
||||
.height(Length::Fill)
|
||||
.into()
|
||||
@ -306,7 +308,6 @@ pub fn modal<'a, T: Into<Element<'a, Message>>>(
|
||||
|
||||
fn modal_section<'a, T: 'a>(menu: widget::Container<'a, T>) -> widget::Container<'a, T> {
|
||||
Container::new(menu.max_width(1500))
|
||||
.padding(20)
|
||||
.style(container::Style::Background)
|
||||
.center_x()
|
||||
.width(Length::Fill)
|
||||
|
||||
@ -22,7 +22,7 @@ pub fn spend_view<'a>(spend_txs: &[SpendTx]) -> Element<'a, Message> {
|
||||
Column::new()
|
||||
.push(
|
||||
Row::new().push(Column::new().width(Length::Fill)).push(
|
||||
button::primary(Some(icon::plus_icon()), "Create a new transaction")
|
||||
button::primary(Some(icon::plus_icon()), "New transaction")
|
||||
.on_press(Message::Menu(Menu::CreateSpendTx)),
|
||||
),
|
||||
)
|
||||
|
||||
@ -25,6 +25,7 @@ use crate::{
|
||||
|
||||
pub fn choose_recipients_view(
|
||||
recipients: Vec<Element<Message>>,
|
||||
total_amount: Amount,
|
||||
is_valid: bool,
|
||||
) -> Element<Message> {
|
||||
modal(
|
||||
@ -42,17 +43,26 @@ pub fn choose_recipients_view(
|
||||
.max_width(1000)
|
||||
.spacing(10),
|
||||
)
|
||||
.push_maybe(if is_valid {
|
||||
Some(
|
||||
button::primary(None, "Next")
|
||||
.on_press(Message::Next)
|
||||
.width(Length::Units(100)),
|
||||
)
|
||||
} else {
|
||||
None
|
||||
})
|
||||
.spacing(20)
|
||||
.align_items(Alignment::Center),
|
||||
Some(
|
||||
Container::new(
|
||||
Row::new()
|
||||
.align_items(Alignment::Center)
|
||||
.push(
|
||||
Container::new(text(format!("{}", total_amount)).bold())
|
||||
.width(Length::Fill),
|
||||
)
|
||||
.push(if is_valid {
|
||||
button::primary(None, "Next")
|
||||
.on_press(Message::Next)
|
||||
.width(Length::Units(100))
|
||||
} else {
|
||||
button::primary(None, "Next").width(Length::Units(100))
|
||||
}),
|
||||
)
|
||||
.padding(20),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
@ -124,6 +134,7 @@ pub fn choose_feerate_view<'a>(
|
||||
})
|
||||
.spacing(20)
|
||||
.align_items(Alignment::Center),
|
||||
None::<Element<Message>>,
|
||||
)
|
||||
}
|
||||
|
||||
@ -171,6 +182,7 @@ pub fn choose_coins_view<'a>(
|
||||
})
|
||||
.spacing(20)
|
||||
.align_items(Alignment::Center),
|
||||
None::<Element<Message>>,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user