From 2d2cd12bda47feff6faa01cb5a1338d7f0f9f7a0 Mon Sep 17 00:00:00 2001 From: edouardparis Date: Mon, 26 Feb 2024 15:13:23 +0100 Subject: [PATCH] Restart new spending process on user demand --- gui/src/app/mod.rs | 11 +++++++++++ gui/src/app/state/spend/mod.rs | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/gui/src/app/mod.rs b/gui/src/app/mod.rs index 82720a95..8ebaa766 100644 --- a/gui/src/app/mod.rs +++ b/gui/src/app/mod.rs @@ -177,6 +177,17 @@ impl App { self.cache.network, ); } + menu::Menu::CreateSpendTx => { + // redo the process of spending only if user want to start a new one. + if !self.panels.create_spend.is_first_step() { + self.panels.create_spend = CreateSpendPanel::new( + self.wallet.clone(), + &self.cache.coins, + self.cache.blockheight as u32, + self.cache.network, + ); + } + } _ => {} }; self.panels.current = menu; diff --git a/gui/src/app/state/spend/mod.rs b/gui/src/app/state/spend/mod.rs index 6a01a821..6bdf833b 100644 --- a/gui/src/app/state/spend/mod.rs +++ b/gui/src/app/state/spend/mod.rs @@ -63,6 +63,10 @@ impl CreateSpendPanel { ], } } + + pub fn is_first_step(&self) -> bool { + self.current == 0 + } } impl State for CreateSpendPanel {