From 5cc3a0dfdba4da55ebf2c887196d19bb82e7f279 Mon Sep 17 00:00:00 2001 From: Lukas Bielesch Date: Tue, 4 Mar 2025 08:03:29 +0100 Subject: [PATCH] refactor(eckhart): update fonts and disabled button style - Fix translation pattern --- .../generated/translated_string.rs | 2 +- .../layout_eckhart/firmware/keyboard/pin.rs | 6 +-- .../ui/layout_eckhart/flow/confirm_reset.rs | 2 +- .../ui/layout_eckhart/flow/prompt_backup.rs | 2 +- .../src/ui/layout_eckhart/theme/firmware.rs | 42 ++++++++++++++++--- .../rust/src/ui/layout_eckhart/theme/mod.rs | 4 +- core/translations/en.json | 2 +- 7 files changed, 45 insertions(+), 15 deletions(-) diff --git a/core/embed/rust/src/translations/generated/translated_string.rs b/core/embed/rust/src/translations/generated/translated_string.rs index 495d6a9ec6..96b114e872 100644 --- a/core/embed/rust/src/translations/generated/translated_string.rs +++ b/core/embed/rust/src/translations/generated/translated_string.rs @@ -829,7 +829,7 @@ pub enum TranslatedString { reset__recovery_share_title_template = 567, // "Recovery share #{0}" reset__required_number_of_groups = 568, // "The required number of groups for recovery." reset__select_correct_word = 569, // "Select the correct word for each position." - reset__select_word_template = 570, // {"Bolt": "Select {0} word", "Caesar": "Select {0} word", "Delizia": "Select {0} word", "Eckhart": "Select word no. {0} from your wallet backup"} + reset__select_word_template = 570, // {"Bolt": "Select {0} word", "Caesar": "Select {0} word", "Delizia": "Select {0} word", "Eckhart": "Select word #{0} from your wallet backup"} reset__select_word_x_of_y_template = 571, // "Select word {0} of {1}:" reset__set_it_to_count_template = 572, // "Set it to {0} and you will need " reset__share_checked_successfully_template = 573, // "Share #{0} checked successfully." diff --git a/core/embed/rust/src/ui/layout_eckhart/firmware/keyboard/pin.rs b/core/embed/rust/src/ui/layout_eckhart/firmware/keyboard/pin.rs index 297e29273c..5eaa2db041 100644 --- a/core/embed/rust/src/ui/layout_eckhart/firmware/keyboard/pin.rs +++ b/core/embed/rust/src/ui/layout_eckhart/firmware/keyboard/pin.rs @@ -57,7 +57,7 @@ impl<'a> PinKeyboard<'a> { .vertically_centered(), major_warning: major_warning .map(|text| Label::left_aligned(text, theme::TEXT_SMALL).vertically_centered()), - input: PinInput::new(theme::TEXT_MONO_LIGHT), + input: PinInput::new(), keypad: Keypad::new_numeric(true), warning_timer: Timer::new(), } @@ -258,7 +258,6 @@ pub enum PinInputMsg { struct PinInput { area: Rect, - style: TextStyle, digits: ShortString, display_style: DisplayStyle, last_digit_timer: Timer, @@ -278,10 +277,9 @@ impl PinInput { const ICON_WIDTH: i16 = Self::PIN_ICON.toif.width(); const ICON_SPACE: i16 = 12; - fn new(style: TextStyle) -> Self { + fn new() -> Self { Self { area: Rect::zero(), - style, digits: ShortString::new(), display_style: DisplayStyle::Hidden, last_digit_timer: Timer::new(), diff --git a/core/embed/rust/src/ui/layout_eckhart/flow/confirm_reset.rs b/core/embed/rust/src/ui/layout_eckhart/flow/confirm_reset.rs index fa5b55fd23..87895112b6 100644 --- a/core/embed/rust/src/ui/layout_eckhart/flow/confirm_reset.rs +++ b/core/embed/rust/src/ui/layout_eckhart/flow/confirm_reset.rs @@ -80,7 +80,7 @@ pub fn new_confirm_reset(recovery: bool) -> Result { let content_menu = VerticalMenuScreen::new( VerticalMenu::empty().item( Button::with_text(TR::buttons__cancel.into()) - .styled(theme::menu_item_title_red()) + .styled(theme::menu_item_title_orange()) .with_text_align(Alignment::Start) .with_content_offset(Offset::x(12)), ), diff --git a/core/embed/rust/src/ui/layout_eckhart/flow/prompt_backup.rs b/core/embed/rust/src/ui/layout_eckhart/flow/prompt_backup.rs index f27cca0738..d152636896 100644 --- a/core/embed/rust/src/ui/layout_eckhart/flow/prompt_backup.rs +++ b/core/embed/rust/src/ui/layout_eckhart/flow/prompt_backup.rs @@ -77,7 +77,7 @@ pub fn new_prompt_backup() -> Result { let content_menu = VerticalMenuScreen::new( VerticalMenu::empty().item( Button::with_text(TR::backup__title_skip.into()) - .styled(theme::menu_item_title_red()) + .styled(theme::menu_item_title_orange()) .with_text_align(Alignment::Start) .with_content_offset(Offset::x(12)), ), diff --git a/core/embed/rust/src/ui/layout_eckhart/theme/firmware.rs b/core/embed/rust/src/ui/layout_eckhart/theme/firmware.rs index 2997dcb649..d77933fe79 100644 --- a/core/embed/rust/src/ui/layout_eckhart/theme/firmware.rs +++ b/core/embed/rust/src/ui/layout_eckhart/theme/firmware.rs @@ -1,4 +1,10 @@ -use crate::{time::Duration, ui::component::text::TextStyle}; +use crate::{ + time::Duration, + ui::component::text::{ + layout::{Chunks, LineBreaking, PageBreaking}, + TextStyle, + }, +}; use super::{ super::{ @@ -61,16 +67,42 @@ pub const TEXT_MONO_MEDIUM: TextStyle = TextStyle::new( /// Roboto Mono Light - 30 (Address, data) pub const TEXT_MONO_LIGHT: TextStyle = TextStyle::new( fonts::FONT_MONO_LIGHT_30, + GREY_LIGHT, + BG, + GREY_LIGHT, + GREY_LIGHT, +); + +pub const TEXT_MEDIUM_EXTRA_LIGHT: TextStyle = TextStyle::new( + fonts::FONT_SATOSHI_MEDIUM_26, GREY_EXTRA_LIGHT, BG, GREY_EXTRA_LIGHT, GREY_EXTRA_LIGHT, ); +pub const TEXT_SMALL_LIGHT: TextStyle = TextStyle::new( + fonts::FONT_SATOSHI_REGULAR_22, + GREY_LIGHT, + BG, + GREY_LIGHT, + GREY_LIGHT, +) +.with_line_spacing(-4); + +/// Makes sure that the displayed text (usually address) will get divided into +/// smaller chunks. +pub const TEXT_MONO_ADDRESS_CHUNKS: TextStyle = TEXT_MONO_LIGHT + .with_chunks(Chunks::new(4, 8)) + .with_line_spacing(24); + +pub const TEXT_MONO_ADDRESS: TextStyle = TEXT_MONO_LIGHT + .with_line_breaking(LineBreaking::BreakWordsNoHyphen) + .with_page_breaking(PageBreaking::CutAndInsertEllipsis); + /// Decide the text style of chunkified text according to its length. pub fn get_chunkified_text_style(_character_length: usize) -> &'static TextStyle { - // TODO: implement properly for Eckhart, see Delizia implemenation - &TEXT_MONO_MEDIUM + &TEXT_MONO_ADDRESS_CHUNKS } pub const TEXT_MONO_EXTRA_LIGHT: TextStyle = TextStyle::new( @@ -255,8 +287,8 @@ pub const fn menu_item_title_yellow() -> ButtonStyleSheet { menu_item_title!(YELLOW) } -pub const fn menu_item_title_red() -> ButtonStyleSheet { - menu_item_title!(RED) +pub const fn menu_item_title_orange() -> ButtonStyleSheet { + menu_item_title!(ORANGE) } pub const fn button_select_word() -> ButtonStyleSheet { diff --git a/core/embed/rust/src/ui/layout_eckhart/theme/mod.rs b/core/embed/rust/src/ui/layout_eckhart/theme/mod.rs index 96a1526b3b..f331ccdb71 100644 --- a/core/embed/rust/src/ui/layout_eckhart/theme/mod.rs +++ b/core/embed/rust/src/ui/layout_eckhart/theme/mod.rs @@ -113,9 +113,9 @@ pub const fn button_default() -> ButtonStyleSheet { disabled: &ButtonStyle { font: fonts::FONT_SATOSHI_MEDIUM_26, text_color: GREY_LIGHT, - button_color: GREY_DARK, + button_color: BG, icon_color: GREY_LIGHT, - background_color: GREY_DARK, + background_color: BG, }, } } diff --git a/core/translations/en.json b/core/translations/en.json index d537cc5b7f..29a082494b 100644 --- a/core/translations/en.json +++ b/core/translations/en.json @@ -694,7 +694,7 @@ "Bolt": "Select {0} word", "Caesar": "Select {0} word", "Delizia": "Select {0} word", - "Eckhart": "Select word no. {0} from your wallet backup" + "Eckhart": "Select word #{0} from your wallet backup" }, "reset__select_word_x_of_y_template": "Select word {0} of {1}:", "reset__set_it_to_count_template": "Set it to {0} and you will need ",