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
@@ -4,8 +4,8 @@ use tui::text::Text;
use tui::widgets::{Cell, Paragraph, Row, Wrap};
use tui::Frame;
use crate::app::key_binding::{build_keymapping_string, BARE_POPUP_KEY_MAPPINGS};
use crate::app::radarr::radarr_key_mappings::COLLECTION_DETAILS_KEY_MAPPINGS;
use crate::app::context_clues::{build_context_clue_string, BARE_POPUP_CONTEXT_CLUES};
use crate::app::radarr::radarr_context_clues::COLLECTION_DETAILS_CONTEXT_CLUES;
use crate::app::radarr::{ActiveRadarrBlock, COLLECTION_DETAILS_BLOCKS};
use crate::app::App;
use crate::models::radarr_models::CollectionMovie;
@@ -106,7 +106,7 @@ pub fn draw_collection_details<B: Backend>(
};
let mut help_text = Text::from(format!(
"<↑↓> scroll table | {}",
build_keymapping_string(&COLLECTION_DETAILS_KEY_MAPPINGS)
build_context_clue_string(&COLLECTION_DETAILS_CONTEXT_CLUES)
));
help_text.patch_style(style_help());
let monitored = if collection_selection.monitored {
@@ -261,7 +261,7 @@ fn draw_movie_overview<B: Backend>(f: &mut Frame<'_, B>, app: &mut App<'_>, cont
.overview,
);
overview.patch_style(style_default());
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 paragraph = Paragraph::new(overview)