very bald changes, still destroyed
This commit is contained in:
@@ -6,7 +6,6 @@ use crate::components::{
|
||||
render_status_line,
|
||||
handlers::sidebar::{self, calculate_sidebar_layout},
|
||||
form::form::render_form,
|
||||
admin::{admin_panel::AdminPanelState},
|
||||
auth::{login::render_login, register::render_register},
|
||||
};
|
||||
use crate::config::colors::themes::Theme;
|
||||
@@ -25,6 +24,7 @@ pub fn render_ui(
|
||||
auth_state: &mut AuthState,
|
||||
login_state: &LoginState,
|
||||
register_state: &RegisterState,
|
||||
admin_state: &mut AdminState,
|
||||
theme: &Theme,
|
||||
is_edit_mode: bool,
|
||||
total_count: u64,
|
||||
@@ -68,24 +68,9 @@ pub fn render_ui(
|
||||
login_state.current_field < 2
|
||||
);
|
||||
} else if app_state.ui.show_admin {
|
||||
// Create temporary AdminPanelState for rendering
|
||||
let mut admin_state = AdminPanelState::new(
|
||||
app_state.profile_tree.profiles
|
||||
.iter()
|
||||
.map(|p| p.name.clone())
|
||||
.collect()
|
||||
);
|
||||
|
||||
// Set the selected item - FIXED
|
||||
if !admin_state.profiles.is_empty() {
|
||||
let selected_index = admin_state.get_selected_index()
|
||||
.unwrap_or(0)
|
||||
.min(admin_state.profiles.len() - 1);
|
||||
admin_state.list_state.select(Some(selected_index));
|
||||
}
|
||||
|
||||
admin_state.render(
|
||||
crate::components::admin::admin_panel::render_admin_panel(
|
||||
f,
|
||||
admin_state,
|
||||
main_content_area,
|
||||
theme,
|
||||
&app_state.profile_tree,
|
||||
|
||||
@@ -61,6 +61,7 @@ pub async fn run_ui() -> Result<(), Box<dyn std::error::Error>> {
|
||||
&mut auth_state,
|
||||
&login_state,
|
||||
®ister_state,
|
||||
&mut admin_state,
|
||||
&theme,
|
||||
is_edit_mode,
|
||||
app_state.total_count,
|
||||
|
||||
Reference in New Issue
Block a user