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:
@@ -0,0 +1,23 @@
|
||||
use crate::app::key_binding::{KeyBinding, DEFAULT_KEYBINDINGS};
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "context_clues_tests.rs"]
|
||||
mod context_clues_tests;
|
||||
|
||||
pub(in crate::app) type ContextClue = (KeyBinding, &'static str);
|
||||
|
||||
pub fn build_context_clue_string(context_clues: &[(KeyBinding, &str)]) -> String {
|
||||
context_clues
|
||||
.iter()
|
||||
.map(|(key_binding, desc)| format!("{} {}", key_binding.key, desc))
|
||||
.collect::<Vec<String>>()
|
||||
.join(" | ")
|
||||
}
|
||||
|
||||
pub static SERVARR_CONTEXT_CLUES: [ContextClue; 2] = [
|
||||
(DEFAULT_KEYBINDINGS.tab, "change servarr"),
|
||||
(DEFAULT_KEYBINDINGS.quit, DEFAULT_KEYBINDINGS.quit.desc),
|
||||
];
|
||||
|
||||
pub static BARE_POPUP_CONTEXT_CLUES: [ContextClue; 1] =
|
||||
[(DEFAULT_KEYBINDINGS.esc, DEFAULT_KEYBINDINGS.esc.desc)];
|
||||
Reference in New Issue
Block a user