Cleaned up the block selection logic to use the new BlockSelectionState struct
This commit is contained in:
+29
-29
@@ -29,7 +29,7 @@ mod utils;
|
||||
|
||||
static HIGHLIGHT_SYMBOL: &str = "=> ";
|
||||
|
||||
pub fn ui<B: Backend>(f: &mut Frame<'_, B>, app: &mut App) {
|
||||
pub fn ui<B: Backend>(f: &mut Frame<'_, B>, app: &mut App<'_>) {
|
||||
f.render_widget(background_block(), f.size());
|
||||
let main_chunks = if !app.error.text.is_empty() {
|
||||
let chunks = vertical_chunks_with_margin(
|
||||
@@ -65,7 +65,7 @@ pub fn ui<B: Backend>(f: &mut Frame<'_, B>, app: &mut App) {
|
||||
}
|
||||
}
|
||||
|
||||
fn draw_header_row<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, area: Rect) {
|
||||
fn draw_header_row<B: Backend>(f: &mut Frame<'_, B>, app: &mut App<'_>, area: Rect) {
|
||||
let chunks =
|
||||
horizontal_chunks_with_margin(vec![Constraint::Length(75), Constraint::Min(0)], area, 1);
|
||||
let help_text = Text::from(app.server_tabs.get_active_tab_help());
|
||||
@@ -74,7 +74,7 @@ fn draw_header_row<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, area: Rect)
|
||||
.server_tabs
|
||||
.tabs
|
||||
.iter()
|
||||
.map(|tab| Spans::from(Span::styled(&tab.title, style_default_bold())))
|
||||
.map(|tab| Spans::from(Span::styled(tab.title, style_default_bold())))
|
||||
.collect();
|
||||
let tabs = Tabs::new(titles)
|
||||
.block(logo_block())
|
||||
@@ -89,7 +89,7 @@ fn draw_header_row<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, area: Rect)
|
||||
f.render_widget(help, chunks[1]);
|
||||
}
|
||||
|
||||
fn draw_error<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, area: Rect) {
|
||||
fn draw_error<B: Backend>(f: &mut Frame<'_, B>, app: &mut App<'_>, area: Rect) {
|
||||
let block =
|
||||
title_block("Error | <esc> to close").style(style_failure().add_modifier(Modifier::BOLD));
|
||||
|
||||
@@ -112,8 +112,8 @@ fn draw_error<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, area: Rect) {
|
||||
|
||||
pub fn draw_popup<B: Backend>(
|
||||
f: &mut Frame<'_, B>,
|
||||
app: &mut App,
|
||||
popup_fn: fn(&mut Frame<'_, B>, &mut App, Rect),
|
||||
app: &mut App<'_>,
|
||||
popup_fn: fn(&mut Frame<'_, B>, &mut App<'_>, Rect),
|
||||
percent_x: u16,
|
||||
percent_y: u16,
|
||||
) {
|
||||
@@ -125,10 +125,10 @@ pub fn draw_popup<B: Backend>(
|
||||
|
||||
pub fn draw_popup_over<B: Backend>(
|
||||
f: &mut Frame<'_, B>,
|
||||
app: &mut App,
|
||||
app: &mut App<'_>,
|
||||
area: Rect,
|
||||
background_fn: fn(&mut Frame<'_, B>, &mut App, Rect),
|
||||
popup_fn: fn(&mut Frame<'_, B>, &mut App, Rect),
|
||||
background_fn: fn(&mut Frame<'_, B>, &mut App<'_>, Rect),
|
||||
popup_fn: fn(&mut Frame<'_, B>, &mut App<'_>, Rect),
|
||||
percent_x: u16,
|
||||
percent_y: u16,
|
||||
) {
|
||||
@@ -139,55 +139,55 @@ pub fn draw_popup_over<B: Backend>(
|
||||
|
||||
pub fn draw_prompt_popup_over<B: Backend>(
|
||||
f: &mut Frame<'_, B>,
|
||||
app: &mut App,
|
||||
app: &mut App<'_>,
|
||||
area: Rect,
|
||||
background_fn: fn(&mut Frame<'_, B>, &mut App, Rect),
|
||||
popup_fn: fn(&mut Frame<'_, B>, &mut App, Rect),
|
||||
background_fn: fn(&mut Frame<'_, B>, &mut App<'_>, Rect),
|
||||
popup_fn: fn(&mut Frame<'_, B>, &mut App<'_>, Rect),
|
||||
) {
|
||||
draw_popup_over(f, app, area, background_fn, popup_fn, 35, 35);
|
||||
}
|
||||
|
||||
pub fn draw_small_popup_over<B: Backend>(
|
||||
f: &mut Frame<'_, B>,
|
||||
app: &mut App,
|
||||
app: &mut App<'_>,
|
||||
area: Rect,
|
||||
background_fn: fn(&mut Frame<'_, B>, &mut App, Rect),
|
||||
popup_fn: fn(&mut Frame<'_, B>, &mut App, Rect),
|
||||
background_fn: fn(&mut Frame<'_, B>, &mut App<'_>, Rect),
|
||||
popup_fn: fn(&mut Frame<'_, B>, &mut App<'_>, Rect),
|
||||
) {
|
||||
draw_popup_over(f, app, area, background_fn, popup_fn, 40, 40);
|
||||
}
|
||||
|
||||
pub fn draw_medium_popup_over<B: Backend>(
|
||||
f: &mut Frame<'_, B>,
|
||||
app: &mut App,
|
||||
app: &mut App<'_>,
|
||||
area: Rect,
|
||||
background_fn: fn(&mut Frame<'_, B>, &mut App, Rect),
|
||||
popup_fn: fn(&mut Frame<'_, B>, &mut App, Rect),
|
||||
background_fn: fn(&mut Frame<'_, B>, &mut App<'_>, Rect),
|
||||
popup_fn: fn(&mut Frame<'_, B>, &mut App<'_>, Rect),
|
||||
) {
|
||||
draw_popup_over(f, app, area, background_fn, popup_fn, 60, 60);
|
||||
}
|
||||
|
||||
pub fn draw_large_popup_over<B: Backend>(
|
||||
f: &mut Frame<'_, B>,
|
||||
app: &mut App,
|
||||
app: &mut App<'_>,
|
||||
area: Rect,
|
||||
background_fn: fn(&mut Frame<'_, B>, &mut App, Rect),
|
||||
popup_fn: fn(&mut Frame<'_, B>, &mut App, Rect),
|
||||
background_fn: fn(&mut Frame<'_, B>, &mut App<'_>, Rect),
|
||||
popup_fn: fn(&mut Frame<'_, B>, &mut App<'_>, Rect),
|
||||
) {
|
||||
draw_popup_over(f, app, area, background_fn, popup_fn, 75, 75);
|
||||
}
|
||||
|
||||
pub fn draw_drop_down_popup<B: Backend>(
|
||||
f: &mut Frame<'_, B>,
|
||||
app: &mut App,
|
||||
app: &mut App<'_>,
|
||||
area: Rect,
|
||||
background_fn: fn(&mut Frame<'_, B>, &mut App, Rect),
|
||||
drop_down_fn: fn(&mut Frame<'_, B>, &mut App, Rect),
|
||||
background_fn: fn(&mut Frame<'_, B>, &mut App<'_>, Rect),
|
||||
drop_down_fn: fn(&mut Frame<'_, B>, &mut App<'_>, Rect),
|
||||
) {
|
||||
draw_popup_over(f, app, area, background_fn, drop_down_fn, 20, 30);
|
||||
}
|
||||
|
||||
fn draw_context_row<B: Backend>(f: &mut Frame<'_, B>, app: &App, area: Rect) {
|
||||
fn draw_context_row<B: Backend>(f: &mut Frame<'_, B>, app: &App<'_>, area: Rect) {
|
||||
if let Route::Radarr(_, _) = app.get_current_route() {
|
||||
radarr_ui::draw_radarr_context_row(f, app, area)
|
||||
}
|
||||
@@ -195,10 +195,10 @@ fn draw_context_row<B: Backend>(f: &mut Frame<'_, B>, app: &App, area: Rect) {
|
||||
|
||||
pub fn draw_error_popup_over<B: Backend>(
|
||||
f: &mut Frame<'_, B>,
|
||||
app: &mut App,
|
||||
app: &mut App<'_>,
|
||||
area: Rect,
|
||||
message: &str,
|
||||
background_fn: fn(&mut Frame<'_, B>, &mut App, Rect),
|
||||
background_fn: fn(&mut Frame<'_, B>, &mut App<'_>, Rect),
|
||||
) {
|
||||
background_fn(f, app, area);
|
||||
draw_error_popup(f, message);
|
||||
@@ -238,7 +238,7 @@ fn draw_tabs<'a, B: Backend>(
|
||||
let titles = tab_state
|
||||
.tabs
|
||||
.iter()
|
||||
.map(|tab_route| Spans::from(Span::styled(&tab_route.title, style_default_bold())))
|
||||
.map(|tab_route| Spans::from(Span::styled(tab_route.title, style_default_bold())))
|
||||
.collect();
|
||||
let tabs = Tabs::new(titles)
|
||||
.block(block)
|
||||
@@ -258,7 +258,7 @@ pub struct TableProps<'a, T> {
|
||||
pub content: &'a mut StatefulTable<T>,
|
||||
pub table_headers: Vec<&'a str>,
|
||||
pub constraints: Vec<Constraint>,
|
||||
pub help: Option<String>,
|
||||
pub help: Option<&'static str>,
|
||||
}
|
||||
|
||||
fn draw_table<'a, B, T, F>(
|
||||
|
||||
@@ -27,7 +27,7 @@ use crate::App;
|
||||
|
||||
pub(super) fn draw_add_movie_search_popup<B: Backend>(
|
||||
f: &mut Frame<'_, B>,
|
||||
app: &mut App,
|
||||
app: &mut App<'_>,
|
||||
area: Rect,
|
||||
) {
|
||||
if let Route::Radarr(active_radarr_block, context_option) = *app.get_current_route() {
|
||||
@@ -67,7 +67,7 @@ pub(super) fn draw_add_movie_search_popup<B: Backend>(
|
||||
}
|
||||
}
|
||||
|
||||
fn draw_add_movie_search<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, area: Rect) {
|
||||
fn draw_add_movie_search<B: Backend>(f: &mut Frame<'_, B>, app: &mut App<'_>, area: Rect) {
|
||||
let current_selection = if app.data.radarr_data.add_searched_movies.items.is_empty() {
|
||||
AddMovieSearchResult::default()
|
||||
} else {
|
||||
@@ -233,7 +233,7 @@ fn draw_add_movie_search<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, area:
|
||||
);
|
||||
}
|
||||
|
||||
fn draw_confirmation_popup<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, prompt_area: Rect) {
|
||||
fn draw_confirmation_popup<B: Backend>(f: &mut Frame<'_, B>, app: &mut App<'_>, prompt_area: Rect) {
|
||||
if let Route::Radarr(active_radarr_block, _) = *app.get_current_route() {
|
||||
match active_radarr_block {
|
||||
ActiveRadarrBlock::AddMovieSelectMonitor => {
|
||||
@@ -280,7 +280,11 @@ fn draw_confirmation_popup<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, prom
|
||||
}
|
||||
}
|
||||
|
||||
fn draw_select_monitor_popup<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, popup_area: Rect) {
|
||||
fn draw_select_monitor_popup<B: Backend>(
|
||||
f: &mut Frame<'_, B>,
|
||||
app: &mut App<'_>,
|
||||
popup_area: Rect,
|
||||
) {
|
||||
draw_drop_down_list(
|
||||
f,
|
||||
popup_area,
|
||||
@@ -289,7 +293,11 @@ fn draw_select_monitor_popup<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, po
|
||||
);
|
||||
}
|
||||
|
||||
fn draw_confirmation_prompt<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, prompt_area: Rect) {
|
||||
fn draw_confirmation_prompt<B: Backend>(
|
||||
f: &mut Frame<'_, B>,
|
||||
app: &mut App<'_>,
|
||||
prompt_area: Rect,
|
||||
) {
|
||||
let (movie_title, movie_overview) = if let Route::Radarr(_, Some(_)) = app.get_current_route() {
|
||||
(
|
||||
&app
|
||||
@@ -328,8 +336,8 @@ fn draw_confirmation_prompt<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, pro
|
||||
let title = format!("Add Movie - {}", movie_title);
|
||||
let prompt = movie_overview;
|
||||
let yes_no_value = app.data.radarr_data.prompt_confirm;
|
||||
let selected_block = app.data.radarr_data.selected_block;
|
||||
let highlight_yes_no = selected_block == ActiveRadarrBlock::AddMovieConfirmPrompt;
|
||||
let selected_block = app.data.radarr_data.selected_block.get_active_block();
|
||||
let highlight_yes_no = selected_block == &ActiveRadarrBlock::AddMovieConfirmPrompt;
|
||||
|
||||
let selected_monitor = app.data.radarr_data.monitor_list.current_selection();
|
||||
let selected_minimum_availability = app
|
||||
@@ -374,7 +382,7 @@ fn draw_confirmation_prompt<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, pro
|
||||
chunks[1],
|
||||
"Root Folder",
|
||||
&selected_root_folder.path,
|
||||
selected_block == ActiveRadarrBlock::AddMovieSelectRootFolder,
|
||||
selected_block == &ActiveRadarrBlock::AddMovieSelectRootFolder,
|
||||
);
|
||||
|
||||
draw_drop_down_menu_button(
|
||||
@@ -382,7 +390,7 @@ fn draw_confirmation_prompt<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, pro
|
||||
chunks[2],
|
||||
"Monitor",
|
||||
selected_monitor.to_display_str(),
|
||||
selected_block == ActiveRadarrBlock::AddMovieSelectMonitor,
|
||||
selected_block == &ActiveRadarrBlock::AddMovieSelectMonitor,
|
||||
);
|
||||
|
||||
draw_drop_down_menu_button(
|
||||
@@ -390,14 +398,14 @@ fn draw_confirmation_prompt<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, pro
|
||||
chunks[3],
|
||||
"Minimum Availability",
|
||||
selected_minimum_availability.to_display_str(),
|
||||
selected_block == ActiveRadarrBlock::AddMovieSelectMinimumAvailability,
|
||||
selected_block == &ActiveRadarrBlock::AddMovieSelectMinimumAvailability,
|
||||
);
|
||||
draw_drop_down_menu_button(
|
||||
f,
|
||||
chunks[4],
|
||||
"Quality Profile",
|
||||
selected_quality_profile,
|
||||
selected_block == ActiveRadarrBlock::AddMovieSelectQualityProfile,
|
||||
selected_block == &ActiveRadarrBlock::AddMovieSelectQualityProfile,
|
||||
);
|
||||
|
||||
if let Route::Radarr(active_radarr_block, _) = *app.get_current_route() {
|
||||
@@ -407,7 +415,7 @@ fn draw_confirmation_prompt<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, pro
|
||||
"Tags",
|
||||
&app.data.radarr_data.edit_tags.text,
|
||||
*app.data.radarr_data.edit_tags.offset.borrow(),
|
||||
selected_block == ActiveRadarrBlock::AddMovieTagsInput,
|
||||
selected_block == &ActiveRadarrBlock::AddMovieTagsInput,
|
||||
active_radarr_block == ActiveRadarrBlock::AddMovieTagsInput,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ use crate::utils::convert_runtime;
|
||||
|
||||
pub(super) fn draw_collection_details_popup<B: Backend>(
|
||||
f: &mut Frame<'_, B>,
|
||||
app: &mut App,
|
||||
app: &mut App<'_>,
|
||||
content_area: Rect,
|
||||
) {
|
||||
if let Route::Radarr(active_radarr_block, context_option) = app.get_current_route() {
|
||||
@@ -40,7 +40,7 @@ pub(super) fn draw_collection_details_popup<B: Backend>(
|
||||
|
||||
pub(super) fn draw_collection_details<B: Backend>(
|
||||
f: &mut Frame<'_, B>,
|
||||
app: &mut App,
|
||||
app: &mut App<'_>,
|
||||
content_area: Rect,
|
||||
) {
|
||||
let chunks = vertical_chunks_with_margin(
|
||||
@@ -213,7 +213,7 @@ pub(super) fn draw_collection_details<B: Backend>(
|
||||
);
|
||||
}
|
||||
|
||||
fn draw_movie_overview<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, content_area: Rect) {
|
||||
fn draw_movie_overview<B: Backend>(f: &mut Frame<'_, B>, app: &mut App<'_>, content_area: Rect) {
|
||||
let title_block = title_block("Overview");
|
||||
f.render_widget(title_block, content_area);
|
||||
|
||||
|
||||
@@ -9,14 +9,14 @@ use crate::ui::draw_prompt_box_with_checkboxes;
|
||||
|
||||
pub(super) fn draw_delete_movie_prompt<B: Backend>(
|
||||
f: &mut Frame<'_, B>,
|
||||
app: &mut App,
|
||||
app: &mut App<'_>,
|
||||
prompt_area: Rect,
|
||||
) {
|
||||
if matches!(
|
||||
*app.get_current_route(),
|
||||
Route::Radarr(ActiveRadarrBlock::DeleteMoviePrompt, _)
|
||||
) {
|
||||
let selected_block = app.data.radarr_data.selected_block;
|
||||
let selected_block = app.data.radarr_data.selected_block.get_active_block();
|
||||
draw_prompt_box_with_checkboxes(
|
||||
f,
|
||||
prompt_area,
|
||||
@@ -30,15 +30,15 @@ pub(super) fn draw_delete_movie_prompt<B: Backend>(
|
||||
(
|
||||
"Delete Movie Files",
|
||||
app.data.radarr_data.delete_movie_files,
|
||||
selected_block == ActiveRadarrBlock::DeleteMovieToggleDeleteFile,
|
||||
selected_block == &ActiveRadarrBlock::DeleteMovieToggleDeleteFile,
|
||||
),
|
||||
(
|
||||
"Add List Exclusion",
|
||||
app.data.radarr_data.add_list_exclusion,
|
||||
selected_block == ActiveRadarrBlock::DeleteMovieToggleAddListExclusion,
|
||||
selected_block == &ActiveRadarrBlock::DeleteMovieToggleAddListExclusion,
|
||||
),
|
||||
],
|
||||
selected_block == ActiveRadarrBlock::DeleteMovieConfirmPrompt,
|
||||
selected_block == &ActiveRadarrBlock::DeleteMovieConfirmPrompt,
|
||||
app.data.radarr_data.prompt_confirm,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ use crate::ui::{
|
||||
|
||||
pub(super) fn draw_edit_collection_prompt<B: Backend>(
|
||||
f: &mut Frame<'_, B>,
|
||||
app: &mut App,
|
||||
app: &mut App<'_>,
|
||||
prompt_area: Rect,
|
||||
) {
|
||||
if let Route::Radarr(active_radarr_block, _) = *app.get_current_route() {
|
||||
@@ -54,7 +54,7 @@ pub(super) fn draw_edit_collection_prompt<B: Backend>(
|
||||
|
||||
fn draw_edit_collection_confirmation_prompt<B: Backend>(
|
||||
f: &mut Frame<'_, B>,
|
||||
app: &mut App,
|
||||
app: &mut App<'_>,
|
||||
prompt_area: Rect,
|
||||
) {
|
||||
let (collection_title, collection_overview) =
|
||||
@@ -97,8 +97,8 @@ fn draw_edit_collection_confirmation_prompt<B: Backend>(
|
||||
};
|
||||
let title = format!("Edit - {}", collection_title);
|
||||
let yes_no_value = app.data.radarr_data.prompt_confirm;
|
||||
let selected_block = app.data.radarr_data.selected_block;
|
||||
let highlight_yes_no = selected_block == ActiveRadarrBlock::EditCollectionConfirmPrompt;
|
||||
let selected_block = app.data.radarr_data.selected_block.get_active_block();
|
||||
let highlight_yes_no = selected_block == &ActiveRadarrBlock::EditCollectionConfirmPrompt;
|
||||
|
||||
let selected_minimum_availability = app
|
||||
.data
|
||||
@@ -141,7 +141,7 @@ fn draw_edit_collection_confirmation_prompt<B: Backend>(
|
||||
chunks[1],
|
||||
"Monitored",
|
||||
app.data.radarr_data.edit_monitored.unwrap_or_default(),
|
||||
selected_block == ActiveRadarrBlock::EditCollectionToggleMonitored,
|
||||
selected_block == &ActiveRadarrBlock::EditCollectionToggleMonitored,
|
||||
);
|
||||
|
||||
draw_drop_down_menu_button(
|
||||
@@ -149,14 +149,14 @@ fn draw_edit_collection_confirmation_prompt<B: Backend>(
|
||||
chunks[2],
|
||||
"Minimum Availability",
|
||||
selected_minimum_availability.to_display_str(),
|
||||
selected_block == ActiveRadarrBlock::EditCollectionSelectMinimumAvailability,
|
||||
selected_block == &ActiveRadarrBlock::EditCollectionSelectMinimumAvailability,
|
||||
);
|
||||
draw_drop_down_menu_button(
|
||||
f,
|
||||
chunks[3],
|
||||
"Quality Profile",
|
||||
selected_quality_profile,
|
||||
selected_block == ActiveRadarrBlock::EditCollectionSelectQualityProfile,
|
||||
selected_block == &ActiveRadarrBlock::EditCollectionSelectQualityProfile,
|
||||
);
|
||||
|
||||
if let Route::Radarr(active_radarr_block, _) = *app.get_current_route() {
|
||||
@@ -166,7 +166,7 @@ fn draw_edit_collection_confirmation_prompt<B: Backend>(
|
||||
"Root Folder",
|
||||
&app.data.radarr_data.edit_path.text,
|
||||
*app.data.radarr_data.edit_path.offset.borrow(),
|
||||
selected_block == ActiveRadarrBlock::EditCollectionRootFolderPathInput,
|
||||
selected_block == &ActiveRadarrBlock::EditCollectionRootFolderPathInput,
|
||||
active_radarr_block == ActiveRadarrBlock::EditCollectionRootFolderPathInput,
|
||||
);
|
||||
}
|
||||
@@ -176,7 +176,7 @@ fn draw_edit_collection_confirmation_prompt<B: Backend>(
|
||||
chunks[5],
|
||||
"Search on Add",
|
||||
app.data.radarr_data.edit_search_on_add.unwrap_or_default(),
|
||||
selected_block == ActiveRadarrBlock::EditCollectionToggleSearchOnAdd,
|
||||
selected_block == &ActiveRadarrBlock::EditCollectionToggleSearchOnAdd,
|
||||
);
|
||||
|
||||
draw_button(
|
||||
|
||||
@@ -18,7 +18,7 @@ use crate::ui::{
|
||||
|
||||
pub(super) fn draw_edit_movie_prompt<B: Backend>(
|
||||
f: &mut Frame<'_, B>,
|
||||
app: &mut App,
|
||||
app: &mut App<'_>,
|
||||
prompt_area: Rect,
|
||||
) {
|
||||
if let Route::Radarr(active_radarr_block, _) = *app.get_current_route() {
|
||||
@@ -54,7 +54,7 @@ pub(super) fn draw_edit_movie_prompt<B: Backend>(
|
||||
|
||||
fn draw_edit_movie_confirmation_prompt<B: Backend>(
|
||||
f: &mut Frame<'_, B>,
|
||||
app: &mut App,
|
||||
app: &mut App<'_>,
|
||||
prompt_area: Rect,
|
||||
) {
|
||||
let (movie_title, movie_overview) = if app.data.radarr_data.filtered_movies.items.is_empty() {
|
||||
@@ -94,8 +94,8 @@ fn draw_edit_movie_confirmation_prompt<B: Backend>(
|
||||
};
|
||||
let title = format!("Edit - {}", movie_title);
|
||||
let yes_no_value = app.data.radarr_data.prompt_confirm;
|
||||
let selected_block = app.data.radarr_data.selected_block;
|
||||
let highlight_yes_no = selected_block == ActiveRadarrBlock::EditMovieConfirmPrompt;
|
||||
let selected_block = app.data.radarr_data.selected_block.get_active_block();
|
||||
let highlight_yes_no = selected_block == &ActiveRadarrBlock::EditMovieConfirmPrompt;
|
||||
|
||||
let selected_minimum_availability = app
|
||||
.data
|
||||
@@ -138,7 +138,7 @@ fn draw_edit_movie_confirmation_prompt<B: Backend>(
|
||||
chunks[1],
|
||||
"Monitored",
|
||||
app.data.radarr_data.edit_monitored.unwrap_or_default(),
|
||||
selected_block == ActiveRadarrBlock::EditMovieToggleMonitored,
|
||||
selected_block == &ActiveRadarrBlock::EditMovieToggleMonitored,
|
||||
);
|
||||
|
||||
draw_drop_down_menu_button(
|
||||
@@ -146,14 +146,14 @@ fn draw_edit_movie_confirmation_prompt<B: Backend>(
|
||||
chunks[2],
|
||||
"Minimum Availability",
|
||||
selected_minimum_availability.to_display_str(),
|
||||
selected_block == ActiveRadarrBlock::EditMovieSelectMinimumAvailability,
|
||||
selected_block == &ActiveRadarrBlock::EditMovieSelectMinimumAvailability,
|
||||
);
|
||||
draw_drop_down_menu_button(
|
||||
f,
|
||||
chunks[3],
|
||||
"Quality Profile",
|
||||
selected_quality_profile,
|
||||
selected_block == ActiveRadarrBlock::EditMovieSelectQualityProfile,
|
||||
selected_block == &ActiveRadarrBlock::EditMovieSelectQualityProfile,
|
||||
);
|
||||
|
||||
if let Route::Radarr(active_radarr_block, _) = *app.get_current_route() {
|
||||
@@ -163,7 +163,7 @@ fn draw_edit_movie_confirmation_prompt<B: Backend>(
|
||||
"Path",
|
||||
&app.data.radarr_data.edit_path.text,
|
||||
*app.data.radarr_data.edit_path.offset.borrow(),
|
||||
selected_block == ActiveRadarrBlock::EditMoviePathInput,
|
||||
selected_block == &ActiveRadarrBlock::EditMoviePathInput,
|
||||
active_radarr_block == ActiveRadarrBlock::EditMoviePathInput,
|
||||
);
|
||||
draw_text_box_with_label(
|
||||
@@ -172,7 +172,7 @@ fn draw_edit_movie_confirmation_prompt<B: Backend>(
|
||||
"Tags",
|
||||
&app.data.radarr_data.edit_tags.text,
|
||||
*app.data.radarr_data.edit_tags.offset.borrow(),
|
||||
selected_block == ActiveRadarrBlock::EditMovieTagsInput,
|
||||
selected_block == &ActiveRadarrBlock::EditMovieTagsInput,
|
||||
active_radarr_block == ActiveRadarrBlock::EditMovieTagsInput,
|
||||
);
|
||||
}
|
||||
|
||||
+27
-19
@@ -43,7 +43,7 @@ mod edit_collection_ui;
|
||||
mod edit_movie_ui;
|
||||
mod movie_details_ui;
|
||||
|
||||
pub(super) fn draw_radarr_ui<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, area: Rect) {
|
||||
pub(super) fn draw_radarr_ui<B: Backend>(f: &mut Frame<'_, B>, app: &mut App<'_>, area: Rect) {
|
||||
let (content_rect, _) = draw_tabs(f, area, "Movies", &app.data.radarr_data.main_tabs);
|
||||
|
||||
if let Route::Radarr(active_radarr_block, context_option) = *app.get_current_route() {
|
||||
@@ -195,7 +195,7 @@ pub(super) fn draw_radarr_ui<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, ar
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn draw_radarr_context_row<B: Backend>(f: &mut Frame<'_, B>, app: &App, area: Rect) {
|
||||
pub(super) fn draw_radarr_context_row<B: Backend>(f: &mut Frame<'_, B>, app: &App<'_>, area: Rect) {
|
||||
let chunks = horizontal_chunks(vec![Constraint::Min(0), Constraint::Length(20)], area);
|
||||
|
||||
let context_chunks = horizontal_chunks(
|
||||
@@ -208,7 +208,7 @@ pub(super) fn draw_radarr_context_row<B: Backend>(f: &mut Frame<'_, B>, app: &Ap
|
||||
draw_radarr_logo(f, chunks[1]);
|
||||
}
|
||||
|
||||
fn draw_library<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, area: Rect) {
|
||||
fn draw_library<B: Backend>(f: &mut Frame<'_, B>, app: &mut App<'_>, area: Rect) {
|
||||
let current_selection = if !app.data.radarr_data.filtered_movies.items.is_empty() {
|
||||
app
|
||||
.data
|
||||
@@ -314,7 +314,7 @@ fn draw_library<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, area: Rect) {
|
||||
|
||||
fn draw_update_all_movies_prompt<B: Backend>(
|
||||
f: &mut Frame<'_, B>,
|
||||
app: &mut App,
|
||||
app: &mut App<'_>,
|
||||
prompt_area: Rect,
|
||||
) {
|
||||
draw_prompt_box(
|
||||
@@ -328,7 +328,7 @@ fn draw_update_all_movies_prompt<B: Backend>(
|
||||
|
||||
fn draw_update_downloads_prompt<B: Backend>(
|
||||
f: &mut Frame<'_, B>,
|
||||
app: &mut App,
|
||||
app: &mut App<'_>,
|
||||
prompt_area: Rect,
|
||||
) {
|
||||
draw_prompt_box(
|
||||
@@ -342,7 +342,7 @@ fn draw_update_downloads_prompt<B: Backend>(
|
||||
|
||||
fn draw_update_all_collections_prompt<B: Backend>(
|
||||
f: &mut Frame<'_, B>,
|
||||
app: &mut App,
|
||||
app: &mut App<'_>,
|
||||
prompt_area: Rect,
|
||||
) {
|
||||
draw_prompt_box(
|
||||
@@ -354,7 +354,11 @@ fn draw_update_all_collections_prompt<B: Backend>(
|
||||
);
|
||||
}
|
||||
|
||||
fn draw_delete_download_prompt<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, prompt_area: Rect) {
|
||||
fn draw_delete_download_prompt<B: Backend>(
|
||||
f: &mut Frame<'_, B>,
|
||||
app: &mut App<'_>,
|
||||
prompt_area: Rect,
|
||||
) {
|
||||
draw_prompt_box(
|
||||
f,
|
||||
prompt_area,
|
||||
@@ -370,7 +374,7 @@ fn draw_delete_download_prompt<B: Backend>(f: &mut Frame<'_, B>, app: &mut App,
|
||||
|
||||
fn draw_delete_root_folder_prompt<B: Backend>(
|
||||
f: &mut Frame<'_, B>,
|
||||
app: &mut App,
|
||||
app: &mut App<'_>,
|
||||
prompt_area: Rect,
|
||||
) {
|
||||
draw_prompt_box(
|
||||
@@ -386,7 +390,11 @@ fn draw_delete_root_folder_prompt<B: Backend>(
|
||||
);
|
||||
}
|
||||
|
||||
fn draw_add_root_folder_prompt_box<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, area: Rect) {
|
||||
fn draw_add_root_folder_prompt_box<B: Backend>(
|
||||
f: &mut Frame<'_, B>,
|
||||
app: &mut App<'_>,
|
||||
area: Rect,
|
||||
) {
|
||||
let chunks = vertical_chunks_with_margin(
|
||||
vec![
|
||||
Constraint::Length(3),
|
||||
@@ -413,7 +421,7 @@ fn draw_add_root_folder_prompt_box<B: Backend>(f: &mut Frame<'_, B>, app: &mut A
|
||||
f.render_widget(help, chunks[1]);
|
||||
}
|
||||
|
||||
fn draw_search_box<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, area: Rect) {
|
||||
fn draw_search_box<B: Backend>(f: &mut Frame<'_, B>, app: &mut App<'_>, area: Rect) {
|
||||
let chunks =
|
||||
vertical_chunks_with_margin(vec![Constraint::Length(3), Constraint::Min(0)], area, 1);
|
||||
if !app.data.radarr_data.is_searching {
|
||||
@@ -454,7 +462,7 @@ fn draw_search_box<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, area: Rect)
|
||||
}
|
||||
}
|
||||
|
||||
fn draw_filter_box<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, area: Rect) {
|
||||
fn draw_filter_box<B: Backend>(f: &mut Frame<'_, B>, app: &mut App<'_>, area: Rect) {
|
||||
let chunks =
|
||||
vertical_chunks_with_margin(vec![Constraint::Length(3), Constraint::Min(0)], area, 1);
|
||||
if !app.data.radarr_data.is_filtering {
|
||||
@@ -504,7 +512,7 @@ fn draw_radarr_logo<B: Backend>(f: &mut Frame<'_, B>, area: Rect) {
|
||||
f.render_widget(logo, area);
|
||||
}
|
||||
|
||||
fn draw_stats_context<B: Backend>(f: &mut Frame<'_, B>, app: &App, area: Rect) {
|
||||
fn draw_stats_context<B: Backend>(f: &mut Frame<'_, B>, app: &App<'_>, area: Rect) {
|
||||
let block = title_block("Stats");
|
||||
|
||||
if !app.data.radarr_data.version.is_empty() {
|
||||
@@ -602,7 +610,7 @@ fn draw_stats_context<B: Backend>(f: &mut Frame<'_, B>, app: &App, area: Rect) {
|
||||
}
|
||||
}
|
||||
|
||||
fn draw_downloads_context<B: Backend>(f: &mut Frame<'_, B>, app: &App, area: Rect) {
|
||||
fn draw_downloads_context<B: Backend>(f: &mut Frame<'_, B>, app: &App<'_>, area: Rect) {
|
||||
let block = title_block("Downloads");
|
||||
let downloads_vec = &app.data.radarr_data.downloads.items;
|
||||
|
||||
@@ -632,7 +640,7 @@ fn draw_downloads_context<B: Backend>(f: &mut Frame<'_, B>, app: &App, area: Rec
|
||||
}
|
||||
}
|
||||
|
||||
fn draw_downloads<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, area: Rect) {
|
||||
fn draw_downloads<B: Backend>(f: &mut Frame<'_, B>, app: &mut App<'_>, area: Rect) {
|
||||
let current_selection = if app.data.radarr_data.downloads.items.is_empty() {
|
||||
DownloadRecord::default()
|
||||
} else {
|
||||
@@ -708,7 +716,7 @@ fn draw_downloads<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, area: Rect) {
|
||||
);
|
||||
}
|
||||
|
||||
fn draw_collections<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, area: Rect) {
|
||||
fn draw_collections<B: Backend>(f: &mut Frame<'_, B>, app: &mut App<'_>, area: Rect) {
|
||||
let current_selection = if !app.data.radarr_data.filtered_collections.items.is_empty() {
|
||||
app
|
||||
.data
|
||||
@@ -790,7 +798,7 @@ fn draw_collections<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, area: Rect)
|
||||
);
|
||||
}
|
||||
|
||||
fn draw_root_folders<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, area: Rect) {
|
||||
fn draw_root_folders<B: Backend>(f: &mut Frame<'_, B>, app: &mut App<'_>, area: Rect) {
|
||||
draw_table(
|
||||
f,
|
||||
area,
|
||||
@@ -863,7 +871,7 @@ fn determine_row_style(downloads_vec: &[DownloadRecord], movie: &Movie) -> Style
|
||||
|
||||
fn draw_select_minimum_availability_popup<B: Backend>(
|
||||
f: &mut Frame<'_, B>,
|
||||
app: &mut App,
|
||||
app: &mut App<'_>,
|
||||
popup_area: Rect,
|
||||
) {
|
||||
draw_drop_down_list(
|
||||
@@ -876,7 +884,7 @@ fn draw_select_minimum_availability_popup<B: Backend>(
|
||||
|
||||
fn draw_select_quality_profile_popup<B: Backend>(
|
||||
f: &mut Frame<'_, B>,
|
||||
app: &mut App,
|
||||
app: &mut App<'_>,
|
||||
popup_area: Rect,
|
||||
) {
|
||||
draw_drop_down_list(
|
||||
@@ -889,7 +897,7 @@ fn draw_select_quality_profile_popup<B: Backend>(
|
||||
|
||||
fn draw_select_root_folder_popup<B: Backend>(
|
||||
f: &mut Frame<'_, B>,
|
||||
app: &mut App,
|
||||
app: &mut App<'_>,
|
||||
popup_area: Rect,
|
||||
) {
|
||||
draw_drop_down_list(
|
||||
|
||||
@@ -22,7 +22,11 @@ use crate::ui::{
|
||||
};
|
||||
use crate::utils::convert_to_gb;
|
||||
|
||||
pub(super) fn draw_movie_info_popup<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, area: Rect) {
|
||||
pub(super) fn draw_movie_info_popup<B: Backend>(
|
||||
f: &mut Frame<'_, B>,
|
||||
app: &mut App<'_>,
|
||||
area: Rect,
|
||||
) {
|
||||
let (content_area, _) = draw_tabs(f, area, "Movie Info", &app.data.radarr_data.movie_info_tabs);
|
||||
|
||||
if let Route::Radarr(active_radarr_block, context_option) = app.get_current_route() {
|
||||
@@ -67,7 +71,7 @@ pub(super) fn draw_movie_info_popup<B: Backend>(f: &mut Frame<'_, B>, app: &mut
|
||||
}
|
||||
}
|
||||
|
||||
fn draw_movie_info<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, area: Rect) {
|
||||
fn draw_movie_info<B: Backend>(f: &mut Frame<'_, B>, app: &mut App<'_>, area: Rect) {
|
||||
if let Route::Radarr(active_radarr_block, _) =
|
||||
app.data.radarr_data.movie_info_tabs.get_active_route()
|
||||
{
|
||||
@@ -83,7 +87,11 @@ fn draw_movie_info<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, area: Rect)
|
||||
}
|
||||
}
|
||||
|
||||
fn draw_search_movie_prompt<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, prompt_area: Rect) {
|
||||
fn draw_search_movie_prompt<B: Backend>(
|
||||
f: &mut Frame<'_, B>,
|
||||
app: &mut App<'_>,
|
||||
prompt_area: Rect,
|
||||
) {
|
||||
draw_prompt_box(
|
||||
f,
|
||||
prompt_area,
|
||||
@@ -97,7 +105,11 @@ fn draw_search_movie_prompt<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, pro
|
||||
);
|
||||
}
|
||||
|
||||
fn draw_update_and_scan_prompt<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, prompt_area: Rect) {
|
||||
fn draw_update_and_scan_prompt<B: Backend>(
|
||||
f: &mut Frame<'_, B>,
|
||||
app: &mut App<'_>,
|
||||
prompt_area: Rect,
|
||||
) {
|
||||
draw_prompt_box(
|
||||
f,
|
||||
prompt_area,
|
||||
@@ -111,7 +123,7 @@ fn draw_update_and_scan_prompt<B: Backend>(f: &mut Frame<'_, B>, app: &mut App,
|
||||
);
|
||||
}
|
||||
|
||||
fn draw_file_info<B: Backend>(f: &mut Frame<'_, B>, app: &App, content_area: Rect) {
|
||||
fn draw_file_info<B: Backend>(f: &mut Frame<'_, B>, app: &App<'_>, content_area: Rect) {
|
||||
let file_info = app.data.radarr_data.file_details.to_owned();
|
||||
|
||||
if !file_info.is_empty() {
|
||||
@@ -167,7 +179,7 @@ fn draw_file_info<B: Backend>(f: &mut Frame<'_, B>, app: &App, content_area: Rec
|
||||
}
|
||||
}
|
||||
|
||||
fn draw_movie_details<B: Backend>(f: &mut Frame<'_, B>, app: &App, content_area: Rect) {
|
||||
fn draw_movie_details<B: Backend>(f: &mut Frame<'_, B>, app: &App<'_>, content_area: Rect) {
|
||||
let movie_details = app.data.radarr_data.movie_details.get_text();
|
||||
let block = layout_block_top_border();
|
||||
|
||||
@@ -210,7 +222,7 @@ fn draw_movie_details<B: Backend>(f: &mut Frame<'_, B>, app: &App, content_area:
|
||||
}
|
||||
}
|
||||
|
||||
fn draw_movie_history<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, content_area: Rect) {
|
||||
fn draw_movie_history<B: Backend>(f: &mut Frame<'_, B>, app: &mut App<'_>, content_area: Rect) {
|
||||
let current_selection = if app.data.radarr_data.movie_history.items.is_empty() {
|
||||
MovieHistoryItem::default()
|
||||
} else {
|
||||
@@ -285,7 +297,7 @@ fn draw_movie_history<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, content_a
|
||||
}
|
||||
}
|
||||
|
||||
fn draw_movie_cast<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, content_area: Rect) {
|
||||
fn draw_movie_cast<B: Backend>(f: &mut Frame<'_, B>, app: &mut App<'_>, content_area: Rect) {
|
||||
draw_table(
|
||||
f,
|
||||
content_area,
|
||||
@@ -317,7 +329,7 @@ fn draw_movie_cast<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, content_area
|
||||
);
|
||||
}
|
||||
|
||||
fn draw_movie_crew<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, content_area: Rect) {
|
||||
fn draw_movie_crew<B: Backend>(f: &mut Frame<'_, B>, app: &mut App<'_>, content_area: Rect) {
|
||||
draw_table(
|
||||
f,
|
||||
content_area,
|
||||
@@ -351,7 +363,7 @@ fn draw_movie_crew<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, content_area
|
||||
);
|
||||
}
|
||||
|
||||
fn draw_movie_releases<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, content_area: Rect) {
|
||||
fn draw_movie_releases<B: Backend>(f: &mut Frame<'_, B>, app: &mut App<'_>, content_area: Rect) {
|
||||
let current_selection = if app.data.radarr_data.movie_releases.items.is_empty() {
|
||||
Release::default()
|
||||
} else {
|
||||
@@ -475,7 +487,7 @@ fn draw_movie_releases<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, content_
|
||||
|
||||
fn draw_manual_search_confirm_prompt<B: Backend>(
|
||||
f: &mut Frame<'_, B>,
|
||||
app: &mut App,
|
||||
app: &mut App<'_>,
|
||||
prompt_area: Rect,
|
||||
) {
|
||||
let current_selection = app.data.radarr_data.movie_releases.current_selection();
|
||||
|
||||
Reference in New Issue
Block a user