feat: Refactor all keybinding tips into a dynamically changing menu that can be invoked via '?' [#32]
This commit is contained in:
@@ -77,12 +77,6 @@ impl DrawUi for BlocklistUi {
|
||||
|
||||
fn draw_blocklist_table(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
if let Route::Sonarr(active_sonarr_block, _) = app.get_current_route() {
|
||||
let blocklist_table_footer = app
|
||||
.data
|
||||
.sonarr_data
|
||||
.main_tabs
|
||||
.get_active_tab_contextual_help();
|
||||
|
||||
let blocklist_row_mapping = |blocklist_item: &BlocklistItem| {
|
||||
let BlocklistItem {
|
||||
source_title,
|
||||
@@ -115,7 +109,6 @@ fn draw_blocklist_table(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
)
|
||||
.block(layout_block_top_border())
|
||||
.loading(app.is_loading)
|
||||
.footer(blocklist_table_footer)
|
||||
.sorting(active_sonarr_block == ActiveSonarrBlock::BlocklistSortPrompt)
|
||||
.headers([
|
||||
"Series Title",
|
||||
|
||||
@@ -72,11 +72,6 @@ fn draw_downloads(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
} else {
|
||||
app.data.sonarr_data.downloads.current_selection().clone()
|
||||
};
|
||||
let downloads_table_footer = app
|
||||
.data
|
||||
.sonarr_data
|
||||
.main_tabs
|
||||
.get_active_tab_contextual_help();
|
||||
|
||||
let downloads_row_mapping = |download_record: &DownloadRecord| {
|
||||
let DownloadRecord {
|
||||
@@ -130,7 +125,6 @@ fn draw_downloads(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
)
|
||||
.block(layout_block_top_border())
|
||||
.loading(app.is_loading)
|
||||
.footer(downloads_table_footer)
|
||||
.headers([
|
||||
"Title",
|
||||
"Percent Complete",
|
||||
|
||||
@@ -55,12 +55,6 @@ fn draw_history_table(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
app.data.sonarr_data.history.current_selection().clone()
|
||||
};
|
||||
if let Route::Sonarr(active_sonarr_block, _) = app.get_current_route() {
|
||||
let history_table_footer = app
|
||||
.data
|
||||
.sonarr_data
|
||||
.main_tabs
|
||||
.get_active_tab_contextual_help();
|
||||
|
||||
let history_row_mapping = |history_item: &SonarrHistoryItem| {
|
||||
let SonarrHistoryItem {
|
||||
source_title,
|
||||
@@ -96,7 +90,6 @@ fn draw_history_table(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
ManagarrTable::new(Some(&mut app.data.sonarr_data.history), history_row_mapping)
|
||||
.block(layout_block_top_border())
|
||||
.loading(app.is_loading)
|
||||
.footer(history_table_footer)
|
||||
.sorting(active_sonarr_block == ActiveSonarrBlock::HistorySortPrompt)
|
||||
.searching(active_sonarr_block == ActiveSonarrBlock::SearchHistory)
|
||||
.search_produced_empty_results(active_sonarr_block == ActiveSonarrBlock::SearchHistoryError)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
use std::sync::atomic::Ordering;
|
||||
|
||||
use crate::app::context_clues::{build_context_clue_string, CONFIRMATION_PROMPT_CONTEXT_CLUES};
|
||||
use crate::app::App;
|
||||
use crate::models::servarr_data::sonarr::sonarr_data::{ActiveSonarrBlock, EDIT_INDEXER_BLOCKS};
|
||||
use crate::models::Route;
|
||||
@@ -14,8 +13,6 @@ use crate::ui::widgets::loading_block::LoadingBlock;
|
||||
use crate::ui::widgets::popup::Size;
|
||||
use crate::ui::{draw_popup, DrawUi};
|
||||
use ratatui::layout::{Constraint, Flex, Layout, Rect};
|
||||
use ratatui::text::Text;
|
||||
use ratatui::widgets::Paragraph;
|
||||
use ratatui::Frame;
|
||||
|
||||
#[cfg(test)]
|
||||
@@ -45,22 +42,15 @@ fn draw_edit_indexer_prompt(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
let highlight_yes_no = selected_block == ActiveSonarrBlock::EditIndexerConfirmPrompt;
|
||||
let edit_indexer_modal_option = &app.data.sonarr_data.edit_indexer_modal;
|
||||
let protocol = &app.data.sonarr_data.indexers.current_selection().protocol;
|
||||
let help_text = Text::from(build_context_clue_string(&CONFIRMATION_PROMPT_CONTEXT_CLUES).help());
|
||||
let help_paragraph = Paragraph::new(help_text).centered();
|
||||
|
||||
if edit_indexer_modal_option.is_some() {
|
||||
f.render_widget(block, area);
|
||||
let edit_indexer_modal = edit_indexer_modal_option.as_ref().unwrap();
|
||||
|
||||
let [_, settings_area, _, buttons_area, help_area] = Layout::vertical([
|
||||
Constraint::Fill(1),
|
||||
Constraint::Length(18),
|
||||
Constraint::Fill(1),
|
||||
Constraint::Length(3),
|
||||
Constraint::Length(1),
|
||||
])
|
||||
.margin(1)
|
||||
.areas(area);
|
||||
let [settings_area, buttons_area] =
|
||||
Layout::vertical([Constraint::Fill(1), Constraint::Length(3)])
|
||||
.margin(1)
|
||||
.areas(area);
|
||||
let [left_side_area, right_side_area] =
|
||||
Layout::horizontal([Constraint::Ratio(1, 2), Constraint::Ratio(1, 2)])
|
||||
.margin(1)
|
||||
@@ -169,7 +159,6 @@ fn draw_edit_indexer_prompt(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
f.render_widget(interactive_search_checkbox, interactive_search_area);
|
||||
f.render_widget(save_button, save_area);
|
||||
f.render_widget(cancel_button, cancel_area);
|
||||
f.render_widget(help_paragraph, help_area);
|
||||
}
|
||||
} else {
|
||||
f.render_widget(LoadingBlock::new(app.is_loading, block), area);
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
use ratatui::layout::{Constraint, Flex, Layout, Rect};
|
||||
use ratatui::text::Text;
|
||||
use ratatui::widgets::Paragraph;
|
||||
use ratatui::Frame;
|
||||
|
||||
use crate::app::context_clues::{build_context_clue_string, CONFIRMATION_PROMPT_CONTEXT_CLUES};
|
||||
use crate::app::App;
|
||||
use crate::models::servarr_data::sonarr::sonarr_data::{
|
||||
ActiveSonarrBlock, INDEXER_SETTINGS_BLOCKS,
|
||||
@@ -44,14 +41,12 @@ fn draw_edit_indexer_settings_prompt(f: &mut Frame<'_>, app: &mut App<'_>, area:
|
||||
let selected_block = app.data.sonarr_data.selected_block.get_active_block();
|
||||
let highlight_yes_no = selected_block == ActiveSonarrBlock::IndexerSettingsConfirmPrompt;
|
||||
let indexer_settings_option = &app.data.sonarr_data.indexer_settings;
|
||||
let help_text = Text::from(build_context_clue_string(&CONFIRMATION_PROMPT_CONTEXT_CLUES).help());
|
||||
let help_paragraph = Paragraph::new(help_text).centered();
|
||||
|
||||
if indexer_settings_option.is_some() {
|
||||
f.render_widget(block, area);
|
||||
let indexer_settings = indexer_settings_option.as_ref().unwrap();
|
||||
|
||||
let [_, min_age_area, retention_area, max_size_area, rss_sync_area, _, buttons_area, help_area] =
|
||||
let [_, min_age_area, retention_area, max_size_area, rss_sync_area, _, buttons_area] =
|
||||
Layout::vertical([
|
||||
Constraint::Fill(1),
|
||||
Constraint::Length(3),
|
||||
@@ -60,7 +55,6 @@ fn draw_edit_indexer_settings_prompt(f: &mut Frame<'_>, app: &mut App<'_>, area:
|
||||
Constraint::Length(3),
|
||||
Constraint::Fill(1),
|
||||
Constraint::Length(3),
|
||||
Constraint::Length(1),
|
||||
])
|
||||
.margin(1)
|
||||
.areas(area);
|
||||
@@ -112,7 +106,6 @@ fn draw_edit_indexer_settings_prompt(f: &mut Frame<'_>, app: &mut App<'_>, area:
|
||||
|
||||
f.render_widget(save_button, save_area);
|
||||
f.render_widget(cancel_button, cancel_area);
|
||||
f.render_widget(help_paragraph, help_area);
|
||||
} else {
|
||||
f.render_widget(LoadingBlock::new(app.is_loading, block), area);
|
||||
}
|
||||
|
||||
@@ -157,17 +157,11 @@ fn draw_indexers(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
])
|
||||
.primary()
|
||||
};
|
||||
let indexers_table_footer = app
|
||||
.data
|
||||
.sonarr_data
|
||||
.main_tabs
|
||||
.get_active_tab_contextual_help();
|
||||
let indexers_table = ManagarrTable::new(
|
||||
Some(&mut app.data.sonarr_data.indexers),
|
||||
indexers_row_mapping,
|
||||
)
|
||||
.block(layout_block_top_border())
|
||||
.footer(indexers_table_footer)
|
||||
.loading(app.is_loading)
|
||||
.headers([
|
||||
"Indexer",
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
use crate::app::context_clues::{build_context_clue_string, BARE_POPUP_CONTEXT_CLUES};
|
||||
use crate::app::App;
|
||||
use crate::models::servarr_data::modals::IndexerTestResultModalItem;
|
||||
use crate::models::servarr_data::sonarr::sonarr_data::ActiveSonarrBlock;
|
||||
@@ -41,10 +40,6 @@ fn draw_test_all_indexers_test_results(f: &mut Frame<'_>, app: &mut App<'_>, are
|
||||
IndexerTestResultModalItem::default()
|
||||
};
|
||||
f.render_widget(title_block("Test All Indexers"), area);
|
||||
let help_footer = format!(
|
||||
"<↑↓> scroll | {}",
|
||||
build_context_clue_string(&BARE_POPUP_CONTEXT_CLUES)
|
||||
);
|
||||
let test_results_row_mapping = |result: &IndexerTestResultModalItem| {
|
||||
result.validation_failures.scroll_left_or_reset(
|
||||
get_width_from_percentage(area, 86),
|
||||
@@ -70,7 +65,6 @@ fn draw_test_all_indexers_test_results(f: &mut Frame<'_>, app: &mut App<'_>, are
|
||||
test_results_row_mapping,
|
||||
)
|
||||
.loading(is_loading)
|
||||
.footer(Some(help_footer))
|
||||
.footer_alignment(Alignment::Center)
|
||||
.margin(1)
|
||||
.headers(["Indexer", "Pass/Fail", "Failure Messages"])
|
||||
|
||||
@@ -1,22 +1,16 @@
|
||||
use std::sync::atomic::Ordering;
|
||||
|
||||
use ratatui::layout::{Constraint, Layout, Rect};
|
||||
use ratatui::text::Text;
|
||||
use ratatui::widgets::{Cell, ListItem, Paragraph, Row};
|
||||
use ratatui::widgets::{Cell, ListItem, Row};
|
||||
use ratatui::Frame;
|
||||
|
||||
use crate::app::context_clues::{
|
||||
build_context_clue_string, BARE_POPUP_CONTEXT_CLUES, CONFIRMATION_PROMPT_CONTEXT_CLUES,
|
||||
};
|
||||
use crate::app::sonarr::sonarr_context_clues::ADD_SERIES_SEARCH_RESULTS_CONTEXT_CLUES;
|
||||
use crate::models::servarr_data::sonarr::modals::AddSeriesModal;
|
||||
use crate::models::servarr_data::sonarr::sonarr_data::{ActiveSonarrBlock, ADD_SERIES_BLOCKS};
|
||||
use crate::models::sonarr_models::AddSeriesSearchResult;
|
||||
use crate::models::Route;
|
||||
use crate::ui::styles::ManagarrStyle;
|
||||
use crate::ui::utils::{
|
||||
borderless_block, get_width_from_percentage, layout_block, layout_paragraph_borderless,
|
||||
title_block_centered,
|
||||
get_width_from_percentage, layout_block, layout_paragraph_borderless, title_block_centered,
|
||||
};
|
||||
use crate::ui::widgets::button::Button;
|
||||
use crate::ui::widgets::checkbox::Checkbox;
|
||||
@@ -78,13 +72,10 @@ fn draw_add_series_search(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
AddSeriesSearchResult::default()
|
||||
};
|
||||
|
||||
let [search_box_area, results_area, help_area] = Layout::vertical([
|
||||
Constraint::Length(3),
|
||||
Constraint::Fill(0),
|
||||
Constraint::Length(3),
|
||||
])
|
||||
.margin(1)
|
||||
.areas(area);
|
||||
let [search_box_area, results_area] =
|
||||
Layout::vertical([Constraint::Length(3), Constraint::Fill(0)])
|
||||
.margin(1)
|
||||
.areas(area);
|
||||
let block_content = &app
|
||||
.data
|
||||
.sonarr_data
|
||||
@@ -150,27 +141,17 @@ fn draw_add_series_search(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
let search_box = InputBox::new(block_content)
|
||||
.offset(offset)
|
||||
.block(title_block_centered("Add Series"));
|
||||
let help_text = Text::from(build_context_clue_string(&BARE_POPUP_CONTEXT_CLUES).help());
|
||||
let help_paragraph = Paragraph::new(help_text)
|
||||
.block(borderless_block())
|
||||
.centered();
|
||||
|
||||
search_box.show_cursor(f, search_box_area);
|
||||
f.render_widget(layout_block().default(), results_area);
|
||||
f.render_widget(search_box, search_box_area);
|
||||
f.render_widget(help_paragraph, help_area);
|
||||
}
|
||||
ActiveSonarrBlock::AddSeriesEmptySearchResults => {
|
||||
let help_text = Text::from(build_context_clue_string(&BARE_POPUP_CONTEXT_CLUES).help());
|
||||
let help_paragraph = Paragraph::new(help_text)
|
||||
.block(borderless_block())
|
||||
.centered();
|
||||
let error_message = Message::new("No series found matching your query!");
|
||||
let error_message_popup = Popup::new(error_message).size(Size::Message);
|
||||
|
||||
f.render_widget(layout_block().default(), results_area);
|
||||
f.render_widget(error_message_popup, f.area());
|
||||
f.render_widget(help_paragraph, help_area);
|
||||
}
|
||||
ActiveSonarrBlock::AddSeriesSearchResults
|
||||
| ActiveSonarrBlock::AddSeriesPrompt
|
||||
@@ -181,11 +162,6 @@ fn draw_add_series_search(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
| ActiveSonarrBlock::AddSeriesSelectRootFolder
|
||||
| ActiveSonarrBlock::AddSeriesAlreadyInLibrary
|
||||
| ActiveSonarrBlock::AddSeriesTagsInput => {
|
||||
let help_text =
|
||||
Text::from(build_context_clue_string(&ADD_SERIES_SEARCH_RESULTS_CONTEXT_CLUES).help());
|
||||
let help_paragraph = Paragraph::new(help_text)
|
||||
.block(borderless_block())
|
||||
.centered();
|
||||
let search_results_table = ManagarrTable::new(
|
||||
app.data.sonarr_data.add_searched_series.as_mut(),
|
||||
search_results_row_mapping,
|
||||
@@ -206,7 +182,6 @@ fn draw_add_series_search(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
]);
|
||||
|
||||
f.render_widget(search_results_table, results_area);
|
||||
f.render_widget(help_paragraph, help_area);
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
@@ -297,7 +272,7 @@ fn draw_confirmation_prompt(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
|
||||
f.render_widget(title_block_centered(&title), area);
|
||||
|
||||
let [paragraph_area, root_folder_area, monitor_area, quality_profile_area, language_profile_area, series_type_area, season_folder_area, tags_area, _, buttons_area, help_area] =
|
||||
let [paragraph_area, root_folder_area, monitor_area, quality_profile_area, language_profile_area, series_type_area, season_folder_area, tags_area, _, buttons_area] =
|
||||
Layout::vertical([
|
||||
Constraint::Length(6),
|
||||
Constraint::Length(3),
|
||||
@@ -309,16 +284,12 @@ fn draw_confirmation_prompt(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
Constraint::Length(3),
|
||||
Constraint::Fill(1),
|
||||
Constraint::Length(3),
|
||||
Constraint::Length(1),
|
||||
])
|
||||
.margin(1)
|
||||
.areas(area);
|
||||
|
||||
let prompt_paragraph = layout_paragraph_borderless(&prompt);
|
||||
let help_text = Text::from(build_context_clue_string(&CONFIRMATION_PROMPT_CONTEXT_CLUES).help());
|
||||
let help_paragraph = Paragraph::new(help_text).centered();
|
||||
f.render_widget(prompt_paragraph, paragraph_area);
|
||||
f.render_widget(help_paragraph, help_area);
|
||||
|
||||
let [add_area, cancel_area] =
|
||||
Layout::horizontal([Constraint::Percentage(50), Constraint::Percentage(50)])
|
||||
|
||||
@@ -2,11 +2,9 @@ use std::sync::atomic::Ordering;
|
||||
|
||||
use ratatui::layout::{Constraint, Rect};
|
||||
use ratatui::prelude::Layout;
|
||||
use ratatui::text::Text;
|
||||
use ratatui::widgets::{ListItem, Paragraph};
|
||||
use ratatui::widgets::ListItem;
|
||||
use ratatui::Frame;
|
||||
|
||||
use crate::app::context_clues::{build_context_clue_string, CONFIRMATION_PROMPT_CONTEXT_CLUES};
|
||||
use crate::app::App;
|
||||
use crate::models::servarr_data::sonarr::modals::EditSeriesModal;
|
||||
use crate::models::servarr_data::sonarr::sonarr_data::{
|
||||
@@ -107,7 +105,7 @@ fn draw_edit_series_confirmation_prompt(f: &mut Frame<'_>, app: &mut App<'_>, ar
|
||||
let selected_quality_profile = quality_profile_list.current_selection();
|
||||
let selected_language_profile = language_profile_list.current_selection();
|
||||
|
||||
let [paragraph_area, monitored_area, season_folder_area, quality_profile_area, language_profile_area, series_type_area, path_area, tags_area, _, buttons_area, help_area] =
|
||||
let [paragraph_area, monitored_area, season_folder_area, quality_profile_area, language_profile_area, series_type_area, path_area, tags_area, _, buttons_area] =
|
||||
Layout::vertical([
|
||||
Constraint::Length(6),
|
||||
Constraint::Length(3),
|
||||
@@ -119,7 +117,6 @@ fn draw_edit_series_confirmation_prompt(f: &mut Frame<'_>, app: &mut App<'_>, ar
|
||||
Constraint::Length(3),
|
||||
Constraint::Fill(1),
|
||||
Constraint::Length(3),
|
||||
Constraint::Length(1),
|
||||
])
|
||||
.margin(1)
|
||||
.areas(area);
|
||||
@@ -127,8 +124,6 @@ fn draw_edit_series_confirmation_prompt(f: &mut Frame<'_>, app: &mut App<'_>, ar
|
||||
Layout::horizontal([Constraint::Percentage(50), Constraint::Percentage(50)])
|
||||
.areas(buttons_area);
|
||||
|
||||
let help_text = Text::from(build_context_clue_string(&CONFIRMATION_PROMPT_CONTEXT_CLUES).help());
|
||||
let help_paragraph = Paragraph::new(help_text).centered();
|
||||
let prompt_paragraph = layout_paragraph_borderless(&series_overview);
|
||||
let monitored_checkbox = Checkbox::new("Monitored")
|
||||
.checked(monitored.unwrap_or_default())
|
||||
@@ -189,7 +184,6 @@ fn draw_edit_series_confirmation_prompt(f: &mut Frame<'_>, app: &mut App<'_>, ar
|
||||
f.render_widget(series_type_drop_down_button, series_type_area);
|
||||
f.render_widget(save_button, save_area);
|
||||
f.render_widget(cancel_button, cancel_area);
|
||||
f.render_widget(help_paragraph, help_area);
|
||||
}
|
||||
|
||||
fn draw_edit_series_select_series_type_popup(f: &mut Frame<'_>, app: &mut App<'_>) {
|
||||
|
||||
@@ -257,9 +257,6 @@ fn draw_episode_history_table(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect)
|
||||
.current_selection()
|
||||
.clone()
|
||||
};
|
||||
let episode_history_table_footer = episode_details_modal
|
||||
.episode_details_tabs
|
||||
.get_active_tab_contextual_help();
|
||||
|
||||
let history_row_mapping = |history_item: &SonarrHistoryItem| {
|
||||
let SonarrHistoryItem {
|
||||
@@ -306,7 +303,6 @@ fn draw_episode_history_table(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect)
|
||||
ManagarrTable::new(Some(&mut episode_history_table), history_row_mapping)
|
||||
.block(layout_block_top_border())
|
||||
.loading(app.is_loading)
|
||||
.footer(episode_history_table_footer)
|
||||
.headers(["Source Title", "Event Type", "Language", "Quality", "Date"])
|
||||
.constraints([
|
||||
Constraint::Percentage(40),
|
||||
@@ -397,9 +393,6 @@ fn draw_episode_releases(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
episode_details_modal.episode_releases.is_empty(),
|
||||
)
|
||||
};
|
||||
let episode_release_table_footer = episode_details_modal
|
||||
.episode_details_tabs
|
||||
.get_active_tab_contextual_help();
|
||||
|
||||
if let Route::Sonarr(active_sonarr_block, _) = app.get_current_route() {
|
||||
let episode_release_row_mapping = |release: &SonarrRelease| {
|
||||
@@ -483,7 +476,6 @@ fn draw_episode_releases(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
)
|
||||
.block(layout_block_top_border())
|
||||
.loading(app.is_loading || is_empty)
|
||||
.footer(episode_release_table_footer)
|
||||
.sorting(active_sonarr_block == ActiveSonarrBlock::ManualEpisodeSearchSortPrompt)
|
||||
.headers([
|
||||
"Source", "Age", "⛔", "Title", "Indexer", "Size", "Peers", "Language", "Quality",
|
||||
|
||||
@@ -90,11 +90,6 @@ fn draw_library(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
let language_profile_map = &app.data.sonarr_data.language_profiles_map;
|
||||
let tags_map = &app.data.sonarr_data.tags_map;
|
||||
let content = Some(&mut app.data.sonarr_data.series);
|
||||
let help_footer = app
|
||||
.data
|
||||
.sonarr_data
|
||||
.main_tabs
|
||||
.get_active_tab_contextual_help();
|
||||
|
||||
let series_table_row_mapping = |series: &Series| {
|
||||
series.title.scroll_left_or_reset(
|
||||
@@ -154,7 +149,6 @@ fn draw_library(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
let series_table = ManagarrTable::new(content, series_table_row_mapping)
|
||||
.block(layout_block_top_border())
|
||||
.loading(app.is_loading)
|
||||
.footer(help_footer)
|
||||
.sorting(active_sonarr_block == ActiveSonarrBlock::SeriesSortPrompt)
|
||||
.searching(active_sonarr_block == ActiveSonarrBlock::SearchSeries)
|
||||
.filtering(active_sonarr_block == ActiveSonarrBlock::FilterSeries)
|
||||
|
||||
@@ -149,14 +149,6 @@ pub fn draw_season_details(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
|
||||
fn draw_episodes_table(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
if let Route::Sonarr(active_sonarr_block, _) = app.get_current_route() {
|
||||
let help_footer = app
|
||||
.data
|
||||
.sonarr_data
|
||||
.season_details_modal
|
||||
.as_ref()
|
||||
.expect("Season details modal is unpopulated")
|
||||
.season_details_tabs
|
||||
.get_active_tab_contextual_help();
|
||||
let episode_files = app
|
||||
.data
|
||||
.sonarr_data
|
||||
@@ -222,7 +214,6 @@ fn draw_episodes_table(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
let season_table = ManagarrTable::new(content, episode_row_mapping)
|
||||
.block(layout_block_top_border())
|
||||
.loading(app.is_loading)
|
||||
.footer(help_footer)
|
||||
.searching(is_searching)
|
||||
.search_produced_empty_results(active_sonarr_block == ActiveSonarrBlock::SearchEpisodesError)
|
||||
.headers([
|
||||
@@ -261,9 +252,6 @@ fn draw_season_history_table(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
.current_selection()
|
||||
.clone()
|
||||
};
|
||||
let season_history_table_footer = season_details_modal
|
||||
.season_details_tabs
|
||||
.get_active_tab_contextual_help();
|
||||
|
||||
if let Route::Sonarr(active_sonarr_block, _) = app.get_current_route() {
|
||||
let history_row_mapping = |history_item: &SonarrHistoryItem| {
|
||||
@@ -308,7 +296,6 @@ fn draw_season_history_table(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
ManagarrTable::new(Some(&mut season_history_table), history_row_mapping)
|
||||
.block(layout_block_top_border())
|
||||
.loading(app.is_loading)
|
||||
.footer(season_history_table_footer)
|
||||
.sorting(active_sonarr_block == ActiveSonarrBlock::SeasonHistorySortPrompt)
|
||||
.searching(active_sonarr_block == ActiveSonarrBlock::SearchSeasonHistory)
|
||||
.search_produced_empty_results(
|
||||
@@ -363,9 +350,6 @@ fn draw_season_releases(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
season_details_modal.season_releases.is_empty(),
|
||||
)
|
||||
};
|
||||
let season_release_table_footer = season_details_modal
|
||||
.season_details_tabs
|
||||
.get_active_tab_contextual_help();
|
||||
|
||||
if let Route::Sonarr(active_sonarr_block, _) = app.get_current_route() {
|
||||
let season_release_row_mapping = |release: &SonarrRelease| {
|
||||
@@ -444,7 +428,6 @@ fn draw_season_releases(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
ManagarrTable::new(Some(&mut season_release_table), season_release_row_mapping)
|
||||
.block(layout_block_top_border())
|
||||
.loading(app.is_loading || is_empty)
|
||||
.footer(season_release_table_footer)
|
||||
.sorting(active_sonarr_block == ActiveSonarrBlock::ManualSeasonSearchSortPrompt)
|
||||
.headers([
|
||||
"Source", "Age", "⛔", "Title", "Indexer", "Size", "Peers", "Language", "Quality",
|
||||
|
||||
@@ -229,11 +229,6 @@ pub fn draw_series_details(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
fn draw_seasons_table(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
if let Route::Sonarr(active_sonarr_block, _) = app.get_current_route() {
|
||||
let content = Some(&mut app.data.sonarr_data.seasons);
|
||||
let help_footer = app
|
||||
.data
|
||||
.sonarr_data
|
||||
.series_info_tabs
|
||||
.get_active_tab_contextual_help();
|
||||
let season_row_mapping = |season: &Season| {
|
||||
let Season {
|
||||
title,
|
||||
@@ -279,7 +274,6 @@ fn draw_seasons_table(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
let season_table = ManagarrTable::new(content, season_row_mapping)
|
||||
.block(layout_block_top_border())
|
||||
.loading(app.is_loading)
|
||||
.footer(help_footer)
|
||||
.searching(is_searching)
|
||||
.search_produced_empty_results(active_sonarr_block == ActiveSonarrBlock::SearchSeasonError)
|
||||
.headers(["Monitored", "Season", "Episode Count", "Size on Disk"])
|
||||
@@ -306,11 +300,6 @@ fn draw_series_history_table(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
} else {
|
||||
series_history.current_selection().clone()
|
||||
};
|
||||
let series_history_table_footer = app
|
||||
.data
|
||||
.sonarr_data
|
||||
.series_info_tabs
|
||||
.get_active_tab_contextual_help();
|
||||
|
||||
if let Route::Sonarr(active_sonarr_block, _) = app.get_current_route() {
|
||||
let history_row_mapping = |history_item: &SonarrHistoryItem| {
|
||||
@@ -349,7 +338,6 @@ fn draw_series_history_table(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
ManagarrTable::new(Some(&mut series_history_table), history_row_mapping)
|
||||
.block(layout_block_top_border())
|
||||
.loading(app.is_loading)
|
||||
.footer(series_history_table_footer)
|
||||
.sorting(active_sonarr_block == ActiveSonarrBlock::SeriesHistorySortPrompt)
|
||||
.searching(active_sonarr_block == ActiveSonarrBlock::SearchSeriesHistory)
|
||||
.search_produced_empty_results(
|
||||
|
||||
@@ -59,11 +59,6 @@ impl DrawUi for RootFoldersUi {
|
||||
}
|
||||
|
||||
fn draw_root_folders(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
let help_footer = app
|
||||
.data
|
||||
.sonarr_data
|
||||
.main_tabs
|
||||
.get_active_tab_contextual_help();
|
||||
let root_folders_row_mapping = |root_folders: &RootFolder| {
|
||||
let RootFolder {
|
||||
path,
|
||||
@@ -94,7 +89,6 @@ fn draw_root_folders(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
)
|
||||
.block(layout_block_top_border())
|
||||
.loading(app.is_loading)
|
||||
.footer(help_footer)
|
||||
.headers(["Path", "Free Space", "Unmapped Folders"])
|
||||
.constraints([
|
||||
Constraint::Ratio(3, 5),
|
||||
|
||||
@@ -4,7 +4,7 @@ use chrono::Utc;
|
||||
use ratatui::layout::Layout;
|
||||
use ratatui::style::Style;
|
||||
use ratatui::text::{Span, Text};
|
||||
use ratatui::widgets::{Cell, Paragraph, Row};
|
||||
use ratatui::widgets::{Cell, Row};
|
||||
use ratatui::{
|
||||
layout::{Constraint, Rect},
|
||||
widgets::ListItem,
|
||||
@@ -17,9 +17,7 @@ use crate::models::servarr_models::QueueEvent;
|
||||
use crate::models::sonarr_models::SonarrTask;
|
||||
use crate::ui::sonarr_ui::system::system_details_ui::SystemDetailsUi;
|
||||
use crate::ui::styles::ManagarrStyle;
|
||||
use crate::ui::utils::{
|
||||
convert_to_minutes_hours_days, layout_block_top_border, style_log_list_item,
|
||||
};
|
||||
use crate::ui::utils::{convert_to_minutes_hours_days, style_log_list_item};
|
||||
use crate::ui::widgets::loading_block::LoadingBlock;
|
||||
use crate::ui::widgets::managarr_table::ManagarrTable;
|
||||
use crate::ui::widgets::selectable_list::SelectableList;
|
||||
@@ -66,12 +64,8 @@ impl DrawUi for SystemUi {
|
||||
}
|
||||
|
||||
fn draw_system_ui_layout(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
let [activities_area, logs_area, help_area] = Layout::vertical([
|
||||
Constraint::Ratio(1, 2),
|
||||
Constraint::Ratio(1, 2),
|
||||
Constraint::Min(2),
|
||||
])
|
||||
.areas(area);
|
||||
let [activities_area, logs_area] =
|
||||
Layout::vertical([Constraint::Ratio(1, 2), Constraint::Ratio(1, 2)]).areas(area);
|
||||
|
||||
let [tasks_area, events_area] =
|
||||
Layout::horizontal([Constraint::Ratio(1, 2), Constraint::Ratio(1, 2)]).areas(activities_area);
|
||||
@@ -79,7 +73,6 @@ fn draw_system_ui_layout(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
draw_tasks(f, app, tasks_area);
|
||||
draw_queued_events(f, app, events_area);
|
||||
draw_logs(f, app, logs_area);
|
||||
draw_help(f, app, help_area);
|
||||
}
|
||||
|
||||
fn draw_tasks(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
@@ -181,26 +174,6 @@ fn draw_logs(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
f.render_widget(logs_box, area);
|
||||
}
|
||||
|
||||
fn draw_help(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
let help_text = Text::from(
|
||||
format!(
|
||||
" {}",
|
||||
app
|
||||
.data
|
||||
.sonarr_data
|
||||
.main_tabs
|
||||
.get_active_tab_contextual_help()
|
||||
.unwrap()
|
||||
)
|
||||
.help(),
|
||||
);
|
||||
let help_paragraph = Paragraph::new(help_text)
|
||||
.block(layout_block_top_border())
|
||||
.left_aligned();
|
||||
|
||||
f.render_widget(help_paragraph, area);
|
||||
}
|
||||
|
||||
pub(super) struct TaskProps {
|
||||
pub(super) name: String,
|
||||
pub(super) interval: String,
|
||||
|
||||
@@ -3,8 +3,6 @@ use ratatui::text::{Span, Text};
|
||||
use ratatui::widgets::{Cell, ListItem, Paragraph, Row};
|
||||
use ratatui::Frame;
|
||||
|
||||
use crate::app::context_clues::{build_context_clue_string, BARE_POPUP_CONTEXT_CLUES};
|
||||
use crate::app::sonarr::sonarr_context_clues::SYSTEM_TASKS_CONTEXT_CLUES;
|
||||
use crate::app::App;
|
||||
use crate::models::servarr_data::sonarr::sonarr_data::{ActiveSonarrBlock, SYSTEM_DETAILS_BLOCKS};
|
||||
use crate::models::sonarr_models::SonarrTask;
|
||||
@@ -59,17 +57,10 @@ impl DrawUi for SystemDetailsUi {
|
||||
|
||||
fn draw_logs_popup(f: &mut Frame<'_>, app: &mut App<'_>) {
|
||||
let block = title_block("Log Details");
|
||||
let help_footer = format!(
|
||||
"<↑↓←→> scroll | {}",
|
||||
build_context_clue_string(&BARE_POPUP_CONTEXT_CLUES)
|
||||
);
|
||||
|
||||
if app.data.sonarr_data.log_details.items.is_empty() {
|
||||
let loading = LoadingBlock::new(app.is_loading, borderless_block());
|
||||
let popup = Popup::new(loading)
|
||||
.size(Size::Large)
|
||||
.block(block)
|
||||
.footer(&help_footer);
|
||||
let popup = Popup::new(loading).size(Size::Large).block(block);
|
||||
|
||||
f.render_widget(popup, f.area());
|
||||
return;
|
||||
@@ -82,16 +73,12 @@ fn draw_logs_popup(f: &mut Frame<'_>, app: &mut App<'_>) {
|
||||
style_log_list_item(ListItem::new(Text::from(Span::raw(log_line))), level)
|
||||
})
|
||||
.block(borderless_block());
|
||||
let popup = Popup::new(logs_list)
|
||||
.size(Size::Large)
|
||||
.block(block)
|
||||
.footer(&help_footer);
|
||||
let popup = Popup::new(logs_list).size(Size::Large).block(block);
|
||||
|
||||
f.render_widget(popup, f.area());
|
||||
}
|
||||
|
||||
fn draw_tasks_popup(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
let help_footer = Some(build_context_clue_string(&SYSTEM_TASKS_CONTEXT_CLUES));
|
||||
let tasks_row_mapping = |task: &SonarrTask| {
|
||||
let task_props = extract_task_props(task);
|
||||
|
||||
@@ -106,7 +93,6 @@ fn draw_tasks_popup(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
let tasks_table = ManagarrTable::new(Some(&mut app.data.sonarr_data.tasks), tasks_row_mapping)
|
||||
.loading(app.is_loading)
|
||||
.margin(1)
|
||||
.footer(help_footer)
|
||||
.footer_alignment(Alignment::Center)
|
||||
.headers(TASK_TABLE_HEADERS)
|
||||
.constraints(TASK_TABLE_CONSTRAINTS);
|
||||
@@ -135,10 +121,6 @@ fn draw_tasks_popup(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
}
|
||||
|
||||
fn draw_updates_popup(f: &mut Frame<'_>, app: &mut App<'_>) {
|
||||
let help_footer = format!(
|
||||
"<↑↓> scroll | {}",
|
||||
build_context_clue_string(&BARE_POPUP_CONTEXT_CLUES)
|
||||
);
|
||||
let updates = app.data.sonarr_data.updates.get_text();
|
||||
let block = title_block("Updates");
|
||||
|
||||
@@ -146,18 +128,12 @@ fn draw_updates_popup(f: &mut Frame<'_>, app: &mut App<'_>) {
|
||||
let updates_paragraph = Paragraph::new(Text::from(updates))
|
||||
.block(borderless_block())
|
||||
.scroll((app.data.sonarr_data.updates.offset, 0));
|
||||
let popup = Popup::new(updates_paragraph)
|
||||
.size(Size::Large)
|
||||
.block(block)
|
||||
.footer(&help_footer);
|
||||
let popup = Popup::new(updates_paragraph).size(Size::Large).block(block);
|
||||
|
||||
f.render_widget(popup, f.area());
|
||||
} else {
|
||||
let loading = LoadingBlock::new(app.is_loading, borderless_block());
|
||||
let popup = Popup::new(loading)
|
||||
.size(Size::Large)
|
||||
.block(block)
|
||||
.footer(&help_footer);
|
||||
let popup = Popup::new(loading).size(Size::Large).block(block);
|
||||
|
||||
f.render_widget(popup, f.area());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user