mirror of
https://code.gri.mw/GUI/grim.git
synced 2026-07-13 10:18:54 +00:00
fix: wallet and mnemonic modals for container
This commit is contained in:
@@ -157,13 +157,6 @@ impl ContentContainer for WalletsContent {
|
||||
}
|
||||
|
||||
fn container_ui(&mut self, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks) {
|
||||
self.content_ui(ui, cb);
|
||||
}
|
||||
}
|
||||
|
||||
impl WalletsContent {
|
||||
/// Draw wallets content.
|
||||
fn content_ui(&mut self, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks) {
|
||||
if let Some(data) = crate::consume_incoming_data() {
|
||||
if !data.is_empty() {
|
||||
self.on_data(ui, Some(data));
|
||||
@@ -320,7 +313,9 @@ impl WalletsContent {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
impl WalletsContent {
|
||||
/// Check if opened wallet is showing.
|
||||
pub fn showing_wallet(&self) -> bool {
|
||||
if let Some(wallet_content) = &self.wallet_content {
|
||||
|
||||
@@ -70,14 +70,15 @@ impl ContentContainer for MnemonicSetup {
|
||||
true
|
||||
}
|
||||
|
||||
fn container_ui(&mut self, ui: &mut egui::Ui, _: &dyn PlatformCallbacks) {
|
||||
|
||||
fn container_ui(&mut self, _: &mut egui::Ui, _: &dyn PlatformCallbacks) {
|
||||
}
|
||||
}
|
||||
|
||||
impl MnemonicSetup {
|
||||
/// Draw content for phrase import step.
|
||||
pub fn import_ui(&mut self, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks) {
|
||||
self.ui(ui, cb);
|
||||
|
||||
ui.add_space(10.0);
|
||||
|
||||
// Show mode and type setup.
|
||||
@@ -88,10 +89,12 @@ impl MnemonicSetup {
|
||||
ui.add_space(6.0);
|
||||
|
||||
// Show words setup.
|
||||
self.word_list_ui(ui, self.mnemonic.mode() == PhraseMode::Import);
|
||||
self.word_list_ui(ui, true);
|
||||
}
|
||||
/// Draw content for phrase confirmation step.
|
||||
pub fn confirm_ui(&mut self, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks) {
|
||||
self.ui(ui, cb);
|
||||
|
||||
ui.add_space(4.0);
|
||||
ui.vertical_centered(|ui| {
|
||||
let text = format!("{}:", t!("wallets.recovery_phrase"));
|
||||
|
||||
@@ -69,32 +69,7 @@ impl ContentContainer for WalletContent {
|
||||
true
|
||||
}
|
||||
|
||||
fn container_ui(&mut self, _: &mut egui::Ui, _: &dyn PlatformCallbacks) {}
|
||||
}
|
||||
|
||||
impl WalletContent {
|
||||
/// Create new instance with optional data.
|
||||
pub fn new(wallet: Wallet, data: Option<String>) -> Self {
|
||||
let accounts_modal = WalletAccountsModal::new(wallet.accounts());
|
||||
let mut content = Self {
|
||||
wallet,
|
||||
accounts_modal_content: accounts_modal,
|
||||
qr_scan_content: None,
|
||||
current_tab: Box::new(WalletTransactions::default()),
|
||||
};
|
||||
if data.is_some() {
|
||||
content.on_data(data);
|
||||
}
|
||||
content
|
||||
}
|
||||
|
||||
/// Handle data from deeplink or opened file.
|
||||
pub fn on_data(&mut self, data: Option<String>) {
|
||||
self.current_tab = Box::new(WalletMessages::new(data));
|
||||
}
|
||||
|
||||
/// Draw wallet content.
|
||||
pub fn ui(&mut self, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks) {
|
||||
fn container_ui(&mut self, ui: &mut egui::Ui, cb: &dyn PlatformCallbacks) {
|
||||
ui.ctx().request_repaint_after(Duration::from_millis(1000));
|
||||
|
||||
let dual_panel = Content::is_dual_panel_mode(ui.ctx());
|
||||
@@ -262,6 +237,28 @@ impl WalletContent {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
impl WalletContent {
|
||||
/// Create new instance with optional data.
|
||||
pub fn new(wallet: Wallet, data: Option<String>) -> Self {
|
||||
let accounts_modal = WalletAccountsModal::new(wallet.accounts());
|
||||
let mut content = Self {
|
||||
wallet,
|
||||
accounts_modal_content: accounts_modal,
|
||||
qr_scan_content: None,
|
||||
current_tab: Box::new(WalletTransactions::default()),
|
||||
};
|
||||
if data.is_some() {
|
||||
content.on_data(data);
|
||||
}
|
||||
content
|
||||
}
|
||||
|
||||
/// Handle data from deeplink or opened file.
|
||||
pub fn on_data(&mut self, data: Option<String>) {
|
||||
self.current_tab = Box::new(WalletMessages::new(data));
|
||||
}
|
||||
|
||||
/// Check when to block tabs navigation on sync progress.
|
||||
pub fn block_navigation_on_sync(wallet: &Wallet) -> bool {
|
||||
|
||||
@@ -63,7 +63,7 @@ impl WalletTransactionModal {
|
||||
/// Create new content instance with [`Wallet`] from provided [`WalletTransaction`].
|
||||
pub fn new(tx_id: Option<u32>, show_finalization: bool) -> Self {
|
||||
Self {
|
||||
tx_id: tx_id.unwrap(),
|
||||
tx_id: tx_id.unwrap_or(0),
|
||||
response_edit: None,
|
||||
finalize_edit: "".to_string(),
|
||||
finalize_error: false,
|
||||
|
||||
Reference in New Issue
Block a user