Tweaked the key mappings so that it is now easier to change key mappings and update the corresponding UI elements as well
This commit is contained in:
+3
-3
@@ -294,7 +294,7 @@ pub struct TableProps<'a, T> {
|
||||
pub content: &'a mut StatefulTable<T>,
|
||||
pub table_headers: Vec<&'a str>,
|
||||
pub constraints: Vec<Constraint>,
|
||||
pub help: Option<&'static str>,
|
||||
pub help: Option<String>,
|
||||
}
|
||||
|
||||
pub struct ListProps<'a, T> {
|
||||
@@ -302,7 +302,7 @@ pub struct ListProps<'a, T> {
|
||||
pub title: &'static str,
|
||||
pub is_loading: bool,
|
||||
pub is_popup: bool,
|
||||
pub help: Option<&'static str>,
|
||||
pub help: Option<String>,
|
||||
}
|
||||
|
||||
fn draw_table<'a, B, T, F>(
|
||||
@@ -618,7 +618,7 @@ pub fn draw_list_box<'a, B: Backend, T>(
|
||||
fn draw_help_and_get_content_rect<B: Backend>(
|
||||
f: &mut Frame<'_, B>,
|
||||
area: Rect,
|
||||
help: Option<&str>,
|
||||
help: Option<String>,
|
||||
) -> Rect {
|
||||
if let Some(help_string) = help {
|
||||
let chunks =
|
||||
|
||||
@@ -4,6 +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::radarr::{ActiveRadarrBlock, COLLECTION_DETAILS_BLOCKS};
|
||||
use crate::app::App;
|
||||
use crate::models::radarr_models::CollectionMovie;
|
||||
@@ -102,8 +104,10 @@ pub fn draw_collection_details<B: Backend>(
|
||||
.current_selection()
|
||||
.clone()
|
||||
};
|
||||
let mut help_text =
|
||||
Text::from("<↑↓> scroll table | <enter> show overview/add movie | <esc> close");
|
||||
let mut help_text = Text::from(format!(
|
||||
"<↑↓> scroll table | {}",
|
||||
build_keymapping_string(&COLLECTION_DETAILS_KEY_MAPPINGS)
|
||||
));
|
||||
help_text.patch_style(style_help());
|
||||
let monitored = if collection_selection.monitored {
|
||||
"Yes"
|
||||
@@ -257,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("<esc> close");
|
||||
let mut help_text = Text::from(build_keymapping_string(&BARE_POPUP_KEY_MAPPINGS));
|
||||
help_text.patch_style(style_help());
|
||||
|
||||
let paragraph = Paragraph::new(overview)
|
||||
|
||||
@@ -4,6 +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::radarr::{ActiveRadarrBlock, ADD_MOVIE_BLOCKS};
|
||||
use crate::models::radarr_models::AddMovieSearchResult;
|
||||
use crate::models::Route;
|
||||
@@ -142,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("<esc> close");
|
||||
let mut help_text = Text::from(build_keymapping_string(&BARE_POPUP_KEY_MAPPINGS));
|
||||
help_text.patch_style(style_help());
|
||||
let help_paragraph = Paragraph::new(help_text)
|
||||
.block(borderless_block())
|
||||
@@ -161,7 +163,9 @@ 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("<enter> details | <esc> edit search");
|
||||
let mut help_text = Text::from(build_keymapping_string(
|
||||
&ADD_MOVIE_SEARCH_RESULTS_KEY_MAPPINGS,
|
||||
));
|
||||
help_text.patch_style(style_help());
|
||||
let help_paragraph = Paragraph::new(help_text)
|
||||
.block(borderless_block())
|
||||
|
||||
@@ -4,6 +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::radarr::{ActiveRadarrBlock, SYSTEM_DETAILS_BLOCKS};
|
||||
use crate::app::App;
|
||||
use crate::models::Route;
|
||||
@@ -84,7 +86,10 @@ fn draw_logs_popup<B: Backend>(f: &mut Frame<'_, B>, app: &mut App<'_>, area: Re
|
||||
title: "Log Details",
|
||||
is_loading: app.is_loading,
|
||||
is_popup: true,
|
||||
help: Some("<↑↓←→> scroll | <esc> close"),
|
||||
help: Some(format!(
|
||||
"<↑↓←→> scroll | {}",
|
||||
build_keymapping_string(&BARE_POPUP_KEY_MAPPINGS)
|
||||
)),
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -93,8 +98,11 @@ fn draw_tasks_popup<B: Backend>(f: &mut Frame<'_, B>, app: &mut App<'_>, area: R
|
||||
let tasks_popup_table = |f: &mut Frame<'_, B>, app: &mut App<'_>, area: Rect| {
|
||||
f.render_widget(title_block("Tasks"), area);
|
||||
|
||||
let context_area =
|
||||
draw_help_and_get_content_rect(f, area, Some("<enter> start task | <esc> close"));
|
||||
let context_area = draw_help_and_get_content_rect(
|
||||
f,
|
||||
area,
|
||||
Some(build_keymapping_string(&SYSTEM_TASKS_KEY_MAPPINGS)),
|
||||
);
|
||||
|
||||
draw_table(
|
||||
f,
|
||||
@@ -150,7 +158,14 @@ fn draw_start_task_prompt<B: Backend>(f: &mut Frame<'_, B>, app: &mut App<'_>, p
|
||||
fn draw_updates_popup<B: Backend>(f: &mut Frame<'_, B>, app: &mut App<'_>, area: Rect) {
|
||||
f.render_widget(title_block("Updates"), area);
|
||||
|
||||
let content_rect = draw_help_and_get_content_rect(f, area, Some("<↑↓> scroll | <esc> close"));
|
||||
let content_rect = draw_help_and_get_content_rect(
|
||||
f,
|
||||
area,
|
||||
Some(format!(
|
||||
"<↑↓> scroll | {}",
|
||||
build_keymapping_string(&BARE_POPUP_KEY_MAPPINGS)
|
||||
)),
|
||||
);
|
||||
let updates = app.data.radarr_data.updates.get_text();
|
||||
let block = borderless_block();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user