moved admin now
This commit is contained in:
@@ -8,7 +8,7 @@ use crate::pages::admin_panel::add_logic;
|
||||
use crate::pages::admin_panel::add_table;
|
||||
use crate::pages::register::suggestions::RoleSuggestionsProvider;
|
||||
use crate::pages::admin::main::logic::handle_admin_navigation;
|
||||
use crate::pages::admin::admin::tui::handle_admin_selection;
|
||||
use crate::pages::admin::admin;
|
||||
use crate::modes::general::command_navigation::{
|
||||
handle_command_navigation_event, NavigationState,
|
||||
};
|
||||
@@ -332,6 +332,21 @@ impl EventHandler {
|
||||
if !outcome.get_message_if_ok().is_empty() {
|
||||
return Ok(outcome);
|
||||
}
|
||||
} else if let Page::Admin(admin_state) = &mut router.current {
|
||||
if matches!(auth_state.role, Some(UserRole::Admin)) {
|
||||
if let Event::Key(key_event) = event {
|
||||
if admin::event::handle_admin_event(
|
||||
key_event,
|
||||
config,
|
||||
app_state,
|
||||
admin_state,
|
||||
buffer_state,
|
||||
&mut self.command_message,
|
||||
)? {
|
||||
return Ok(EventOutcome::Ok(self.command_message.clone()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if toggle_sidebar(
|
||||
@@ -461,13 +476,6 @@ impl EventHandler {
|
||||
return Ok(EventOutcome::Ok(String::new()));
|
||||
}
|
||||
}
|
||||
Page::Admin(state) => {
|
||||
if matches!(auth_state.role, Some(UserRole::Admin)) {
|
||||
if state.handle_movement(app_state, ma) {
|
||||
return Ok(EventOutcome::Ok(String::new()));
|
||||
}
|
||||
}
|
||||
}
|
||||
Page::Intro(state) => {
|
||||
if state.handle_movement(ma) {
|
||||
return Ok(EventOutcome::Ok(String::new()));
|
||||
@@ -478,22 +486,6 @@ impl EventHandler {
|
||||
}
|
||||
|
||||
// Optional page-specific handlers (non-movement or rich actions)
|
||||
if let Page::Admin(admin_state) = &mut router.current {
|
||||
if matches!(auth_state.role, Some(UserRole::Admin)) {
|
||||
// Full admin navigation
|
||||
if handle_admin_navigation(
|
||||
key_event,
|
||||
config,
|
||||
app_state,
|
||||
admin_state,
|
||||
buffer_state,
|
||||
&mut self.command_message,
|
||||
) {
|
||||
return Ok(EventOutcome::Ok(self.command_message.clone()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let client_clone = self.grpc_client.clone();
|
||||
let sender_clone = self.save_logic_result_sender.clone();
|
||||
if add_logic::nav::handle_add_logic_navigation(
|
||||
@@ -606,7 +598,7 @@ impl EventHandler {
|
||||
}
|
||||
UiContext::Admin => {
|
||||
if let Page::Admin(admin_state) = &router.current {
|
||||
handle_admin_selection(
|
||||
admin::tui::handle_admin_selection(
|
||||
app_state,
|
||||
admin_state,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user