implement card rendering with new card type and menu
This commit was merged in pull request #28.
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
use alloc::vec;
|
||||
use core::future;
|
||||
|
||||
use crate::card::model::Card;
|
||||
use crate::card::{decoder::split_nfc_hex, mock::MOCK_PAYLOAD, mock::MOCK_PAYLOAD2};
|
||||
use crate::display::primary_lcd::PrimaryLcdDisplay;
|
||||
|
||||
use crate::views::card_view::CardView;
|
||||
use crate::views::journal_view::JournalView;
|
||||
use crate::views::{menu_item, settings_menu::SettingsMenu, view::View};
|
||||
|
||||
@@ -33,6 +36,9 @@ impl Navigable for MainMenu {
|
||||
}
|
||||
|
||||
fn handle_input(&self, input: Action) -> impl core::future::Future<Output = View> + Send {
|
||||
let card_mock1 = Card::try_from(split_nfc_hex(&MOCK_PAYLOAD).unwrap()).unwrap();
|
||||
let card_mock2 = Card::try_from(split_nfc_hex(&MOCK_PAYLOAD2).unwrap()).unwrap();
|
||||
|
||||
let new_menu = match input {
|
||||
Action::Up => {
|
||||
let new_selected = if (self.selected - 1) < 0 {
|
||||
@@ -51,8 +57,9 @@ impl Navigable for MainMenu {
|
||||
})
|
||||
}
|
||||
Action::Ok => match self.selected {
|
||||
0 => View::Card(CardView { card: card_mock1 }),
|
||||
1 => View::Journal(JournalView {
|
||||
cards: vec![],
|
||||
cards: vec![card_mock1, card_mock2],
|
||||
selected_card: 0,
|
||||
}),
|
||||
2 => View::Settings(SettingsMenu { selected: 0 }),
|
||||
|
||||
Reference in New Issue
Block a user