Added default message when there's a movie without history
This commit is contained in:
@@ -12,8 +12,8 @@ use crate::app::App;
|
|||||||
use crate::models::radarr_models::{Credit, MovieHistoryItem};
|
use crate::models::radarr_models::{Credit, MovieHistoryItem};
|
||||||
use crate::models::Route;
|
use crate::models::Route;
|
||||||
use crate::ui::utils::{
|
use crate::ui::utils::{
|
||||||
borderless_block, layout_block_bottom_border, spans_info_default, style_bold, style_failure,
|
borderless_block, layout_block_bottom_border, spans_info_default, style_bold, style_default,
|
||||||
style_success, style_warning, vertical_chunks,
|
style_failure, style_success, style_warning, vertical_chunks,
|
||||||
};
|
};
|
||||||
use crate::ui::{draw_table, draw_tabs, loading, TableProps};
|
use crate::ui::{draw_table, draw_tabs, loading, TableProps};
|
||||||
|
|
||||||
@@ -149,55 +149,64 @@ fn draw_movie_history<B: Backend>(
|
|||||||
app.data.radarr_data.movie_history.current_selection_clone()
|
app.data.radarr_data.movie_history.current_selection_clone()
|
||||||
};
|
};
|
||||||
|
|
||||||
draw_table(
|
if app.data.radarr_data.movie_history.items.is_empty() && !app.is_loading {
|
||||||
f,
|
let no_history_paragraph = Paragraph::new(Text::from("No history"))
|
||||||
content_area,
|
.style(style_default())
|
||||||
block,
|
.block(block);
|
||||||
TableProps {
|
|
||||||
content: &mut app.data.radarr_data.movie_history,
|
|
||||||
table_headers: vec!["Source Title", "Event Type", "Languages", "Quality", "Date"],
|
|
||||||
constraints: vec![
|
|
||||||
Constraint::Percentage(34),
|
|
||||||
Constraint::Percentage(17),
|
|
||||||
Constraint::Percentage(14),
|
|
||||||
Constraint::Percentage(14),
|
|
||||||
Constraint::Percentage(21),
|
|
||||||
],
|
|
||||||
},
|
|
||||||
|movie_history_item| {
|
|
||||||
let MovieHistoryItem {
|
|
||||||
source_title,
|
|
||||||
quality,
|
|
||||||
languages,
|
|
||||||
date,
|
|
||||||
event_type,
|
|
||||||
} = movie_history_item;
|
|
||||||
|
|
||||||
if current_selection == *movie_history_item
|
f.render_widget(no_history_paragraph, content_area);
|
||||||
&& movie_history_item.source_title.text.len() > (content_area.width as f64 * 0.34) as usize
|
} else {
|
||||||
{
|
draw_table(
|
||||||
source_title.scroll_text();
|
f,
|
||||||
} else {
|
content_area,
|
||||||
source_title.reset_offset();
|
block,
|
||||||
}
|
TableProps {
|
||||||
|
content: &mut app.data.radarr_data.movie_history,
|
||||||
|
table_headers: vec!["Source Title", "Event Type", "Languages", "Quality", "Date"],
|
||||||
|
constraints: vec![
|
||||||
|
Constraint::Percentage(34),
|
||||||
|
Constraint::Percentage(17),
|
||||||
|
Constraint::Percentage(14),
|
||||||
|
Constraint::Percentage(14),
|
||||||
|
Constraint::Percentage(21),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|movie_history_item| {
|
||||||
|
let MovieHistoryItem {
|
||||||
|
source_title,
|
||||||
|
quality,
|
||||||
|
languages,
|
||||||
|
date,
|
||||||
|
event_type,
|
||||||
|
} = movie_history_item;
|
||||||
|
|
||||||
Row::new(vec![
|
if current_selection == *movie_history_item
|
||||||
Cell::from(source_title.to_string()),
|
&& movie_history_item.source_title.text.len()
|
||||||
Cell::from(event_type.to_owned()),
|
> (content_area.width as f64 * 0.34) as usize
|
||||||
Cell::from(
|
{
|
||||||
languages
|
source_title.scroll_text();
|
||||||
.iter()
|
} else {
|
||||||
.map(|language| language.name.to_owned())
|
source_title.reset_offset();
|
||||||
.collect::<Vec<String>>()
|
}
|
||||||
.join(","),
|
|
||||||
),
|
Row::new(vec![
|
||||||
Cell::from(quality.quality.name.to_owned()),
|
Cell::from(source_title.to_string()),
|
||||||
Cell::from(date.to_string()),
|
Cell::from(event_type.to_owned()),
|
||||||
])
|
Cell::from(
|
||||||
.style(style_success())
|
languages
|
||||||
},
|
.iter()
|
||||||
app.is_loading,
|
.map(|language| language.name.to_owned())
|
||||||
);
|
.collect::<Vec<String>>()
|
||||||
|
.join(","),
|
||||||
|
),
|
||||||
|
Cell::from(quality.quality.name.to_owned()),
|
||||||
|
Cell::from(date.to_string()),
|
||||||
|
])
|
||||||
|
.style(style_success())
|
||||||
|
},
|
||||||
|
app.is_loading,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn draw_movie_cast<B: Backend>(
|
fn draw_movie_cast<B: Backend>(
|
||||||
|
|||||||
Reference in New Issue
Block a user