mode manager finally

This commit is contained in:
filipriec
2025-03-24 11:03:52 +01:00
parent 2da009eede
commit 1eb2edc1df
4 changed files with 275 additions and 166 deletions

View File

@@ -3,6 +3,7 @@
use std::env;
use common::proto::multieko2::table_definition::ProfileTreeResponse;
use crate::components::IntroState;
use crate::modes::handlers::mode_manager::AppMode;
pub struct UiState {
pub show_sidebar: bool,
@@ -25,6 +26,7 @@ pub struct AppState {
pub current_position: u64,
pub profile_tree: ProfileTreeResponse,
pub selected_profile: Option<String>,
pub current_mode: AppMode,
// UI preferences
pub ui: UiState,
@@ -42,6 +44,7 @@ impl AppState {
current_position: 0,
profile_tree: ProfileTreeResponse::default(),
selected_profile: None,
current_mode: AppMode::General,
ui: UiState::default(),
general: GeneralState {
selected_item: 0,
@@ -58,6 +61,10 @@ impl AppState {
pub fn update_current_position(&mut self, current_position: u64) {
self.current_position = current_position;
}
pub fn update_mode(&mut self, mode: AppMode) {
self.current_mode = mode;
}
}
impl Default for UiState {