admin bug fixed, time for intro also

This commit is contained in:
filipriec
2025-03-24 15:09:35 +01:00
parent aa3ff18f9c
commit 3bb771187a

View File

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