Cleaned up active radarr block delegation to not have giant match arms and instead just check an array, and fixed a UI bug that shows an error message if a movie is already in a user's library.

This commit is contained in:
2023-08-08 10:50:05 -06:00
parent fa381cea01
commit dcc251ae01
9 changed files with 186 additions and 85 deletions
+25
View File
@@ -1,5 +1,6 @@
use tui::backend::Backend;
use tui::layout::{Alignment, Constraint, Rect};
use tui::style::Modifier;
use tui::text::{Span, Spans, Text};
use tui::widgets::Paragraph;
use tui::widgets::Row;
@@ -291,6 +292,30 @@ pub fn loading<B: Backend>(f: &mut Frame<'_, B>, block: Block<'_>, area: Rect, i
}
}
pub fn draw_error_popup_over<B: Backend>(
f: &mut Frame<'_, B>,
app: &mut App,
area: Rect,
message: &str,
background_fn: fn(&mut Frame<'_, B>, &mut App, Rect),
) {
background_fn(f, app, area);
draw_error_popup(f, message);
}
pub fn draw_error_popup<B: Backend>(f: &mut Frame<'_, B>, message: &str) {
let prompt_area = centered_rect(25, 8, f.size());
f.render_widget(Clear, prompt_area);
let error_message = Paragraph::new(Text::from(message))
.block(title_block_centered("Error").style(style_failure()))
.style(style_failure().add_modifier(Modifier::BOLD))
.wrap(Wrap { trim: false })
.alignment(Alignment::Center);
f.render_widget(error_message, prompt_area);
}
pub fn draw_prompt_box<B: Backend>(
f: &mut Frame<'_, B>,
prompt_area: Rect,