1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-06-26 09:52:34 +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 0bc1f2f44d
commit 19b116894e
4 changed files with 829 additions and 836 deletions

View File

@ -110,7 +110,7 @@ impl ActionBar {
pub fn new_cancel_confirm() -> Self { pub fn new_cancel_confirm() -> Self {
Self::new_double( 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()), 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 (header_area, rest) = bounds.split_top(Header::HEADER_HEIGHT);
let (rest, action_bar_area) = rest.split_bottom(ActionBar::ACTION_BAR_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.header.place(header_area);
self.action_bar.place(action_bar_area); self.action_bar.place(action_bar_area);
self.text.place(rest); self.text.place(text_area);
bounds bounds
} }

View File

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

File diff suppressed because it is too large Load Diff