fix(tui): running indicator, throbber, popup styling, buffer OOB
This commit is contained in:
1 parent
3e7a05b6e5
commit
2adac8306b
5 files changed
+107
-84
No files matched your search
@@ -72,7 +72,11 @@ pub fn popup_area(frame_area: Rect, message: &str, base_y: u16, elapsed_ms: u128
|
||||
let popup_w = (inner_w + 2) as u16;
|
||||
let popup_h = (h + 2) as u16;
|
||||
let popup_w = popup_w.min(frame_area.width.saturating_sub(4));
|
||||
let popup_h = popup_h.min(frame_area.height.saturating_sub(2));
|
||||
let max_h = frame_area.height.saturating_sub(base_y).saturating_sub(1);
|
||||
if max_h < 3 {
|
||||
return None;
|
||||
}
|
||||
let popup_h = popup_h.min(max_h);
|
||||
let base_x = frame_area.width.saturating_sub(popup_w + 2);
|
||||
Some(Rect {
|
||||
x: base_x,
|
||||
|
||||
@@ -449,7 +449,7 @@ fn close_popup(state: &mut WizardState, profiles_state: &mut profiles::State) {
|
||||
|
||||
fn wizard_title(_state: &WizardState) -> Line<'static> {
|
||||
use crate::tui::widgets::styled_title;
|
||||
styled_title("New Instance", true)
|
||||
styled_title("New Instance", false)
|
||||
}
|
||||
|
||||
fn step_keybinds(state: &WizardState) -> ratatui::text::Line<'static> {
|
||||
@@ -519,15 +519,17 @@ fn render_version_step(state: &WizardState, area: Rect, buf: &mut ratatui::buffe
|
||||
} else {
|
||||
" (snapshot)".to_string()
|
||||
};
|
||||
ListItem::new(format!("{}{}", version.id, suffix))
|
||||
ListItem::new(Line::from(Span::styled(
|
||||
format!("{}{}", version.id, suffix),
|
||||
Style::default().fg(THEME.colors.foreground),
|
||||
)))
|
||||
})
|
||||
.collect();
|
||||
|
||||
let list = List::new(items)
|
||||
.style(Style::default().fg(THEME.colors.foreground))
|
||||
.highlight_style(
|
||||
Style::default()
|
||||
.fg(THEME.colors.row_highlight)
|
||||
.fg(THEME.colors.accent)
|
||||
.add_modifier(Modifier::BOLD),
|
||||
)
|
||||
.highlight_symbol("▶ ");
|
||||
@@ -549,14 +551,18 @@ fn render_loader_step(state: &WizardState, area: Rect, buf: &mut ratatui::buffer
|
||||
|
||||
let items: Vec<ListItem> = loaders
|
||||
.into_iter()
|
||||
.map(|loader| ListItem::new(loader.to_string()))
|
||||
.map(|loader| {
|
||||
ListItem::new(Line::from(Span::styled(
|
||||
loader.to_string(),
|
||||
Style::default().fg(THEME.colors.foreground),
|
||||
)))
|
||||
})
|
||||
.collect();
|
||||
|
||||
let list = List::new(items)
|
||||
.style(Style::default().fg(THEME.colors.foreground))
|
||||
.highlight_style(
|
||||
Style::default()
|
||||
.fg(THEME.colors.row_highlight)
|
||||
.fg(THEME.colors.accent)
|
||||
.add_modifier(Modifier::BOLD),
|
||||
)
|
||||
.highlight_symbol("▶ ");
|
||||
@@ -592,14 +598,18 @@ fn render_loader_version_step(
|
||||
LoadState::Loaded(versions) => {
|
||||
let items: Vec<ListItem> = versions
|
||||
.iter()
|
||||
.map(|version| ListItem::new(version.clone()))
|
||||
.map(|version| {
|
||||
ListItem::new(Line::from(Span::styled(
|
||||
version.clone(),
|
||||
Style::default().fg(THEME.colors.foreground),
|
||||
)))
|
||||
})
|
||||
.collect();
|
||||
|
||||
let list = List::new(items)
|
||||
.style(Style::default().fg(THEME.colors.foreground))
|
||||
.highlight_style(
|
||||
Style::default()
|
||||
.fg(THEME.colors.row_highlight)
|
||||
.fg(THEME.colors.accent)
|
||||
.add_modifier(Modifier::BOLD),
|
||||
)
|
||||
.highlight_symbol("▶ ");
|
||||
|
||||
Reference in new issue
Block a user