restored rendering
This commit is contained in:
@@ -43,15 +43,30 @@ 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 using app_state data
|
||||
let mut admin_state = AdminPanelState::new(app_state.admin_profiles.clone());
|
||||
admin_state.list_state.select(Some(app_state.admin_selected_item));
|
||||
|
||||
// Create temporary AdminPanelState for rendering
|
||||
let mut admin_state = AdminPanelState::new(
|
||||
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(
|
||||
f,
|
||||
main_content_area,
|
||||
theme,
|
||||
&app_state.profile_tree,
|
||||
&app_state.profile_tree,
|
||||
&app_state.selected_profile,
|
||||
);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user