Skip to content

Commit 97ded2f

Browse files
committed
fixup! chore(core/eckhart): make paginate buttons equally sized
1 parent f34bff2 commit 97ded2f

File tree

2 files changed

+30
-21
lines changed

2 files changed

+30
-21
lines changed

core/embed/rust/src/ui/layout_eckhart/firmware/action_bar.rs

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -137,22 +137,7 @@ impl ActionBar {
137137
/// mode can only return `ActionBarMsg::Prev` and `ActionBarMsg::Next`
138138
/// messages.
139139
pub fn new_paginate_only() -> Self {
140-
Self::new(
141-
Mode::PaginateOnly,
142-
Some(
143-
Button::with_icon(theme::ICON_CHEVRON_UP)
144-
.with_expanded_touch_area(Self::BUTTON_EXPAND_TOUCH)
145-
.with_content_offset(Self::BUTTON_CONTENT_OFFSET)
146-
.initially_enabled(false),
147-
),
148-
Some(
149-
Button::with_icon(theme::ICON_CHEVRON_DOWN)
150-
.with_expanded_touch_area(Self::BUTTON_EXPAND_TOUCH)
151-
.with_content_offset(Self::BUTTON_CONTENT_OFFSET.neg())
152-
.initially_enabled(false),
153-
),
154-
None,
155-
)
140+
Self::new(Mode::PaginateOnly, None, None, None)
156141
}
157142

158143
pub fn new_text_only(text: TString<'static>) -> Self {
@@ -196,9 +181,33 @@ impl ActionBar {
196181
let new_is_last = new_pager.is_last();
197182
let old_is_first = self.pager.is_first();
198183
let new_is_first = new_pager.is_first();
184+
let old_is_single = self.pager.is_single();
185+
let new_is_single = new_pager.is_single();
199186

200187
self.pager = new_pager;
201-
if (old_is_last != new_is_last) || (new_is_first != old_is_first) {
188+
if self.mode == Mode::PaginateOnly {
189+
if new_is_single && !old_is_single {
190+
// On single page, disable first/last buttons
191+
self.left_button = None;
192+
self.right_button = None;
193+
self.place_buttons(self.area);
194+
} else if !new_is_single && old_is_single {
195+
// On multiple pages, enable grayed-out first/last buttons
196+
self.left_button = Some(
197+
Button::with_icon(theme::ICON_CHEVRON_UP)
198+
.with_expanded_touch_area(Self::BUTTON_EXPAND_TOUCH)
199+
.with_content_offset(Self::BUTTON_CONTENT_OFFSET)
200+
.initially_enabled(false),
201+
);
202+
self.right_button = Some(
203+
Button::with_icon(theme::ICON_CHEVRON_DOWN)
204+
.with_expanded_touch_area(Self::BUTTON_EXPAND_TOUCH)
205+
.with_content_offset(Self::BUTTON_CONTENT_OFFSET.neg())
206+
.initially_enabled(false),
207+
);
208+
self.place_buttons(self.area);
209+
}
210+
} else if (old_is_last != new_is_last) || (new_is_first != old_is_first) {
202211
self.place_buttons(self.area);
203212
}
204213
}
@@ -351,10 +360,10 @@ impl ActionBar {
351360
Mode::PaginateOnly => {
352361
// Equal-sized `next_button` and `prev_button`
353362
let (left_area, _, right_area) = bounds.split_center(Self::SPACER_WIDTH);
354-
self.left_button.place(left_area);
355-
self.right_button.place(right_area);
356363
self.prev_button.place(left_area);
357364
self.next_button.place(right_area);
365+
self.left_button.place(left_area);
366+
self.right_button.place(right_area);
358367
}
359368
}
360369
}
@@ -469,7 +478,7 @@ impl Component for ActionBar {
469478
Mode::Single => !self.pager.is_first(),
470479
Mode::Double { .. } => true,
471480
Mode::Timeout => false,
472-
Mode::PaginateOnly => true,
481+
Mode::PaginateOnly => !self.pager.is_single(),
473482
};
474483
if show_divider {
475484
let pos_divider = self.prev_button.area().right_center();

core/embed/rust/src/ui/layout_eckhart/theme/firmware.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ pub const fn button_default() -> ButtonStyleSheet {
193193
},
194194
disabled: &ButtonStyle {
195195
font: fonts::FONT_SATOSHI_MEDIUM_26,
196-
text_color: GREY_EXTRA_DARK,
196+
text_color: GREY,
197197
button_color: BG,
198198
icon_color: GREY_EXTRA_DARK,
199199
},

0 commit comments

Comments
 (0)