enum to string that is passed to the library, waiting for the enum based generic library
This commit is contained in:
@@ -39,13 +39,14 @@ pub async fn display_task(i2c: I2cDevice) {
|
||||
let mut terminal = Terminal::new(backend).expect("terminal init failed");
|
||||
|
||||
let mut state = DisplayState::default();
|
||||
let mut orchestrator = Orchestrator::<Screen>::new();
|
||||
let mut orchestrator = Orchestrator::<Screen, Screen>::new();
|
||||
let rx = receiver();
|
||||
|
||||
// Register pages
|
||||
orchestrator.register_page("menu".into(), Screen::Menu);
|
||||
orchestrator.register_page("imu".into(), Screen::Imu);
|
||||
orchestrator.register_page("chat".into(), Screen::Chat);
|
||||
// Enum-based registration
|
||||
orchestrator.register_page(Screen::Menu, Screen::Menu);
|
||||
orchestrator.register_page(Screen::Imu, Screen::Imu);
|
||||
orchestrator.register_page(Screen::Chat, Screen::Chat);
|
||||
|
||||
orchestrator.bind(Key::tab(), ComponentAction::Next);
|
||||
orchestrator.bind(Key::enter(), ComponentAction::Select);
|
||||
|
||||
@@ -11,6 +11,15 @@ use ratatui::{
|
||||
};
|
||||
use log::info;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
|
||||
pub enum Screen {
|
||||
Menu,
|
||||
Imu,
|
||||
Chat,
|
||||
}
|
||||
|
||||
impl pages_tui::page::PageId for Screen {}
|
||||
|
||||
/// Focus targets - different per screen
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
pub enum PageFocus {
|
||||
|
||||
Reference in New Issue
Block a user