ui: selected wallet title
This commit is contained in:
parent
e235123516
commit
065f7d6cd5
2 changed files with 21 additions and 3 deletions
|
@ -229,13 +229,22 @@ impl WalletsContent {
|
||||||
dual_panel: bool,
|
dual_panel: bool,
|
||||||
create_wallet: bool,
|
create_wallet: bool,
|
||||||
show_wallet: bool) {
|
show_wallet: bool) {
|
||||||
// Setup title text.
|
let show_list = self.show_wallets_at_dual_panel;
|
||||||
|
|
||||||
|
// Setup title.
|
||||||
let title_text = if create_wallet {
|
let title_text = if create_wallet {
|
||||||
t!("wallets.add")
|
t!("wallets.add")
|
||||||
} else {
|
} else {
|
||||||
t!("wallets.title")
|
t!("wallets.title")
|
||||||
};
|
};
|
||||||
let title_content = TitleType::Single(title_text.to_uppercase());
|
let title_content = if self.wallets.is_selected_open() && (!dual_panel
|
||||||
|
|| (dual_panel && !show_list)) {
|
||||||
|
let title_text = t!("wallets.wallet").to_uppercase();
|
||||||
|
let subtitle_text = self.wallets.selected_name();
|
||||||
|
TitleType::WithSubTitle(title_text, subtitle_text, false)
|
||||||
|
} else {
|
||||||
|
TitleType::Single(title_text.to_uppercase())
|
||||||
|
};
|
||||||
|
|
||||||
// Draw title panel.
|
// Draw title panel.
|
||||||
TitlePanel::ui(title_content, |ui, frame| {
|
TitlePanel::ui(title_content, |ui, frame| {
|
||||||
|
@ -248,7 +257,6 @@ impl WalletsContent {
|
||||||
self.creation_content.back();
|
self.creation_content.back();
|
||||||
});
|
});
|
||||||
} else if show_wallet && dual_panel {
|
} else if show_wallet && dual_panel {
|
||||||
let show_list = self.show_wallets_at_dual_panel;
|
|
||||||
let list_icon = if show_list {
|
let list_icon = if show_list {
|
||||||
SIDEBAR_SIMPLE
|
SIDEBAR_SIMPLE
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -88,6 +88,16 @@ impl Wallets {
|
||||||
self.selected_id = id;
|
self.selected_id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get selected [`Wallet`] name.
|
||||||
|
pub fn selected_name(&self) -> String {
|
||||||
|
for w in &self.list {
|
||||||
|
if Some(w.config.id) == self.selected_id {
|
||||||
|
return w.config.name.to_owned()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
t!("wallets.unlocked")
|
||||||
|
}
|
||||||
|
|
||||||
/// Check if [`Wallet`] is selected for provided identifier.
|
/// Check if [`Wallet`] is selected for provided identifier.
|
||||||
pub fn is_selected(&self, id: i64) -> bool {
|
pub fn is_selected(&self, id: i64) -> bool {
|
||||||
return Some(id) == self.selected_id;
|
return Some(id) == self.selected_id;
|
||||||
|
|
Loading…
Reference in a new issue