Functional tags implementation for adding movies! Still need to fix weird loading bug when searching a movie that shows an error too soon before results are loaded, need to fix the horizontal scrolling issue, and I need to change the quality profile map to use the BiMap
This commit is contained in:
@@ -19,7 +19,7 @@ use crate::ui::utils::{
|
||||
use crate::ui::{
|
||||
draw_button, draw_drop_down_list, draw_drop_down_menu_button, draw_drop_down_popup,
|
||||
draw_error_popup, draw_error_popup_over, draw_medium_popup_over, draw_table, draw_text_box,
|
||||
TableProps,
|
||||
draw_text_box_with_label, TableProps,
|
||||
};
|
||||
use crate::utils::convert_runtime;
|
||||
use crate::App;
|
||||
@@ -37,7 +37,8 @@ pub(super) fn draw_add_movie_search_popup<B: Backend>(
|
||||
ActiveRadarrBlock::AddMoviePrompt
|
||||
| ActiveRadarrBlock::AddMovieSelectMonitor
|
||||
| ActiveRadarrBlock::AddMovieSelectMinimumAvailability
|
||||
| ActiveRadarrBlock::AddMovieSelectQualityProfile => {
|
||||
| ActiveRadarrBlock::AddMovieSelectQualityProfile
|
||||
| ActiveRadarrBlock::AddMovieTagsInput => {
|
||||
if context_option.is_some() {
|
||||
draw_medium_popup_over(
|
||||
f,
|
||||
@@ -112,7 +113,8 @@ fn draw_add_movie_search<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, area:
|
||||
| ActiveRadarrBlock::AddMovieSelectMonitor
|
||||
| ActiveRadarrBlock::AddMovieSelectMinimumAvailability
|
||||
| ActiveRadarrBlock::AddMovieSelectQualityProfile
|
||||
| ActiveRadarrBlock::AddMovieAlreadyInLibrary => {
|
||||
| ActiveRadarrBlock::AddMovieAlreadyInLibrary
|
||||
| ActiveRadarrBlock::AddMovieTagsInput => {
|
||||
let mut help_text = Text::from("<enter> details | <esc> edit search");
|
||||
help_text.patch_style(style_help());
|
||||
let help_paragraph = Paragraph::new(help_text)
|
||||
@@ -259,7 +261,9 @@ fn draw_confirmation_popup<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, prom
|
||||
draw_select_quality_profile_popup,
|
||||
);
|
||||
}
|
||||
ActiveRadarrBlock::AddMoviePrompt => draw_confirmation_prompt(f, app, prompt_area),
|
||||
ActiveRadarrBlock::AddMoviePrompt | ActiveRadarrBlock::AddMovieTagsInput => {
|
||||
draw_confirmation_prompt(f, app, prompt_area)
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
@@ -336,7 +340,8 @@ fn draw_confirmation_prompt<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, pro
|
||||
Constraint::Length(3),
|
||||
Constraint::Length(3),
|
||||
Constraint::Length(3),
|
||||
Constraint::Min(5),
|
||||
Constraint::Length(3),
|
||||
Constraint::Min(3),
|
||||
Constraint::Length(3),
|
||||
],
|
||||
prompt_area,
|
||||
@@ -348,7 +353,7 @@ fn draw_confirmation_prompt<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, pro
|
||||
|
||||
let horizontal_chunks = horizontal_chunks(
|
||||
vec![Constraint::Percentage(50), Constraint::Percentage(50)],
|
||||
chunks[5],
|
||||
chunks[6],
|
||||
);
|
||||
|
||||
draw_drop_down_menu_button(
|
||||
@@ -374,6 +379,18 @@ fn draw_confirmation_prompt<B: Backend>(f: &mut Frame<'_, B>, app: &mut App, pro
|
||||
*selected_block == ActiveRadarrBlock::AddMovieSelectQualityProfile,
|
||||
);
|
||||
|
||||
if let Route::Radarr(active_radarr_block, _) = *app.get_current_route() {
|
||||
draw_text_box_with_label(
|
||||
f,
|
||||
chunks[4],
|
||||
"Tags",
|
||||
&app.data.radarr_data.edit_tags.text,
|
||||
*app.data.radarr_data.edit_tags.offset.borrow(),
|
||||
*selected_block == ActiveRadarrBlock::AddMovieTagsInput,
|
||||
active_radarr_block == ActiveRadarrBlock::AddMovieTagsInput,
|
||||
);
|
||||
}
|
||||
|
||||
draw_button(
|
||||
f,
|
||||
horizontal_chunks[0],
|
||||
|
||||
@@ -23,9 +23,9 @@ use crate::ui::radarr_ui::edit_movie_ui::draw_edit_movie_prompt;
|
||||
use crate::ui::radarr_ui::movie_details_ui::draw_movie_info_popup;
|
||||
use crate::ui::utils::{
|
||||
borderless_block, get_width_from_percentage, horizontal_chunks, layout_block,
|
||||
layout_block_top_border, line_gauge_with_label, line_gauge_with_title, show_cursor, style_bold,
|
||||
style_default, style_failure, style_primary, style_success, style_unmonitored, style_warning,
|
||||
title_block, title_block_centered, vertical_chunks_with_margin,
|
||||
layout_block_top_border, line_gauge_with_label, line_gauge_with_title, show_cursor,
|
||||
style_awaiting_import, style_bold, style_default, style_failure, style_primary, style_success,
|
||||
style_unmonitored, style_warning, title_block, title_block_centered, vertical_chunks_with_margin,
|
||||
};
|
||||
use crate::ui::{
|
||||
draw_drop_down_list, draw_large_popup_over, draw_medium_popup_over, draw_popup, draw_popup_over,
|
||||
@@ -639,6 +639,10 @@ fn determine_row_style(downloads_vec: &[DownloadRecord], movie: &Movie) -> Style
|
||||
if download.status == "downloading" {
|
||||
return style_warning();
|
||||
}
|
||||
|
||||
if download.status == "completed" {
|
||||
return style_awaiting_import();
|
||||
}
|
||||
}
|
||||
|
||||
return style_failure();
|
||||
|
||||
@@ -13,8 +13,8 @@ use crate::models::radarr_models::{Credit, MovieHistoryItem, Release, ReleaseFie
|
||||
use crate::models::Route;
|
||||
use crate::ui::utils::{
|
||||
borderless_block, get_width_from_percentage, layout_block_bottom_border, layout_block_top_border,
|
||||
spans_info_default, style_bold, style_default, style_failure, style_primary, style_success,
|
||||
style_warning, vertical_chunks,
|
||||
spans_info_default, style_awaiting_import, style_bold, style_default, style_failure,
|
||||
style_primary, style_success, style_warning, vertical_chunks,
|
||||
};
|
||||
use crate::ui::{
|
||||
draw_drop_down_list, draw_drop_down_popup, draw_prompt_box, draw_prompt_box_with_content,
|
||||
@@ -544,6 +544,7 @@ fn draw_manual_search_confirm_prompt<B: Backend>(
|
||||
fn determine_style_from_download_status(download_status: &str) -> Style {
|
||||
match download_status {
|
||||
"Downloaded" => style_success(),
|
||||
"Awaiting Import" => style_awaiting_import(),
|
||||
"Downloading" => style_warning(),
|
||||
"Missing" => style_failure(),
|
||||
_ => style_success(),
|
||||
|
||||
+5
-8
@@ -6,20 +6,13 @@ use tui::widgets::{Block, BorderType, Borders, LineGauge, Paragraph, Wrap};
|
||||
use tui::{symbols, Frame};
|
||||
|
||||
pub const COLOR_TEAL: Color = Color::Rgb(35, 50, 55);
|
||||
// pub const COLOR_CYAN: Color = Color::Rgb(0, 230, 230);
|
||||
pub const COLOR_CYAN: Color = Color::Cyan;
|
||||
// pub const COLOR_LIGHT_BLUE: Color = Color::Rgb(138, 196, 255);
|
||||
pub const COLOR_LIGHT_BLUE: Color = Color::LightBlue;
|
||||
// pub const COLOR_YELLOW: Color = Color::Rgb(249, 229, 113);
|
||||
pub const COLOR_YELLOW: Color = Color::Yellow;
|
||||
// pub const COLOR_GREEN: Color = Color::Rgb(72, 213, 150);
|
||||
pub const COLOR_GREEN: Color = Color::Green;
|
||||
// pub const COLOR_RED: Color = Color::Rgb(249, 140, 164);
|
||||
pub const COLOR_RED: Color = Color::Red;
|
||||
// pub const COLOR_ORANGE: Color = Color::Rgb(255, 170, 66);
|
||||
// pub const COLOR_WHITE: Color = Color::Rgb(255, 255, 255);
|
||||
pub const COLOR_ORANGE: Color = Color::Rgb(255, 170, 66);
|
||||
pub const COLOR_WHITE: Color = Color::White;
|
||||
// pub const COLOR_MAGENTA: Color = Color::Rgb(139, 0, 139);
|
||||
pub const COLOR_MAGENTA: Color = Color::Magenta;
|
||||
|
||||
pub fn horizontal_chunks(constraints: Vec<Constraint>, area: Rect) -> Vec<Rect> {
|
||||
@@ -191,6 +184,10 @@ pub fn style_failure() -> Style {
|
||||
Style::default().fg(COLOR_RED)
|
||||
}
|
||||
|
||||
pub fn style_awaiting_import() -> Style {
|
||||
Style::default().fg(COLOR_ORANGE)
|
||||
}
|
||||
|
||||
pub fn style_help() -> Style {
|
||||
Style::default().fg(COLOR_LIGHT_BLUE)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user