feat(tui): add context-sensitive keybinds on bottom border of each panel

This commit is contained in:
objz committed 2026-01-10 15:22:06 +01:00
1 parent e5de3c14fc
commit b0738761c9
5 files changed
+89 -8

No files matched your search

+9 -3
View File
@@ -219,19 +219,25 @@ pub fn render(frame: &mut Frame, area: Rect, focused: FocusedArea, state: &mut A
THEME.colors.border_unfocused
};
let block = Block::default()
let mut block = Block::default()
.title(styled_title("Account", true))
.borders(Borders::ALL)
.border_type(BorderType::Rounded)
.border_style(Style::default().fg(color));
if focused == FocusedArea::Account {
block = block.title_bottom(
super::popups::keybind_line(&[("⏎", " select"), ("a", " add"), ("d", " del")])
.alignment(ratatui::layout::Alignment::Right),
);
}
let inner = block.inner(area);
frame.render_widget(block, area);
if state.store.accounts.is_empty() {
frame.render_widget(
Paragraph::new("No accounts.")
.style(Style::default().fg(THEME.colors.text_idle)),
Paragraph::new("No accounts.").style(Style::default().fg(THEME.colors.text_idle)),
inner,
);
} else {
+45
View File
@@ -138,6 +138,51 @@ pub fn render(
block = block.title_top(sl);
}
if is_focused {
let kb: &[(&str, &str)] = match tab {
ContentTab::Mods | ContentTab::ResourcePacks | ContentTab::Shaders => &[
("j/k", " nav"),
("⏎", " toggle"),
("S+⏎", " dir"),
("h/l", " tabs"),
("/", " search"),
],
ContentTab::Worlds => &[
("j/k", " nav"),
("S+⏎", " dir"),
("h/l", " tabs"),
("/", " search"),
],
ContentTab::Screenshots => &[
("S+HJKL", " grid"),
("⏎", " open"),
("S+⏎", " dir"),
("h/l", " tabs"),
("/", " search"),
],
ContentTab::Logs => {
if logs_state.viewer_focused {
&[
("S+JK", " scroll"),
("g/G", " top/bot"),
("Esc", " back"),
("/", " search"),
]
} else {
&[
("S+JK", " nav"),
("⏎", " view"),
("h/l", " tabs"),
("/", " search"),
]
}
}
};
block = block.title_bottom(
super::popups::keybind_line(kb).alignment(ratatui::layout::Alignment::Right),
);
}
let content_area = block.inner(area);
frame.render_widget(block, area);
+13 -4
View File
@@ -1,7 +1,7 @@
use ratatui::{
layout::Rect,
layout::{Alignment, Rect},
style::Style,
widgets::{Block, BorderType, Borders, Paragraph},
widgets::{Block, BorderType, Borders},
Frame,
};
@@ -19,10 +19,19 @@ pub fn render(frame: &mut Frame, area: Rect, focused: FocusedArea) {
let block = Block::default()
.title(styled_title("Details", true))
.title_bottom(
super::popups::keybind_line(&[
("P", " profiles"),
("C", " content"),
("A", " account"),
("S", " logs"),
("q", " quit"),
])
.alignment(Alignment::Right),
)
.borders(Borders::ALL)
.border_type(BorderType::Rounded)
.border_style(Style::default().fg(color));
let widget = Paragraph::new("TEST CONTENT").block(block);
frame.render_widget(widget, area);
frame.render_widget(block, area);
}
+14
View File
@@ -207,6 +207,20 @@ pub fn render(frame: &mut Frame, area: Rect, focused: FocusedArea, state: &mut S
block = block.title_top(search_line);
}
if focused == FocusedArea::Profiles {
block = block.title_bottom(
super::popups::keybind_line(&[
("l", " launch"),
("⏎", " content"),
("a", " add"),
("d", " del"),
("/", " search"),
("Esc", " kill"),
])
.alignment(ratatui::layout::Alignment::Right),
);
}
let scrollbar_area = Rect {
x: area.x + area.width.saturating_sub(1),
y: area.y + 1,
+8 -1
View File
@@ -25,12 +25,19 @@ pub fn render(
THEME.colors.border_unfocused
};
let block = Block::default()
let mut block = Block::default()
.title(styled_title("Status", true))
.borders(Borders::ALL)
.border_type(BorderType::Rounded)
.border_style(Style::default().fg(border_color));
if focused == FocusedArea::Status {
block = block.title_bottom(
super::popups::keybind_line(&[("S", " expand")])
.alignment(ratatui::layout::Alignment::Right),
);
}
let state = match PROGRESS.lock() {
Ok(s) => s.clone(),
Err(_) => {