From 755e72791f6104bad7b20e7fa70b49318304b6e8 Mon Sep 17 00:00:00 2001 From: pythcoiner Date: Thu, 27 Jun 2024 07:47:24 +0200 Subject: [PATCH] gui: do not let user try recovery if one block left --- gui/src/app/state/recovery.rs | 2 +- gui/src/app/view/recovery.rs | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/gui/src/app/state/recovery.rs b/gui/src/app/state/recovery.rs index 09298aaff..0a45543f7 100644 --- a/gui/src/app/state/recovery.rs +++ b/gui/src/app/state/recovery.rs @@ -247,7 +247,7 @@ fn recovery_paths(wallet: &Wallet, coins: &[Coin], blockheight: i32) -> Vec( Container::new( Column::new() .spacing(20) - .push(text(format!( - "{} recovery paths will be available at the next block, select one:", - recovery_paths.len() - ))) + .push(text(if recovery_paths.len() == 1 { + "1 recovery path is available, please select:".to_string() + } else { + format!( + "{} recovery paths are available, select one:", + recovery_paths.len() + ) + })) .push(Column::with_children(recovery_paths).spacing(20)), ) .style(theme::Container::Card(theme::Card::Simple)) @@ -190,7 +194,7 @@ pub fn recovery_path_view<'a>( .push(text(format!( "{} coin{} totalling", number_of_coins, - if number_of_coins > 0 { "s" } else { "" } + if number_of_coins > 1 { "s" } else { "" } ))) .push(amount(&total_amount)), )