Skip to content

Commit

Permalink
fix(core/ui): use "..." ellipsis on "show_more"
Browse files Browse the repository at this point in the history
  • Loading branch information
ibz committed Mar 5, 2025
1 parent 0d522be commit b6b8363
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 4 deletions.
5 changes: 5 additions & 0 deletions core/embed/rust/src/ui/layout_bolt/theme/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,11 @@ pub const TEXT_MONO: TextStyle = TextStyle::new(fonts::FONT_MONO, FG, BG, GREY_L
.with_page_breaking(PageBreaking::CutAndInsertEllipsisBoth)
.with_ellipsis_icon(ICON_PAGE_NEXT, 0)
.with_prev_page_icon(ICON_PAGE_PREV, 0);
pub const TEXT_MONO_WITH_CLASSIC_ELLIPSIS: TextStyle =
TextStyle::new(fonts::FONT_MONO, FG, BG, GREY_LIGHT, GREY_LIGHT)
.with_line_breaking(LineBreaking::BreakWordsNoHyphen)
.with_page_breaking(PageBreaking::CutAndInsertEllipsis)
.with_prev_page_icon(ICON_PAGE_PREV, 0);
/// Makes sure that the displayed text (usually address) will get divided into
/// smaller chunks.
pub const TEXT_MONO_ADDRESS_CHUNKS: TextStyle = TEXT_MONO
Expand Down
2 changes: 1 addition & 1 deletion core/embed/rust/src/ui/layout_bolt/ui_firmware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ impl FirmwareUI for UIBolt {
let [text, is_data]: [Obj; 2] = util::iter_into_array(para)?;
let is_data = is_data.try_into()?;
let style: &TextStyle = if is_data {
&theme::TEXT_MONO
&theme::TEXT_MONO_WITH_CLASSIC_ELLIPSIS
} else {
&theme::TEXT_NORMAL
};
Expand Down
6 changes: 6 additions & 0 deletions core/embed/rust/src/ui/layout_caesar/theme/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,15 @@ pub const TEXT_MONO: TextStyle = TextStyle::new(fonts::FONT_MONO, FG, BG, FG, FG
.with_page_breaking(PageBreaking::CutAndInsertEllipsisBoth)
.with_ellipsis_icon(ICON_NEXT_PAGE, ELLIPSIS_ICON_MARGIN)
.with_prev_page_icon(ICON_PREV_PAGE, PREV_PAGE_ICON_MARGIN);
pub const TEXT_MONO_WITH_CLASSIC_ELLIPSIS: TextStyle =
TextStyle::new(fonts::FONT_MONO, FG, BG, FG, FG)
.with_page_breaking(PageBreaking::CutAndInsertEllipsisBoth)
.with_prev_page_icon(ICON_PREV_PAGE, PREV_PAGE_ICON_MARGIN);
/// Mono data text does not have hyphens
pub const TEXT_MONO_DATA: TextStyle =
TEXT_MONO.with_line_breaking(LineBreaking::BreakWordsNoHyphen);
pub const TEXT_MONO_DATA_WITH_CLASSIC_ELLIPSIS: TextStyle =
TEXT_MONO_WITH_CLASSIC_ELLIPSIS.with_line_breaking(LineBreaking::BreakWordsNoHyphen);
pub const TEXT_MONO_ADDRESS_CHUNKS: TextStyle = TEXT_MONO_DATA
.with_chunks(MONO_CHUNKS)
.with_line_spacing(2)
Expand Down
2 changes: 1 addition & 1 deletion core/embed/rust/src/ui/layout_caesar/ui_firmware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ impl FirmwareUI for UICaesar {
let [text, is_data]: [Obj; 2] = util::iter_into_array(para)?;
let is_data = is_data.try_into()?;
let style: &TextStyle = if is_data {
&theme::TEXT_MONO_DATA
&theme::TEXT_MONO_DATA_WITH_CLASSIC_ELLIPSIS
} else {
&theme::TEXT_NORMAL
};
Expand Down
19 changes: 17 additions & 2 deletions core/embed/rust/src/ui/layout_delizia/flow/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ pub struct ConfirmValue {
text_mono: bool,
page_counter: bool,
page_limit: Option<u16>,
classic_ellipsis: bool,
swipe_up: bool,
swipe_down: bool,
swipe_right: bool,
Expand Down Expand Up @@ -77,6 +78,7 @@ impl ConfirmValue {
text_mono: true,
page_counter: false,
page_limit: None,
classic_ellipsis: false,
swipe_up: false,
swipe_down: false,
swipe_right: false,
Expand Down Expand Up @@ -201,6 +203,11 @@ impl ConfirmValue {
self
}

pub const fn with_classic_ellipsis(mut self, classic_ellipsis: bool) -> Self {
self.classic_ellipsis = classic_ellipsis;
self
}

pub const fn with_description_font(mut self, description_font: &'static TextStyle) -> Self {
self.description_font = description_font;
self
Expand All @@ -221,7 +228,11 @@ impl ConfirmValue {
let value: TString = self.value.try_into()?;
theme::get_chunkified_text_style(value.len())
} else if self.text_mono {
&theme::TEXT_MONO
if self.classic_ellipsis {
&theme::TEXT_MONO_WITH_CLASSIC_ELLIPSIS
} else {
&theme::TEXT_MONO
}
} else {
&theme::TEXT_NORMAL
},
Expand Down Expand Up @@ -272,7 +283,11 @@ impl ConfirmValue {
let value: TString = self.value.try_into()?;
theme::get_chunkified_text_style(value.len())
} else if self.text_mono {
&theme::TEXT_MONO
if self.classic_ellipsis {
&theme::TEXT_MONO_WITH_CLASSIC_ELLIPSIS
} else {
&theme::TEXT_MONO
}
} else {
&theme::TEXT_NORMAL
},
Expand Down
5 changes: 5 additions & 0 deletions core/embed/rust/src/ui/layout_delizia/theme/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,11 @@ pub const TEXT_MONO: TextStyle = TextStyle::new(fonts::FONT_MONO, GREY_EXTRA_LIG
.with_page_breaking(PageBreaking::CutAndInsertEllipsisBoth)
.with_ellipsis_icon(ICON_PAGE_NEXT, 0)
.with_prev_page_icon(ICON_PAGE_PREV, 0);
pub const TEXT_MONO_WITH_CLASSIC_ELLIPSIS: TextStyle =
TextStyle::new(fonts::FONT_MONO, GREY_EXTRA_LIGHT, BG, GREY, GREY)
.with_line_breaking(LineBreaking::BreakWordsNoHyphen)
.with_page_breaking(PageBreaking::CutAndInsertEllipsisBoth)
.with_prev_page_icon(ICON_PAGE_PREV, 0);
pub const TEXT_MONO_GREY_LIGHT: TextStyle = TextStyle {
text_color: GREY_LIGHT,
..TEXT_MONO
Expand Down
1 change: 1 addition & 0 deletions core/embed/rust/src/ui/layout_delizia/ui_firmware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ impl FirmwareUI for UIDelizia {
.with_footer_description(verb)
.with_chunkify(chunkify)
.with_page_limit(Some(1))
.with_classic_ellipsis(true)
.with_frame_margin(CONFIRM_VALUE_INTRO_MARGIN)
.with_hold(hold)
.into_flow()
Expand Down

0 comments on commit b6b8363

Please sign in to comment.