ui: refactoring of wallet screen, fix colors

This commit is contained in:
ardocrat
2025-06-09 12:34:07 +03:00
parent b54a573f61
commit 8b369b6049
33 changed files with 1401 additions and 1252 deletions
+27 -1
View File
@@ -24,12 +24,19 @@ pub struct WalletList {
pub main_list: Vec<Wallet>,
/// List of wallets for [`ChainTypes::Testnet`].
pub test_list: Vec<Wallet>,
/// Selected wallet id.
selected: Option<i64>,
}
impl Default for WalletList {
fn default() -> Self {
let (main_list, test_list) = Self::init();
Self { main_list, test_list }
Self {
main_list,
test_list,
selected: None
}
}
}
@@ -96,4 +103,23 @@ impl WalletList {
}
}
}
/// Select wallet.
pub fn select(&mut self, id: Option<i64>) {
self.selected = id;
}
/// Get selected wallet.
pub fn selected(&self) -> Box<Option<&Wallet>> {
if self.selected.is_none() {
return Box::new(None);
}
let list = self.list();
for wallet in list {
if wallet.get_config().id == self.selected.unwrap() {
return Box::new(Some(wallet));
}
}
Box::new(None)
}
}