Adds an update prompt when the CLI starts: <img width="1410" height="608" alt="Screenshot 2025-10-14 at 5 53 17 PM" src="https://github.com/user-attachments/assets/47c8bafa-7bed-4be8-b597-c4c6c79756b8" />
36 lines
961 B
Rust
36 lines
961 B
Rust
use crate::render::renderable::Renderable;
|
||
use crate::render::renderable::RowRenderable;
|
||
use ratatui::style::Style;
|
||
use ratatui::style::Styled as _;
|
||
use ratatui::style::Stylize as _;
|
||
use ratatui::widgets::Paragraph;
|
||
use ratatui::widgets::Wrap;
|
||
use unicode_width::UnicodeWidthStr;
|
||
|
||
pub(crate) fn selection_option_row(
|
||
index: usize,
|
||
label: String,
|
||
is_selected: bool,
|
||
) -> Box<dyn Renderable> {
|
||
let prefix = if is_selected {
|
||
format!("› {}. ", index + 1)
|
||
} else {
|
||
format!(" {}. ", index + 1)
|
||
};
|
||
let style = if is_selected {
|
||
Style::default().cyan()
|
||
} else {
|
||
Style::default()
|
||
};
|
||
let prefix_width = UnicodeWidthStr::width(prefix.as_str()) as u16;
|
||
let mut row = RowRenderable::new();
|
||
row.push(prefix_width, prefix.set_style(style));
|
||
row.push(
|
||
u16::MAX,
|
||
Paragraph::new(label)
|
||
.style(style)
|
||
.wrap(Wrap { trim: false }),
|
||
);
|
||
row.into()
|
||
}
|