mirror of
https://github.com/Xithrius/twitch-tui.git
synced 2024-09-11 05:35:26 +03:00
Input inboxes now show statuses on validity of said input
This commit is contained in:
parent
e84ecb8dc2
commit
ff35eca988
@ -61,6 +61,12 @@ pub fn render_insert_box<T: Backend>(
|
||||
|
||||
let binding = [TitleStyle::Single(box_title)];
|
||||
|
||||
let status_color = if valid_input {
|
||||
Color::Green
|
||||
} else {
|
||||
Color::Red
|
||||
};
|
||||
|
||||
let paragraph = Paragraph::new(Spans::from(vec![
|
||||
Span::raw(current_input),
|
||||
Span::styled(
|
||||
@ -81,13 +87,11 @@ pub fn render_insert_box<T: Backend>(
|
||||
.borders(Borders::ALL)
|
||||
.title(title_spans(
|
||||
&binding,
|
||||
Style::default().fg(Color::Red).add_modifier(Modifier::BOLD),
|
||||
Style::default()
|
||||
.fg(status_color)
|
||||
.add_modifier(Modifier::BOLD),
|
||||
))
|
||||
.border_style(Style::default().fg(if valid_input {
|
||||
Color::Yellow
|
||||
} else {
|
||||
Color::Red
|
||||
})),
|
||||
.border_style(Style::default().fg(status_color)),
|
||||
)
|
||||
.scroll((
|
||||
0,
|
||||
|
@ -255,12 +255,14 @@ pub fn draw_ui<T: Backend>(frame: &mut Frame<T>, app: &mut App, config: &Complet
|
||||
// States of the application that require a chunk of the main window
|
||||
State::Insert => components::render_chat_box(window, config.storage.mentions),
|
||||
State::MessageSearch => {
|
||||
let checking_func = |s: String| -> bool { !s.is_empty() };
|
||||
|
||||
components::render_insert_box(
|
||||
window,
|
||||
format!("Message Search: {total_num_search_results} found").as_str(),
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
Some(Box::new(checking_func)),
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user