1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-05-28 19:58:45 +00:00

chore(eckhart): Update components

Fix show_error action bar and header colors
Implement AllowedTextContent for FidoCredential
Add new return type for VerticalMenuScreen
This commit is contained in:
Lukas Bielesch 2025-04-12 23:53:31 +02:00 committed by obrusvit
parent 81e523885a
commit ebf1ee9a62
3 changed files with 14 additions and 3 deletions

View File

@ -16,7 +16,7 @@ use crate::{
use super::{ use super::{
action_bar::ActionBarMsg, action_bar::ActionBarMsg,
theme::{self, SIDE_INSETS}, theme::{self, SIDE_INSETS},
ActionBar, Header, HeaderMsg, Hint, ActionBar, FidoAccountName, FidoCredential, Header, HeaderMsg, Hint,
}; };
/// Full-screen component for rendering text. /// Full-screen component for rendering text.
@ -128,6 +128,8 @@ where
} }
fn event(&mut self, ctx: &mut EventCtx, event: Event) -> Option<Self::Msg> { fn event(&mut self, ctx: &mut EventCtx, event: Event) -> Option<Self::Msg> {
self.content.event(ctx, event);
if let Some(msg) = self.header.event(ctx, event) { if let Some(msg) = self.header.event(ctx, event) {
match msg { match msg {
HeaderMsg::Cancelled => return Some(TextScreenMsg::Cancelled), HeaderMsg::Cancelled => return Some(TextScreenMsg::Cancelled),
@ -179,6 +181,7 @@ pub trait AllowedTextContent: Component + PaginateFull {}
impl AllowedTextContent for FormattedText {} impl AllowedTextContent for FormattedText {}
impl<'a, T> AllowedTextContent for Paragraphs<T> where T: ParagraphSource<'a> {} impl<'a, T> AllowedTextContent for Paragraphs<T> where T: ParagraphSource<'a> {}
impl<'a, T> AllowedTextContent for Checklist<T> where T: ParagraphSource<'a> {} impl<'a, T> AllowedTextContent for Checklist<T> where T: ParagraphSource<'a> {}
impl<F> AllowedTextContent for FidoCredential<F> where F: FidoAccountName {}
#[cfg(feature = "ui_debug")] #[cfg(feature = "ui_debug")]
impl<T> crate::trace::Trace for TextScreen<T> impl<T> crate::trace::Trace for TextScreen<T>

View File

@ -33,6 +33,8 @@ pub enum VerticalMenuScreenMsg {
Back, Back,
/// Right header button clicked /// Right header button clicked
Close, Close,
/// Menu item selected
Menu,
} }
impl VerticalMenuScreen { impl VerticalMenuScreen {
@ -189,7 +191,7 @@ impl Component for VerticalMenuScreen {
match msg { match msg {
HeaderMsg::Cancelled => return Some(VerticalMenuScreenMsg::Close), HeaderMsg::Cancelled => return Some(VerticalMenuScreenMsg::Close),
HeaderMsg::Back => return Some(VerticalMenuScreenMsg::Back), HeaderMsg::Back => return Some(VerticalMenuScreenMsg::Back),
_ => {} HeaderMsg::Menu => return Some(VerticalMenuScreenMsg::Menu),
} }
} }

View File

@ -729,9 +729,15 @@ impl FirmwareUI for UIEckhart {
Button::with_icon(theme::ICON_CLOSE), Button::with_icon(theme::ICON_CLOSE),
Button::with_text(button), Button::with_text(button),
) )
} else {
ActionBar::new_single(Button::with_text(button))
}; };
let screen = TextScreen::new(content) let screen = TextScreen::new(content)
.with_header(Header::new(title).with_icon(theme::ICON_WARNING, theme::RED)) .with_header(
Header::new(title)
.with_icon(theme::ICON_WARNING, theme::ORANGE)
.with_text_style(theme::label_title_danger()),
)
.with_action_bar(action_bar); .with_action_bar(action_bar);
let obj = LayoutObj::new(screen)?; let obj = LayoutObj::new(screen)?;
Ok(obj) Ok(obj)