Add expand/collapse all, per-pane key legends
SectionTree: - 'e': expand all nodes - 'c': collapse all nodes - Home/End already wired from previous commit Key legend shown at bottom border of each focused pane: - Tree panes: nav, expand/collapse, expand/collapse all, paging - Agent list: select, tab - History: scroll, paging Legend only appears on the focused pane to avoid clutter. Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
parent
19bb6d02e3
commit
578be807e7
3 changed files with 54 additions and 14 deletions
|
|
@ -15,7 +15,7 @@ use ratatui::{
|
|||
};
|
||||
|
||||
use super::{App, ScreenView, screen_legend};
|
||||
use super::widgets::{SectionTree, pane_block_focused, render_scrollable, format_age, format_ts_age};
|
||||
use super::widgets::{SectionTree, pane_block_focused, render_scrollable, tree_legend, format_age, format_ts_age};
|
||||
use crate::agent::context::ContextSection;
|
||||
|
||||
#[derive(Clone, Copy, PartialEq)]
|
||||
|
|
@ -185,9 +185,16 @@ impl SubconsciousScreen {
|
|||
}
|
||||
}).collect();
|
||||
|
||||
let mut block = pane_block_focused("agents", self.focus == Pane::Agents)
|
||||
.title_top(Line::from(screen_legend()).left_aligned());
|
||||
if self.focus == Pane::Agents {
|
||||
block = block.title_bottom(Line::styled(
|
||||
" ↑↓:select Tab:next pane ",
|
||||
Style::default().fg(Color::DarkGray),
|
||||
));
|
||||
}
|
||||
let list = List::new(items)
|
||||
.block(pane_block_focused("agents", self.focus == Pane::Agents)
|
||||
.title_top(Line::from(screen_legend()).left_aligned()))
|
||||
.block(block)
|
||||
.highlight_symbol("▸ ")
|
||||
.highlight_style(Style::default().bg(Color::DarkGray));
|
||||
|
||||
|
|
@ -207,9 +214,9 @@ impl SubconsciousScreen {
|
|||
self.output_tree.render_sections(§ions, &mut lines);
|
||||
}
|
||||
|
||||
render_scrollable(frame, area, lines,
|
||||
pane_block_focused("state", self.focus == Pane::Outputs),
|
||||
self.output_tree.scroll);
|
||||
let mut block = pane_block_focused("state", self.focus == Pane::Outputs);
|
||||
if self.focus == Pane::Outputs { block = block.title_bottom(tree_legend()); }
|
||||
render_scrollable(frame, area, lines, block, self.output_tree.scroll);
|
||||
}
|
||||
|
||||
fn draw_history(&self, frame: &mut Frame, area: Rect, app: &App) {
|
||||
|
|
@ -246,9 +253,14 @@ impl SubconsciousScreen {
|
|||
}
|
||||
}
|
||||
|
||||
render_scrollable(frame, area, lines,
|
||||
pane_block_focused(&title, self.focus == Pane::History),
|
||||
self.history_scroll);
|
||||
let mut block = pane_block_focused(&title, self.focus == Pane::History);
|
||||
if self.focus == Pane::History {
|
||||
block = block.title_bottom(Line::styled(
|
||||
" ↑↓:scroll PgUp/Dn ",
|
||||
Style::default().fg(Color::DarkGray),
|
||||
));
|
||||
}
|
||||
render_scrollable(frame, area, lines, block, self.history_scroll);
|
||||
}
|
||||
|
||||
fn draw_context(
|
||||
|
|
@ -273,8 +285,8 @@ impl SubconsciousScreen {
|
|||
.map(|s| s.name.as_str())
|
||||
.unwrap_or("—");
|
||||
|
||||
render_scrollable(frame, area, lines,
|
||||
pane_block_focused(title, self.focus == Pane::Context),
|
||||
self.context_tree.scroll);
|
||||
let mut block = pane_block_focused(title, self.focus == Pane::Context);
|
||||
if self.focus == Pane::Context { block = block.title_bottom(tree_legend()); }
|
||||
render_scrollable(frame, area, lines, block, self.context_tree.scroll);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue