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 {
|
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 for rendering
|
||||||
|
|
||||||
// Create temporary AdminPanelState for rendering
|
// Create temporary AdminPanelState for rendering
|
||||||
let mut admin_state = AdminPanelState::new(
|
let mut admin_state = AdminPanelState::new(
|
||||||
if app_state.profile_tree.profiles.is_empty() {
|
app_state.profile_tree.profiles
|
||||||
// Fallback if admin_profiles is empty
|
.iter()
|
||||||
app_state.profile_tree.profiles
|
.map(|p| p.name.clone())
|
||||||
.iter()
|
.collect()
|
||||||
.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() {
|
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(
|
admin_state.render(
|
||||||
|
|||||||
Reference in New Issue
Block a user