restored rendering

This commit is contained in:
filipriec
2025-03-23 12:59:36 +01:00
parent 4ddcb34205
commit c6c6c5ed81

View File

@@ -43,9 +43,24 @@ pub fn render_ui(
if app_state.ui.show_intro { if app_state.ui.show_intro {
intro_state.render(f, main_content_area, theme); intro_state.render(f, main_content_area, theme);
} else if app_state.ui.show_admin { } else if app_state.ui.show_admin {
// Create temporary AdminPanelState using app_state data // Create temporary AdminPanelState for rendering
let mut admin_state = AdminPanelState::new(app_state.admin_profiles.clone()); let mut admin_state = AdminPanelState::new(
admin_state.list_state.select(Some(app_state.admin_selected_item)); if app_state.admin_profiles.is_empty() {
// Fallback if admin_profiles is empty
app_state.profile_tree.profiles
.iter()
.map(|p| p.name.clone())
.collect()
} else {
app_state.admin_profiles.clone()
}
);
// Set the selected item
if !admin_state.profiles.is_empty() {
let safe_index = app_state.admin_selected_item.min(admin_state.profiles.len() - 1);
admin_state.list_state.select(Some(safe_index));
}
admin_state.render( admin_state.render(
f, f,