1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-04-10 04:16:16 +00:00

feat(eckhart): improve confirmations

This commit is contained in:
obrusvit 2025-03-30 19:36:23 +02:00 committed by Vít Obrusník
parent 10771ec7aa
commit 36d77044d4
4 changed files with 829 additions and 836 deletions

View File

@ -110,7 +110,7 @@ impl ActionBar {
pub fn new_cancel_confirm() -> Self {
Self::new_double(
Button::with_icon(theme::ICON_CROSS).styled(theme::button_cancel()),
Button::with_icon(theme::ICON_CROSS),
Button::with_text(TR::buttons__confirm.into()),
)
}

View File

@ -70,10 +70,11 @@ impl Component for ConfirmHomescreen {
let (header_area, rest) = bounds.split_top(Header::HEADER_HEIGHT);
let (rest, action_bar_area) = rest.split_bottom(ActionBar::ACTION_BAR_HEIGHT);
let text_area = rest.inset(theme::SIDE_INSETS);
self.header.place(header_area);
self.action_bar.place(action_bar_area);
self.text.place(rest);
self.text.place(text_area);
bounds
}

View File

@ -53,31 +53,22 @@ impl FirmwareUI for UIEckhart {
_prompt_screen: bool,
_prompt_title: Option<TString<'static>>,
) -> Result<impl LayoutMaybeTrace, Error> {
let action = action.unwrap_or("".into());
let formatted_text = {
let mut ops = OpTextLayout::new(theme::TEXT_NORMAL);
let paragraphs = {
let action = action.unwrap_or("".into());
let description = description.unwrap_or("".into());
let mut paragraphs = ParagraphVecShort::new();
if !reverse {
ops = ops
.color(theme::GREY_LIGHT)
.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);
}
paragraphs
.add(Paragraph::new(&theme::TEXT_REGULAR, action))
.add(Paragraph::new(&theme::TEXT_REGULAR, description));
} else {
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);
};
FormattedText::new(ops)
paragraphs
.add(Paragraph::new(&theme::TEXT_REGULAR, description))
.add(Paragraph::new(&theme::TEXT_REGULAR, action));
}
paragraphs.into_paragraphs().with_placement(
LinearPlacement::vertical().with_spacing(theme::TEXT_VERTICAL_SPACING),
)
};
let verb = verb.unwrap_or(TR::buttons__confirm.into());
@ -86,10 +77,11 @@ impl FirmwareUI for UIEckhart {
} else {
Button::with_text(verb)
};
let mut screen = TextScreen::new(formatted_text)
.with_header(Header::new(title).with_menu_button())
let mut screen = TextScreen::new(paragraphs)
.with_header(Header::new(title))
.with_action_bar(ActionBar::new_double(
Button::with_icon(theme::ICON_CHEVRON_LEFT),
Button::with_icon(theme::ICON_CROSS),
right_button,
));
if let Some(subtitle) = subtitle {

File diff suppressed because it is too large Load Diff