working perfectly well admin panel for admin
This commit is contained in:
@@ -157,13 +157,13 @@ pub fn render_admin_panel_admin(
|
|||||||
|
|
||||||
// Build and render table list inside the block's inner area
|
// Build and render table list inside the block's inner area
|
||||||
let table_list = List::new(table_list_items)
|
let table_list = List::new(table_list_items)
|
||||||
// Highlight style depends on whether the pane OR inside has focus
|
// Highlight style only applies when focus is *inside* the list
|
||||||
.highlight_style(if table_pane_has_focus {
|
.highlight_style(if admin_state.current_focus == AdminFocus::InsideTablesList {
|
||||||
Style::default().add_modifier(ratatui::style::Modifier::REVERSED)
|
Style::default().add_modifier(ratatui::style::Modifier::REVERSED)
|
||||||
} else {
|
} else {
|
||||||
Style::default()
|
Style::default()
|
||||||
})
|
})
|
||||||
.highlight_symbol("> ");
|
.highlight_symbol(if admin_state.current_focus == AdminFocus::InsideTablesList { "> " } else { "" });
|
||||||
|
|
||||||
f.render_stateful_widget(table_list, tables_inner_area, &mut admin_state.table_list_state);
|
f.render_stateful_widget(table_list, tables_inner_area, &mut admin_state.table_list_state);
|
||||||
|
|
||||||
|
|||||||
@@ -67,19 +67,9 @@ pub fn handle_admin_navigation(
|
|||||||
*command_message = "Navigated profiles list".to_string();
|
*command_message = "Navigated profiles list".to_string();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AdminFocus::Tables => { // Navigate highlight when focus is on the block
|
AdminFocus::Tables => {
|
||||||
// Updates table navigation state
|
// Do nothing when focus is on the Tables pane itself
|
||||||
if let Some(nav_profile_idx) = admin_state.profile_list_state.selected() {
|
*command_message = "Press Enter to select and scroll tables".to_string();
|
||||||
if let Some(profile) = app_state.profile_tree.profiles.get(nav_profile_idx) {
|
|
||||||
let table_count = profile.tables.len();
|
|
||||||
if table_count > 0 {
|
|
||||||
admin_state.previous_table(table_count);
|
|
||||||
*command_message = "Navigated tables list".to_string();
|
|
||||||
} else {
|
|
||||||
*command_message = "No tables in selected profile".to_string();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
AdminFocus::InsideTablesList => { // Scroll inside
|
AdminFocus::InsideTablesList => { // Scroll inside
|
||||||
if let Some(p_idx) = admin_state.profile_list_state.selected().or(admin_state.selected_profile_index) { // Use nav or persistent selection
|
if let Some(p_idx) = admin_state.profile_list_state.selected().or(admin_state.selected_profile_index) { // Use nav or persistent selection
|
||||||
@@ -100,18 +90,9 @@ pub fn handle_admin_navigation(
|
|||||||
*command_message = "Navigated profiles list".to_string();
|
*command_message = "Navigated profiles list".to_string();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AdminFocus::Tables => { // Navigate highlight when focus is on the block
|
AdminFocus::Tables => {
|
||||||
if let Some(nav_profile_idx) = admin_state.profile_list_state.selected() {
|
// Do nothing when focus is on the Tables pane itself
|
||||||
if let Some(profile) = app_state.profile_tree.profiles.get(nav_profile_idx) {
|
*command_message = "Press Enter to select and scroll tables".to_string();
|
||||||
let table_count = profile.tables.len();
|
|
||||||
if table_count > 0 {
|
|
||||||
admin_state.next_table(table_count);
|
|
||||||
*command_message = "Navigated tables list".to_string();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
*command_message = "No tables in selected profile".to_string();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
AdminFocus::InsideTablesList => { // Scroll inside
|
AdminFocus::InsideTablesList => { // Scroll inside
|
||||||
if let Some(p_idx) = admin_state.profile_list_state.selected().or(admin_state.selected_profile_index) { // Use nav or persistent selection
|
if let Some(p_idx) = admin_state.profile_list_state.selected().or(admin_state.selected_profile_index) { // Use nav or persistent selection
|
||||||
|
|||||||
Reference in New Issue
Block a user