ui: optimize ui ids formatting

This commit is contained in:
ardocrat 2023-08-13 01:52:01 +03:00
parent 81382ba841
commit 0a35ffbdff
2 changed files with 5 additions and 5 deletions

View file

@ -17,8 +17,8 @@ use egui::style::Margin;
use egui_extras::{Size, Strip, StripBuilder}; use egui_extras::{Size, Strip, StripBuilder};
use crate::gui::Colors; use crate::gui::Colors;
use crate::gui::views::types::{TitleContentType, TitleType};
use crate::gui::views::{Root, View}; use crate::gui::views::{Root, View};
use crate::gui::views::types::{TitleContentType, TitleType};
/// Title panel with left/right action buttons and text in the middle. /// Title panel with left/right action buttons and text in the middle.
pub struct TitlePanel; pub struct TitlePanel;
@ -50,7 +50,7 @@ impl TitlePanel {
TitleContentType::Title(text) => text, TitleContentType::Title(text) => text,
TitleContentType::WithSubTitle(text, _, _) => text TitleContentType::WithSubTitle(text, _, _) => text
}; };
let id = Id::from(format!("{}_{}", first_text, second_text)); let id = Id::from(first_text.to_owned()).with(second_text);
(id, true) (id, true)
}, },
}; };

View file

@ -105,7 +105,7 @@ impl MnemonicSetup {
ui.add_space(4.0); ui.add_space(4.0);
ui.vertical_centered(|ui| { ui.vertical_centered(|ui| {
let text = format!("{}:", t!("wallets.saved_phrase")); let text = format!("{}:", t!("wallets.recovery_phrase"));
ui.label(RichText::new(text).size(16.0).color(Colors::GRAY)); ui.label(RichText::new(text).size(16.0).color(Colors::GRAY));
}); });
ui.add_space(4.0); ui.add_space(4.0);
@ -236,7 +236,7 @@ impl MnemonicSetup {
// Show word edit modal. // Show word edit modal.
Modal::new(WORD_INPUT_MODAL) Modal::new(WORD_INPUT_MODAL)
.position(ModalPosition::CenterTop) .position(ModalPosition::CenterTop)
.title(t!("wallets.saved_phrase")) .title(t!("wallets.recovery_phrase"))
.show(); .show();
cb.show_keyboard(); cb.show_keyboard();
}); });
@ -266,7 +266,7 @@ impl MnemonicSetup {
// Draw word value text edit. // Draw word value text edit.
let text_edit_resp = egui::TextEdit::singleline(&mut self.word_edit) let text_edit_resp = egui::TextEdit::singleline(&mut self.word_edit)
.id(Id::from(format!("{}{}", modal.id, self.word_num_edit))) .id(Id::from(modal.id).with(self.word_num_edit))
.font(TextStyle::Heading) .font(TextStyle::Heading)
.desired_width(ui.available_width()) .desired_width(ui.available_width())
.cursor_at_end(true) .cursor_at_end(true)