restored rendering
This commit is contained in:
@@ -43,15 +43,30 @@ 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,
|
||||||
main_content_area,
|
main_content_area,
|
||||||
theme,
|
theme,
|
||||||
&app_state.profile_tree,
|
&app_state.profile_tree,
|
||||||
&app_state.selected_profile,
|
&app_state.selected_profile,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user