Added default message when there's a movie without history

This commit is contained in:
2023-08-08 10:50:04 -06:00
parent cd0cf2e04a
commit 3dce6c7517
+12 -3
View File
@@ -12,8 +12,8 @@ use crate::app::App;
use crate::models::radarr_models::{Credit, MovieHistoryItem};
use crate::models::Route;
use crate::ui::utils::{
borderless_block, layout_block_bottom_border, spans_info_default, style_bold, style_failure,
style_success, style_warning, vertical_chunks,
borderless_block, layout_block_bottom_border, spans_info_default, style_bold, style_default,
style_failure, style_success, style_warning, vertical_chunks,
};
use crate::ui::{draw_table, draw_tabs, loading, TableProps};
@@ -149,6 +149,13 @@ fn draw_movie_history<B: Backend>(
app.data.radarr_data.movie_history.current_selection_clone()
};
if app.data.radarr_data.movie_history.items.is_empty() && !app.is_loading {
let no_history_paragraph = Paragraph::new(Text::from("No history"))
.style(style_default())
.block(block);
f.render_widget(no_history_paragraph, content_area);
} else {
draw_table(
f,
content_area,
@@ -174,7 +181,8 @@ fn draw_movie_history<B: Backend>(
} = movie_history_item;
if current_selection == *movie_history_item
&& movie_history_item.source_title.text.len() > (content_area.width as f64 * 0.34) as usize
&& movie_history_item.source_title.text.len()
> (content_area.width as f64 * 0.34) as usize
{
source_title.scroll_text();
} else {
@@ -199,6 +207,7 @@ fn draw_movie_history<B: Backend>(
app.is_loading,
);
}
}
fn draw_movie_cast<B: Backend>(
f: &mut Frame<'_, B>,