Refactored the key_mappings into files for context_clues for better naming conventions, and added unit tests for the clues and the contents of the ActiveRadarrBlock arrays that are used for chain-of-responsibility delegation in the handlers and UI components.

This commit is contained in:
2023-08-08 10:50:07 -06:00
parent 68aaa21030
commit dd339d1685
13 changed files with 710 additions and 114 deletions
+5 -5
View File
@@ -4,8 +4,8 @@ use tui::text::Text;
use tui::widgets::{Cell, ListItem, Paragraph, Row};
use tui::Frame;
use crate::app::key_binding::{build_keymapping_string, BARE_POPUP_KEY_MAPPINGS};
use crate::app::radarr::radarr_key_mappings::ADD_MOVIE_SEARCH_RESULTS_KEY_MAPPINGS;
use crate::app::context_clues::{build_context_clue_string, BARE_POPUP_CONTEXT_CLUES};
use crate::app::radarr::radarr_context_clues::ADD_MOVIE_SEARCH_RESULTS_CONTEXT_CLUES;
use crate::app::radarr::{ActiveRadarrBlock, ADD_MOVIE_BLOCKS};
use crate::models::radarr_models::AddMovieSearchResult;
use crate::models::Route;
@@ -144,7 +144,7 @@ fn draw_add_movie_search<B: Backend>(f: &mut Frame<'_, B>, app: &mut App<'_>, ar
);
f.render_widget(layout_block(), chunks[1]);
let mut help_text = Text::from(build_keymapping_string(&BARE_POPUP_KEY_MAPPINGS));
let mut help_text = Text::from(build_context_clue_string(&BARE_POPUP_CONTEXT_CLUES));
help_text.patch_style(style_help());
let help_paragraph = Paragraph::new(help_text)
.block(borderless_block())
@@ -163,8 +163,8 @@ fn draw_add_movie_search<B: Backend>(f: &mut Frame<'_, B>, app: &mut App<'_>, ar
| ActiveRadarrBlock::AddMovieSelectRootFolder
| ActiveRadarrBlock::AddMovieAlreadyInLibrary
| ActiveRadarrBlock::AddMovieTagsInput => {
let mut help_text = Text::from(build_keymapping_string(
&ADD_MOVIE_SEARCH_RESULTS_KEY_MAPPINGS,
let mut help_text = Text::from(build_context_clue_string(
&ADD_MOVIE_SEARCH_RESULTS_CONTEXT_CLUES,
));
help_text.patch_style(style_help());
let help_paragraph = Paragraph::new(help_text)