admin bug fixed, time for intro also
This commit is contained in:
@@ -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()
|
||||
}
|
||||
);
|
||||
|
||||
// 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(
|
||||
|
||||
Reference in New Issue
Block a user