auth dialog implemented
This commit is contained in:
@@ -5,6 +5,14 @@ use common::proto::multieko2::table_definition::ProfileTreeResponse;
|
||||
use crate::components::IntroState;
|
||||
use crate::modes::handlers::mode_manager::AppMode;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct DialogState {
|
||||
pub show_dialog: bool,
|
||||
pub dialog_title: String,
|
||||
pub dialog_message: String,
|
||||
pub dialog_button_active: bool,
|
||||
}
|
||||
|
||||
pub struct UiState {
|
||||
pub show_sidebar: bool,
|
||||
pub is_saved: bool,
|
||||
@@ -13,6 +21,7 @@ pub struct UiState {
|
||||
pub show_form: bool,
|
||||
pub show_login: bool,
|
||||
pub intro_state: IntroState,
|
||||
pub dialog: DialogState, // Add dialog state here
|
||||
}
|
||||
|
||||
pub struct GeneralState {
|
||||
@@ -66,6 +75,24 @@ impl AppState {
|
||||
pub fn update_mode(&mut self, mode: AppMode) {
|
||||
self.current_mode = mode;
|
||||
}
|
||||
|
||||
// Add dialog helper methods
|
||||
pub fn show_dialog(&mut self, title: &str, message: &str) {
|
||||
self.ui.dialog.show_dialog = true;
|
||||
self.ui.dialog.dialog_title = title.to_string();
|
||||
self.ui.dialog.dialog_message = message.to_string();
|
||||
self.ui.dialog.dialog_button_active = true;
|
||||
}
|
||||
|
||||
pub fn hide_dialog(&mut self) {
|
||||
self.ui.dialog.show_dialog = false;
|
||||
self.ui.dialog.dialog_title.clear();
|
||||
self.ui.dialog.dialog_message.clear();
|
||||
}
|
||||
|
||||
pub fn set_dialog_button_active(&mut self, active: bool) {
|
||||
self.ui.dialog.dialog_button_active = active;
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for UiState {
|
||||
@@ -78,6 +105,7 @@ impl Default for UiState {
|
||||
show_form: false,
|
||||
show_login: false,
|
||||
intro_state: IntroState::new(),
|
||||
dialog: DialogState::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user