1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-04 21:48:17 +00:00

fixup! refactor(core): mercury confirm_summary

This commit is contained in:
obrusvit 2024-12-02 13:48:12 +01:00
parent ff7f6ea446
commit 29cf6d3557
3 changed files with 6 additions and 6 deletions

View File

@ -85,7 +85,7 @@ pub use swipe_up_screen::{SwipeUpScreen, SwipeUpScreenMsg};
#[cfg(feature = "translations")]
pub use tap_to_confirm::TapToConfirm;
pub use updatable_more_info::UpdatableMoreInfo;
pub use vertical_menu::{PagedVerticalMenu, VerticalMenu, VerticalMenuChoiceMsg};
pub use vertical_menu::{PagedVerticalMenu, VerticalMenu, VerticalMenuChoiceMsg, MENU_MAX_ITEMS};
pub use welcome_screen::WelcomeScreen;
use super::{constant, theme};

View File

@ -25,7 +25,7 @@ pub enum VerticalMenuChoiceMsg {
/// Number of buttons.
/// Presently, VerticalMenu holds only fixed number of buttons.
const MAX_ITEMS: usize = 3;
pub const MENU_MAX_ITEMS: usize = 3;
/// Fixed height of each menu button.
const MENU_BUTTON_HEIGHT: i16 = 64;
@ -33,7 +33,7 @@ const MENU_BUTTON_HEIGHT: i16 = 64;
/// Fixed height of a separator.
const MENU_SEP_HEIGHT: i16 = 2;
type VerticalMenuButtons = Vec<Button, MAX_ITEMS>;
type VerticalMenuButtons = Vec<Button, MENU_MAX_ITEMS>;
#[derive(Default, Clone)]
struct AttachAnimation {
@ -180,7 +180,7 @@ impl VerticalMenu {
fn new(buttons: VerticalMenuButtons) -> Self {
Self {
buttons,
n_items: MAX_ITEMS,
n_items: MENU_MAX_ITEMS,
attach_animation: AttachAnimation::default(),
}
}

View File

@ -19,7 +19,7 @@ use super::{
super::{
component::{
Frame, FrameMsg, PromptMsg, PromptScreen, SwipeContent, VerticalMenu,
VerticalMenuChoiceMsg,
VerticalMenuChoiceMsg, MENU_MAX_ITEMS,
},
theme,
},
@ -137,7 +137,7 @@ pub fn new_confirm_summary(
);
unwrap!(menu_items.push(MENU_ITEM_ACCOUNT_INFO));
}
if content_extra.is_some() && menu_items.len() < 2 {
if content_extra.is_some() && menu_items.len() < MENU_MAX_ITEMS - 1 {
// NOTE: extra is shown only if VerticalMenu has space (max 2 items + Cancel)
menu = menu.item(
theme::ICON_CHEVRON_RIGHT,