1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-03-02 16:26:19 +00:00

refactor(eckhart): ignore empty description

- don't show empty text in confirm_action
This commit is contained in:
obrusvit 2025-03-01 14:09:27 +01:00
parent 5edb72ebe9
commit aaaf074a70

View File

@ -48,22 +48,28 @@ impl FirmwareUI for UIEckhart {
_prompt_title: Option<TString<'static>>,
) -> Result<impl LayoutMaybeTrace, Error> {
let action = action.unwrap_or("".into());
let description = description.unwrap_or("".into());
let formatted_text = {
let ops = if !reverse {
OpTextLayout::new(theme::TEXT_NORMAL)
let mut ops = OpTextLayout::new(theme::TEXT_NORMAL);
if !reverse {
ops = ops
.color(theme::GREY_LIGHT)
.text(action, fonts::FONT_SATOSHI_REGULAR_38)
.newline()
.color(theme::GREY)
.text(description, fonts::FONT_SATOSHI_REGULAR_22)
.text(action, fonts::FONT_SATOSHI_REGULAR_38);
if let Some(description) = description {
ops = ops
.newline()
.color(theme::GREY)
.text(description, fonts::FONT_SATOSHI_REGULAR_22);
}
} else {
OpTextLayout::new(theme::TEXT_NORMAL)
.color(theme::GREY)
.text(description, fonts::FONT_SATOSHI_REGULAR_22)
.newline()
if let Some(description) = description {
ops = ops
.color(theme::GREY)
.text(description, fonts::FONT_SATOSHI_REGULAR_22)
.newline();
}
ops = ops
.color(theme::GREY_LIGHT)
.text(action, fonts::FONT_SATOSHI_REGULAR_38)
.text(action, fonts::FONT_SATOSHI_REGULAR_38);
};
FormattedText::new(ops).vertically_centered()
};
@ -76,7 +82,7 @@ impl FirmwareUI for UIEckhart {
};
let screen = TextScreen::new(formatted_text)
.with_header(Header::new(title).with_menu_button())
.with_hint(Hint::new_instruction(description, None))
// .with_hint(Hint::new_instruction(description, None))
.with_action_bar(ActionBar::new_double(
Button::with_icon(theme::ICON_CHEVRON_LEFT),
right_button,