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:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -4,8 +4,8 @@ use tui::text::{Span, 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::SYSTEM_TASKS_KEY_MAPPINGS;
|
||||
use crate::app::context_clues::{build_context_clue_string, BARE_POPUP_CONTEXT_CLUES};
|
||||
use crate::app::radarr::radarr_context_clues::SYSTEM_TASKS_CONTEXT_CLUES;
|
||||
use crate::app::radarr::{ActiveRadarrBlock, SYSTEM_DETAILS_BLOCKS};
|
||||
use crate::app::App;
|
||||
use crate::models::Route;
|
||||
@@ -88,7 +88,7 @@ fn draw_logs_popup<B: Backend>(f: &mut Frame<'_, B>, app: &mut App<'_>, area: Re
|
||||
is_popup: true,
|
||||
help: Some(format!(
|
||||
"<↑↓←→> scroll | {}",
|
||||
build_keymapping_string(&BARE_POPUP_KEY_MAPPINGS)
|
||||
build_context_clue_string(&BARE_POPUP_CONTEXT_CLUES)
|
||||
)),
|
||||
},
|
||||
);
|
||||
@@ -101,7 +101,7 @@ fn draw_tasks_popup<B: Backend>(f: &mut Frame<'_, B>, app: &mut App<'_>, area: R
|
||||
let context_area = draw_help_and_get_content_rect(
|
||||
f,
|
||||
area,
|
||||
Some(build_keymapping_string(&SYSTEM_TASKS_KEY_MAPPINGS)),
|
||||
Some(build_context_clue_string(&SYSTEM_TASKS_CONTEXT_CLUES)),
|
||||
);
|
||||
|
||||
draw_table(
|
||||
@@ -163,7 +163,7 @@ fn draw_updates_popup<B: Backend>(f: &mut Frame<'_, B>, app: &mut App<'_>, area:
|
||||
area,
|
||||
Some(format!(
|
||||
"<↑↓> scroll | {}",
|
||||
build_keymapping_string(&BARE_POPUP_KEY_MAPPINGS)
|
||||
build_context_clue_string(&BARE_POPUP_CONTEXT_CLUES)
|
||||
)),
|
||||
);
|
||||
let updates = app.data.radarr_data.updates.get_text();
|
||||
|
||||
Reference in New Issue
Block a user