diff --git a/gui/src/app/state/settings/mod.rs b/gui/src/app/state/settings/mod.rs index ad88a406b..b24feab8a 100644 --- a/gui/src/app/state/settings/mod.rs +++ b/gui/src/app/state/settings/mod.rs @@ -78,7 +78,12 @@ impl State for SettingsState { } Message::View(view::Message::Settings(view::SettingsMessage::EditWalletSettings)) => { self.setting = Some( - WalletSettingsState::new(self.data_dir.clone(), self.wallet.clone()).into(), + WalletSettingsState::new( + self.data_dir.clone(), + self.wallet.clone(), + daemon.get_info().unwrap().timestamp, + ) + .into(), ); self.setting .as_mut() diff --git a/gui/src/app/state/settings/wallet.rs b/gui/src/app/state/settings/wallet.rs index 8686a9809..e8903d173 100644 --- a/gui/src/app/state/settings/wallet.rs +++ b/gui/src/app/state/settings/wallet.rs @@ -29,10 +29,11 @@ pub struct WalletSettingsState { modal: Option, processing: bool, updated: bool, + creation_date: u32, } impl WalletSettingsState { - pub fn new(data_dir: PathBuf, wallet: Arc) -> Self { + pub fn new(data_dir: PathBuf, wallet: Arc, creation_date: u32) -> Self { WalletSettingsState { data_dir, descriptor: wallet.main_descriptor.to_string(), @@ -42,6 +43,7 @@ impl WalletSettingsState { modal: None, processing: false, updated: false, + creation_date, } } @@ -81,6 +83,7 @@ impl State for WalletSettingsState { &self.keys_aliases, self.processing, self.updated, + self.creation_date, ); if let Some(m) = &self.modal { modal::Modal::new(content, m.view()) diff --git a/gui/src/app/view/settings.rs b/gui/src/app/view/settings.rs index 4618ad4b0..b9c889b19 100644 --- a/gui/src/app/view/settings.rs +++ b/gui/src/app/view/settings.rs @@ -589,6 +589,7 @@ pub fn wallet_settings<'a>( keys_aliases: &[(Fingerprint, form::Value)], processing: bool, updated: bool, + creation_date: u32, ) -> Element<'a, Message> { dashboard( &Menu::Settings, @@ -612,6 +613,7 @@ pub fn wallet_settings<'a>( .on_press(Message::Settings(SettingsMessage::AboutSection)), ), ) + .push_maybe(creation_date_message(creation_date)) .push(card::simple( Column::new() .push(text("Wallet descriptor:").bold()) @@ -738,3 +740,15 @@ pub fn register_wallet_modal<'a>( .width(Length::Fixed(500.0)) .into() } + +pub fn creation_date_message(creation_date: u32) -> Option> { + if let Some(datetime) = chrono::NaiveDateTime::from_timestamp_opt(creation_date as i64, 0) { + return Some( + Row::new() + .push(text("Wallet creation date:").bold()) + .spacing(10) + .push(text(datetime.format("%m/%d/%Y").to_string())), + ); + } + None +}