feat: Refactor all keybinding tips into a dynamically changing menu that can be invoked via '?' [#32]
This commit is contained in:
+37
-9
@@ -4,15 +4,16 @@ use std::sync::atomic::Ordering;
|
||||
use ratatui::layout::{Constraint, Flex, Layout, Rect};
|
||||
use ratatui::style::{Style, Stylize};
|
||||
use ratatui::text::{Line, Text};
|
||||
use ratatui::widgets::Clear;
|
||||
use ratatui::widgets::Paragraph;
|
||||
use ratatui::widgets::Tabs;
|
||||
use ratatui::widgets::Wrap;
|
||||
use ratatui::widgets::{Clear, Row};
|
||||
use ratatui::Frame;
|
||||
use sonarr_ui::SonarrUi;
|
||||
use utils::layout_block;
|
||||
|
||||
use crate::app::App;
|
||||
use crate::models::servarr_models::KeybindingItem;
|
||||
use crate::models::{HorizontallyScrollableText, Route, TabState};
|
||||
use crate::ui::radarr_ui::RadarrUi;
|
||||
use crate::ui::styles::ManagarrStyle;
|
||||
@@ -22,6 +23,7 @@ use crate::ui::utils::{
|
||||
unstyled_title_block,
|
||||
};
|
||||
use crate::ui::widgets::input_box::InputBox;
|
||||
use crate::ui::widgets::managarr_table::ManagarrTable;
|
||||
use crate::ui::widgets::popup::Size;
|
||||
|
||||
mod builtin_themes;
|
||||
@@ -79,6 +81,10 @@ pub fn ui(f: &mut Frame<'_>, app: &mut App<'_>) {
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
|
||||
if app.keymapping_table.is_some() {
|
||||
draw_help_popup(f, app);
|
||||
}
|
||||
}
|
||||
|
||||
fn draw_header_row(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
@@ -88,7 +94,7 @@ fn draw_header_row(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
.flex(Flex::SpaceBetween)
|
||||
.margin(1)
|
||||
.areas(area);
|
||||
let help_text = Text::from(app.server_tabs.get_active_tab_help().help());
|
||||
let help_text = Text::from("<?> to open help".help());
|
||||
|
||||
let titles = app
|
||||
.server_tabs
|
||||
@@ -138,6 +144,34 @@ pub fn draw_popup(
|
||||
popup_fn(f, app, popup_area);
|
||||
}
|
||||
|
||||
pub fn draw_help_popup(f: &mut Frame<'_>, app: &mut App<'_>) {
|
||||
let (percent_x, percent_y) = Size::LongNarrowTable.to_percent();
|
||||
let table_area = centered_rect(percent_x, percent_y, f.area());
|
||||
let keymap_row_mapping = |keymap: &KeybindingItem| {
|
||||
Row::new(vec![
|
||||
ratatui::widgets::Cell::from(keymap.key.clone()),
|
||||
ratatui::widgets::Cell::from(keymap.alt_key.clone()),
|
||||
ratatui::widgets::Cell::from(keymap.desc.clone()),
|
||||
])
|
||||
.primary()
|
||||
};
|
||||
let keymapping_table = ManagarrTable::new(
|
||||
Some(app.keymapping_table.as_mut().unwrap()),
|
||||
keymap_row_mapping,
|
||||
)
|
||||
.block(title_block("Keybindings"))
|
||||
.loading(app.is_loading)
|
||||
.headers(["Key", "Alt Key", "Description"])
|
||||
.constraints([
|
||||
Constraint::Ratio(1, 3),
|
||||
Constraint::Ratio(1, 3),
|
||||
Constraint::Ratio(1, 3),
|
||||
]);
|
||||
f.render_widget(Clear, table_area);
|
||||
f.render_widget(background_block(), table_area);
|
||||
f.render_widget(keymapping_table, table_area);
|
||||
}
|
||||
|
||||
fn draw_tabs(f: &mut Frame<'_>, area: Rect, title: &str, tab_state: &TabState) -> Rect {
|
||||
if title.is_empty() {
|
||||
f.render_widget(layout_block().default(), area);
|
||||
@@ -148,8 +182,6 @@ fn draw_tabs(f: &mut Frame<'_>, area: Rect, title: &str, tab_state: &TabState) -
|
||||
let [header_area, content_area] = Layout::vertical([Constraint::Length(1), Constraint::Fill(0)])
|
||||
.margin(1)
|
||||
.areas(area);
|
||||
let [tabs_area, help_area] =
|
||||
Layout::horizontal([Constraint::Percentage(45), Constraint::Fill(0)]).areas(header_area);
|
||||
|
||||
let titles = tab_state
|
||||
.tabs
|
||||
@@ -159,12 +191,8 @@ fn draw_tabs(f: &mut Frame<'_>, area: Rect, title: &str, tab_state: &TabState) -
|
||||
.block(borderless_block())
|
||||
.highlight_style(Style::new().secondary())
|
||||
.select(tab_state.index);
|
||||
let help = Paragraph::new(Text::from(tab_state.get_active_tab_help().help()))
|
||||
.block(borderless_block())
|
||||
.right_aligned();
|
||||
|
||||
f.render_widget(tabs, tabs_area);
|
||||
f.render_widget(help, help_area);
|
||||
f.render_widget(tabs, header_area);
|
||||
|
||||
content_area
|
||||
}
|
||||
|
||||
@@ -82,11 +82,6 @@ fn draw_blocklist_table(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
} else {
|
||||
app.data.radarr_data.blocklist.current_selection().clone()
|
||||
};
|
||||
let blocklist_table_footer = app
|
||||
.data
|
||||
.radarr_data
|
||||
.main_tabs
|
||||
.get_active_tab_contextual_help();
|
||||
|
||||
let blocklist_row_mapping = |blocklist_item: &BlocklistItem| {
|
||||
let BlocklistItem {
|
||||
@@ -136,7 +131,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_radarr_block == ActiveRadarrBlock::BlocklistSortPrompt)
|
||||
.headers([
|
||||
"Movie Title",
|
||||
|
||||
@@ -4,8 +4,6 @@ use ratatui::text::{Line, Text};
|
||||
use ratatui::widgets::{Cell, Paragraph, Row, Wrap};
|
||||
use ratatui::Frame;
|
||||
|
||||
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::App;
|
||||
use crate::models::radarr_models::CollectionMovie;
|
||||
use crate::models::servarr_data::radarr::radarr_data::{
|
||||
@@ -144,10 +142,6 @@ pub fn draw_collection_details(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect)
|
||||
"No"
|
||||
};
|
||||
let minimum_availability = collection_selection.minimum_availability.to_display_str();
|
||||
let help_footer = format!(
|
||||
"<↑↓> scroll table | {}",
|
||||
build_context_clue_string(&COLLECTION_DETAILS_CONTEXT_CLUES)
|
||||
);
|
||||
|
||||
let collection_description = Text::from(vec![
|
||||
Line::from(vec![
|
||||
@@ -191,7 +185,6 @@ pub fn draw_collection_details(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect)
|
||||
.block(layout_block_top_border_with_title(title_style("Movies")))
|
||||
.loading(app.is_loading)
|
||||
.footer_alignment(Alignment::Center)
|
||||
.footer(Some(help_footer))
|
||||
.headers([
|
||||
"✔",
|
||||
"Title",
|
||||
@@ -220,11 +213,10 @@ fn draw_movie_overview(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
let title_block = title_block("Overview");
|
||||
f.render_widget(title_block, area);
|
||||
|
||||
let [paragraph_area, help_area] =
|
||||
Layout::vertical([Constraint::Percentage(95), Constraint::Length(1)])
|
||||
.flex(Flex::SpaceBetween)
|
||||
.margin(1)
|
||||
.areas(area);
|
||||
let [paragraph_area] = Layout::vertical([Constraint::Percentage(95)])
|
||||
.flex(Flex::SpaceBetween)
|
||||
.margin(1)
|
||||
.areas(area);
|
||||
let overview = Text::from(
|
||||
app
|
||||
.data
|
||||
@@ -235,15 +227,10 @@ fn draw_movie_overview(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
.overview,
|
||||
)
|
||||
.default();
|
||||
let help_text = Text::from(build_context_clue_string(&BARE_POPUP_CONTEXT_CLUES).help());
|
||||
|
||||
let paragraph = Paragraph::new(overview)
|
||||
.block(borderless_block())
|
||||
.wrap(Wrap { trim: false });
|
||||
let help_paragraph = Paragraph::new(help_text)
|
||||
.block(borderless_block())
|
||||
.centered();
|
||||
|
||||
f.render_widget(paragraph, paragraph_area);
|
||||
f.render_widget(help_paragraph, help_area);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
use ratatui::layout::{Constraint, Layout, Rect};
|
||||
use ratatui::text::Text;
|
||||
use ratatui::widgets::{ListItem, Paragraph};
|
||||
use ratatui::widgets::ListItem;
|
||||
use ratatui::Frame;
|
||||
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::radarr::modals::EditCollectionModal;
|
||||
use crate::models::servarr_data::radarr::radarr_data::{
|
||||
@@ -102,7 +100,7 @@ fn draw_edit_collection_confirmation_prompt(f: &mut Frame<'_>, app: &mut App<'_>
|
||||
let selected_minimum_availability = minimum_availability_list.current_selection();
|
||||
let selected_quality_profile = quality_profile_list.current_selection();
|
||||
|
||||
let [paragraph_area, monitored_area, min_availability_area, quality_profile_area, root_folder_area, search_on_add_area, _, buttons_area, help_area] =
|
||||
let [paragraph_area, monitored_area, min_availability_area, quality_profile_area, root_folder_area, search_on_add_area, _, buttons_area] =
|
||||
Layout::vertical([
|
||||
Constraint::Length(6),
|
||||
Constraint::Length(3),
|
||||
@@ -112,7 +110,6 @@ fn draw_edit_collection_confirmation_prompt(f: &mut Frame<'_>, app: &mut App<'_>
|
||||
Constraint::Length(3),
|
||||
Constraint::Fill(1),
|
||||
Constraint::Length(3),
|
||||
Constraint::Length(1),
|
||||
])
|
||||
.margin(1)
|
||||
.areas(area);
|
||||
@@ -120,8 +117,6 @@ fn draw_edit_collection_confirmation_prompt(f: &mut Frame<'_>, app: &mut App<'_>
|
||||
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(&collection_overview);
|
||||
let monitored_checkbox = Checkbox::new("Monitored")
|
||||
.highlighted(selected_block == ActiveRadarrBlock::EditCollectionToggleMonitored)
|
||||
@@ -163,7 +158,6 @@ fn draw_edit_collection_confirmation_prompt(f: &mut Frame<'_>, app: &mut App<'_>
|
||||
f.render_widget(search_on_add_checkbox, search_on_add_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_collection_select_minimum_availability_popup(f: &mut Frame<'_>, app: &mut App<'_>) {
|
||||
|
||||
@@ -66,11 +66,6 @@ pub(super) fn draw_collections(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect)
|
||||
};
|
||||
let quality_profile_map = &app.data.radarr_data.quality_profile_map;
|
||||
let content = Some(&mut app.data.radarr_data.collections);
|
||||
let collections_table_footer = app
|
||||
.data
|
||||
.radarr_data
|
||||
.main_tabs
|
||||
.get_active_tab_contextual_help();
|
||||
let collection_row_mapping = |collection: &Collection| {
|
||||
let number_of_movies = collection.movies.as_ref().unwrap_or(&Vec::new()).len();
|
||||
collection.title.scroll_left_or_reset(
|
||||
@@ -112,7 +107,6 @@ pub(super) fn draw_collections(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect)
|
||||
|| app.data.radarr_data.movies.is_empty()
|
||||
|| app.data.radarr_data.quality_profile_map.is_empty(),
|
||||
)
|
||||
.footer(collections_table_footer)
|
||||
.block(layout_block_top_border())
|
||||
.sorting(active_radarr_block == ActiveRadarrBlock::CollectionsSortPrompt)
|
||||
.searching(active_radarr_block == ActiveRadarrBlock::SearchCollection)
|
||||
|
||||
@@ -72,11 +72,6 @@ fn draw_downloads(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
} else {
|
||||
app.data.radarr_data.downloads.current_selection().clone()
|
||||
};
|
||||
let downloads_table_footer = app
|
||||
.data
|
||||
.radarr_data
|
||||
.main_tabs
|
||||
.get_active_tab_contextual_help();
|
||||
|
||||
let downloads_row_mapping = |download_record: &DownloadRecord| {
|
||||
let DownloadRecord {
|
||||
@@ -125,7 +120,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",
|
||||
|
||||
@@ -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::radarr::radarr_data::{ActiveRadarrBlock, 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 == ActiveRadarrBlock::EditIndexerConfirmPrompt;
|
||||
let edit_indexer_modal_option = &app.data.radarr_data.edit_indexer_modal;
|
||||
let protocol = &app.data.radarr_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,11 +1,8 @@
|
||||
use std::sync::atomic::Ordering;
|
||||
|
||||
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::radarr::radarr_data::{
|
||||
ActiveRadarrBlock, INDEXER_SETTINGS_BLOCKS,
|
||||
@@ -52,22 +49,15 @@ fn draw_edit_indexer_settings_prompt(f: &mut Frame<'_>, app: &mut App<'_>, area:
|
||||
let selected_block = app.data.radarr_data.selected_block.get_active_block();
|
||||
let highlight_yes_no = selected_block == ActiveRadarrBlock::IndexerSettingsConfirmPrompt;
|
||||
let indexer_settings_option = &app.data.radarr_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 [_, settings_area, _, buttons_area, help_area] = Layout::vertical([
|
||||
Constraint::Fill(1),
|
||||
Constraint::Length(15),
|
||||
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)
|
||||
@@ -167,7 +157,6 @@ fn draw_edit_indexer_settings_prompt(f: &mut Frame<'_>, app: &mut App<'_>, area:
|
||||
f.render_widget(allow_hardcoded_subs_checkbox, allow_hardcoded_subs_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
|
||||
.radarr_data
|
||||
.main_tabs
|
||||
.get_active_tab_contextual_help();
|
||||
let indexers_table = ManagarrTable::new(
|
||||
Some(&mut app.data.radarr_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::radarr::radarr_data::ActiveRadarrBlock;
|
||||
@@ -43,10 +42,6 @@ fn draw_test_all_indexers_test_results(f: &mut Frame<'_>, app: &mut App<'_>, are
|
||||
IndexerTestResultModalItem::default()
|
||||
};
|
||||
f.render_widget(block, 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),
|
||||
@@ -72,7 +67,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,14 +1,9 @@
|
||||
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::radarr::radarr_context_clues::ADD_MOVIE_SEARCH_RESULTS_CONTEXT_CLUES;
|
||||
use crate::models::radarr_models::AddMovieSearchResult;
|
||||
use crate::models::servarr_data::radarr::modals::AddMovieModal;
|
||||
use crate::models::servarr_data::radarr::radarr_data::{ActiveRadarrBlock, ADD_MOVIE_BLOCKS};
|
||||
@@ -16,8 +11,7 @@ use crate::models::Route;
|
||||
use crate::ui::radarr_ui::collections::CollectionsUi;
|
||||
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::input_box::InputBox;
|
||||
@@ -83,13 +77,10 @@ fn draw_add_movie_search(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
AddMovieSearchResult::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.radarr_data.add_movie_search.as_ref().unwrap().text;
|
||||
let offset = app
|
||||
.data
|
||||
@@ -164,27 +155,17 @@ fn draw_add_movie_search(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
let search_box = InputBox::new(block_content)
|
||||
.offset(offset)
|
||||
.block(title_block_centered("Add Movie"));
|
||||
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);
|
||||
}
|
||||
ActiveRadarrBlock::AddMovieEmptySearchResults => {
|
||||
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 movies 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);
|
||||
}
|
||||
ActiveRadarrBlock::AddMovieSearchResults
|
||||
| ActiveRadarrBlock::AddMoviePrompt
|
||||
@@ -194,11 +175,6 @@ fn draw_add_movie_search(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
| ActiveRadarrBlock::AddMovieSelectRootFolder
|
||||
| ActiveRadarrBlock::AddMovieAlreadyInLibrary
|
||||
| ActiveRadarrBlock::AddMovieTagsInput => {
|
||||
let help_text =
|
||||
Text::from(build_context_clue_string(&ADD_MOVIE_SEARCH_RESULTS_CONTEXT_CLUES).help());
|
||||
let help_paragraph = Paragraph::new(help_text)
|
||||
.block(borderless_block())
|
||||
.centered();
|
||||
let search_results_table = ManagarrTable::new(
|
||||
app.data.radarr_data.add_searched_movies.as_mut(),
|
||||
search_results_row_mapping,
|
||||
@@ -225,7 +201,6 @@ fn draw_add_movie_search(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
]);
|
||||
|
||||
f.render_widget(search_results_table, results_area);
|
||||
f.render_widget(help_paragraph, help_area);
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
@@ -322,7 +297,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, min_availability_area, quality_profile_area, tags_area, _, buttons_area, help_area] =
|
||||
let [paragraph_area, root_folder_area, monitor_area, min_availability_area, quality_profile_area, tags_area, _, buttons_area] =
|
||||
Layout::vertical([
|
||||
Constraint::Length(6),
|
||||
Constraint::Length(3),
|
||||
@@ -332,16 +307,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::radarr::modals::EditMovieModal;
|
||||
use crate::models::servarr_data::radarr::radarr_data::{
|
||||
@@ -94,7 +92,7 @@ fn draw_edit_movie_confirmation_prompt(f: &mut Frame<'_>, app: &mut App<'_>, are
|
||||
let selected_minimum_availability = minimum_availability_list.current_selection();
|
||||
let selected_quality_profile = quality_profile_list.current_selection();
|
||||
|
||||
let [paragraph_area, monitored_area, min_availability_area, quality_profile_area, path_area, tags_area, _, buttons_area, help_area] =
|
||||
let [paragraph_area, monitored_area, min_availability_area, quality_profile_area, path_area, tags_area, _, buttons_area] =
|
||||
Layout::vertical([
|
||||
Constraint::Length(6),
|
||||
Constraint::Length(3),
|
||||
@@ -104,7 +102,6 @@ fn draw_edit_movie_confirmation_prompt(f: &mut Frame<'_>, app: &mut App<'_>, are
|
||||
Constraint::Length(3),
|
||||
Constraint::Fill(1),
|
||||
Constraint::Length(3),
|
||||
Constraint::Length(1),
|
||||
])
|
||||
.margin(1)
|
||||
.areas(area);
|
||||
@@ -112,8 +109,6 @@ fn draw_edit_movie_confirmation_prompt(f: &mut Frame<'_>, app: &mut App<'_>, are
|
||||
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(&movie_overview);
|
||||
let monitored_checkbox = Checkbox::new("Monitored")
|
||||
.checked(monitored.unwrap_or_default())
|
||||
@@ -164,7 +159,6 @@ fn draw_edit_movie_confirmation_prompt(f: &mut Frame<'_>, app: &mut App<'_>, are
|
||||
f.render_widget(quality_profile_drop_down_button, quality_profile_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_movie_select_minimum_availability_popup(f: &mut Frame<'_>, app: &mut App<'_>) {
|
||||
|
||||
@@ -85,11 +85,6 @@ fn draw_library(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
let tags_map = &app.data.radarr_data.tags_map;
|
||||
let downloads_vec = &app.data.radarr_data.downloads.items;
|
||||
let content = Some(&mut app.data.radarr_data.movies);
|
||||
let help_footer = app
|
||||
.data
|
||||
.radarr_data
|
||||
.main_tabs
|
||||
.get_active_tab_contextual_help();
|
||||
|
||||
let library_table_row_mapping = |movie: &Movie| {
|
||||
movie.title.scroll_left_or_reset(
|
||||
@@ -143,7 +138,6 @@ fn draw_library(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
let library_table = ManagarrTable::new(content, library_table_row_mapping)
|
||||
.block(layout_block_top_border())
|
||||
.loading(app.is_loading)
|
||||
.footer(help_footer)
|
||||
.sorting(active_radarr_block == ActiveRadarrBlock::MoviesSortPrompt)
|
||||
.searching(active_radarr_block == ActiveRadarrBlock::SearchMovie)
|
||||
.search_produced_empty_results(active_radarr_block == ActiveRadarrBlock::SearchMovieError)
|
||||
|
||||
@@ -259,18 +259,12 @@ fn draw_movie_history(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
])
|
||||
.primary()
|
||||
};
|
||||
let help_footer = app
|
||||
.data
|
||||
.radarr_data
|
||||
.movie_info_tabs
|
||||
.get_active_tab_contextual_help();
|
||||
let history_table = ManagarrTable::new(
|
||||
Some(&mut movie_details_modal.movie_history),
|
||||
history_row_mapping,
|
||||
)
|
||||
.block(layout_block_top_border())
|
||||
.loading(app.is_loading)
|
||||
.footer(help_footer)
|
||||
.headers(["Source Title", "Event Type", "Languages", "Quality", "Date"])
|
||||
.constraints([
|
||||
Constraint::Percentage(34),
|
||||
@@ -301,14 +295,8 @@ fn draw_movie_cast(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
.primary()
|
||||
};
|
||||
let content = Some(&mut movie_details_modal.movie_cast);
|
||||
let help_footer = app
|
||||
.data
|
||||
.radarr_data
|
||||
.movie_info_tabs
|
||||
.get_active_tab_contextual_help();
|
||||
let cast_table = ManagarrTable::new(content, cast_row_mapping)
|
||||
.block(layout_block_top_border())
|
||||
.footer(help_footer)
|
||||
.loading(app.is_loading)
|
||||
.headers(["Cast Member", "Character"])
|
||||
.constraints([Constraint::Ratio(1, 2), Constraint::Ratio(1, 2)]);
|
||||
@@ -344,17 +332,11 @@ fn draw_movie_crew(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
.primary()
|
||||
};
|
||||
let content = Some(&mut movie_details_modal.movie_crew);
|
||||
let help_footer = app
|
||||
.data
|
||||
.radarr_data
|
||||
.movie_info_tabs
|
||||
.get_active_tab_contextual_help();
|
||||
let crew_table = ManagarrTable::new(content, crew_row_mapping)
|
||||
.block(layout_block_top_border())
|
||||
.loading(app.is_loading)
|
||||
.headers(["Crew Member", "Job", "Department"])
|
||||
.constraints(iter::repeat_n(Constraint::Ratio(1, 3), 3))
|
||||
.footer(help_footer);
|
||||
.constraints(iter::repeat_n(Constraint::Ratio(1, 3), 3));
|
||||
|
||||
f.render_widget(crew_table, area);
|
||||
}
|
||||
@@ -383,11 +365,6 @@ fn draw_movie_releases(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
};
|
||||
let current_route = app.get_current_route();
|
||||
let mut default_movie_details_modal = MovieDetailsModal::default();
|
||||
let help_footer = app
|
||||
.data
|
||||
.radarr_data
|
||||
.movie_info_tabs
|
||||
.get_active_tab_contextual_help();
|
||||
let content = Some(
|
||||
&mut app
|
||||
.data
|
||||
@@ -464,7 +441,6 @@ fn draw_movie_releases(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
let releases_table = ManagarrTable::new(content, releases_row_mapping)
|
||||
.block(layout_block_top_border())
|
||||
.loading(app.is_loading || is_empty)
|
||||
.footer(help_footer)
|
||||
.sorting(active_radarr_block == ActiveRadarrBlock::ManualSearchSortPrompt)
|
||||
.headers([
|
||||
"Source", "Age", "⛔", "Title", "Indexer", "Size", "Peers", "Language", "Quality",
|
||||
|
||||
@@ -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
|
||||
.radarr_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_data::radarr::radarr_data::ActiveRadarrBlock;
|
||||
use crate::models::servarr_models::QueueEvent;
|
||||
use crate::ui::radarr_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;
|
||||
@@ -72,12 +70,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);
|
||||
@@ -85,7 +79,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) {
|
||||
@@ -188,26 +181,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
|
||||
.radarr_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::radarr::radarr_context_clues::SYSTEM_TASKS_CONTEXT_CLUES;
|
||||
use crate::app::App;
|
||||
use crate::models::radarr_models::RadarrTask;
|
||||
use crate::models::servarr_data::radarr::radarr_data::{ActiveRadarrBlock, SYSTEM_DETAILS_BLOCKS};
|
||||
@@ -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.radarr_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: &RadarrTask| {
|
||||
let task_props = extract_task_props(task);
|
||||
|
||||
@@ -107,7 +94,6 @@ fn draw_tasks_popup(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
let tasks_table = ManagarrTable::new(Some(&mut app.data.radarr_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);
|
||||
@@ -136,10 +122,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.radarr_data.updates.get_text();
|
||||
let block = title_block("Updates");
|
||||
|
||||
@@ -147,18 +129,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.radarr_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());
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
use crate::app::context_clues::{build_context_clue_string, CONFIRMATION_PROMPT_CONTEXT_CLUES};
|
||||
use crate::ui::styles::ManagarrStyle;
|
||||
use crate::ui::utils::{layout_paragraph_borderless, title_block_centered};
|
||||
use crate::ui::widgets::button::Button;
|
||||
@@ -6,7 +5,6 @@ use crate::ui::widgets::checkbox::Checkbox;
|
||||
use derive_setters::Setters;
|
||||
use ratatui::buffer::Buffer;
|
||||
use ratatui::layout::{Constraint, Flex, Layout, Rect};
|
||||
use ratatui::text::Text;
|
||||
use ratatui::widgets::{Paragraph, Widget};
|
||||
use std::iter;
|
||||
|
||||
@@ -40,16 +38,12 @@ impl ConfirmationPrompt<'_> {
|
||||
|
||||
fn render_confirmation_prompt_with_checkboxes(self, area: Rect, buf: &mut Buffer) {
|
||||
title_block_centered(self.title).render(area, buf);
|
||||
let help_text =
|
||||
Text::from(build_context_clue_string(&CONFIRMATION_PROMPT_CONTEXT_CLUES).help());
|
||||
let help_paragraph = Paragraph::new(help_text).centered();
|
||||
|
||||
if let Some(checkboxes) = self.checkboxes {
|
||||
let mut constraints = vec![
|
||||
Constraint::Length(4),
|
||||
Constraint::Fill(1),
|
||||
Constraint::Length(3),
|
||||
Constraint::Length(1),
|
||||
];
|
||||
constraints.splice(
|
||||
1..1,
|
||||
@@ -61,7 +55,6 @@ impl ConfirmationPrompt<'_> {
|
||||
.areas(chunks[checkboxes.len() + 2]);
|
||||
|
||||
layout_paragraph_borderless(self.prompt).render(chunks[0], buf);
|
||||
help_paragraph.render(chunks[checkboxes.len() + 3], buf);
|
||||
|
||||
checkboxes
|
||||
.into_iter()
|
||||
@@ -83,38 +76,30 @@ impl ConfirmationPrompt<'_> {
|
||||
|
||||
fn render_confirmation_prompt(self, area: Rect, buf: &mut Buffer) {
|
||||
title_block_centered(self.title).render(area, buf);
|
||||
let help_text =
|
||||
Text::from(build_context_clue_string(&CONFIRMATION_PROMPT_CONTEXT_CLUES).help());
|
||||
let help_paragraph = Paragraph::new(help_text).centered();
|
||||
|
||||
let [prompt_area, buttons_area] = if let Some(content_paragraph) = self.content {
|
||||
let [prompt_area, content_area, _, buttons_area, help_area] = Layout::vertical([
|
||||
let [prompt_area, content_area, _, buttons_area] = Layout::vertical([
|
||||
Constraint::Length(4),
|
||||
Constraint::Length(7),
|
||||
Constraint::Fill(1),
|
||||
Constraint::Length(3),
|
||||
Constraint::Length(1),
|
||||
])
|
||||
.margin(1)
|
||||
.areas(area);
|
||||
|
||||
content_paragraph.render(content_area, buf);
|
||||
help_paragraph.render(help_area, buf);
|
||||
|
||||
[prompt_area, buttons_area]
|
||||
} else {
|
||||
let [prompt_area, buttons_area, _, help_area] = Layout::vertical([
|
||||
let [prompt_area, _, buttons_area] = Layout::vertical([
|
||||
Constraint::Percentage(72),
|
||||
Constraint::Length(3),
|
||||
Constraint::Fill(0),
|
||||
Constraint::Min(1),
|
||||
Constraint::Length(3),
|
||||
])
|
||||
.margin(1)
|
||||
.flex(Flex::SpaceBetween)
|
||||
.areas(area);
|
||||
|
||||
help_paragraph.render(help_area, buf);
|
||||
|
||||
[prompt_area, buttons_area]
|
||||
};
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
use crate::ui::styles::ManagarrStyle;
|
||||
use crate::ui::utils::{background_block, borderless_block, centered_rect};
|
||||
use crate::ui::utils::{background_block, centered_rect};
|
||||
use ratatui::buffer::Buffer;
|
||||
use ratatui::layout::{Constraint, Layout, Rect};
|
||||
use ratatui::widgets::{Block, Clear, Paragraph, Widget, WidgetRef};
|
||||
use ratatui::widgets::{Block, Clear, Widget, WidgetRef};
|
||||
|
||||
use super::input_box::InputBox;
|
||||
|
||||
@@ -39,17 +38,10 @@ impl<'a> InputBoxPopup<'a> {
|
||||
Clear.render(popup_area, buf);
|
||||
background_block().render(popup_area, buf);
|
||||
|
||||
let [text_box_area, help_area] =
|
||||
Layout::vertical([Constraint::Length(3), Constraint::Length(1)])
|
||||
.margin(1)
|
||||
.areas(popup_area);
|
||||
let [text_box_area] = Layout::vertical([Constraint::Length(3)])
|
||||
.margin(1)
|
||||
.areas(popup_area);
|
||||
self.input_box.render_ref(text_box_area, buf);
|
||||
|
||||
let help = Paragraph::new("<esc> cancel")
|
||||
.help()
|
||||
.centered()
|
||||
.block(borderless_block());
|
||||
help.render(help_area, buf);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
-29
@@ -1,9 +1,7 @@
|
||||
use crate::ui::styles::ManagarrStyle;
|
||||
use crate::ui::utils::{background_block, centered_rect, layout_block_top_border};
|
||||
use crate::ui::utils::{background_block, centered_rect};
|
||||
use ratatui::buffer::Buffer;
|
||||
use ratatui::layout::{Constraint, Layout, Rect};
|
||||
use ratatui::prelude::Text;
|
||||
use ratatui::widgets::{Block, Clear, Paragraph, Widget};
|
||||
use ratatui::layout::Rect;
|
||||
use ratatui::widgets::{Block, Clear, Widget};
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "popup_tests.rs"]
|
||||
@@ -25,6 +23,7 @@ pub enum Size {
|
||||
XLarge,
|
||||
XXLarge,
|
||||
Long,
|
||||
LongNarrowTable,
|
||||
}
|
||||
|
||||
impl Size {
|
||||
@@ -45,6 +44,7 @@ impl Size {
|
||||
Size::XLarge => (83, 83),
|
||||
Size::XXLarge => (90, 90),
|
||||
Size::Long => (65, 75),
|
||||
Size::LongNarrowTable => (55, 85),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -54,7 +54,6 @@ pub struct Popup<'a, T: Widget> {
|
||||
percent_x: u16,
|
||||
percent_y: u16,
|
||||
block: Option<Block<'a>>,
|
||||
footer: Option<&'a str>,
|
||||
}
|
||||
|
||||
impl<'a, T: Widget> Popup<'a, T> {
|
||||
@@ -64,7 +63,6 @@ impl<'a, T: Widget> Popup<'a, T> {
|
||||
percent_x: 0,
|
||||
percent_y: 0,
|
||||
block: None,
|
||||
footer: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,11 +84,6 @@ impl<'a, T: Widget> Popup<'a, T> {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn footer(mut self, footer: &'a str) -> Self {
|
||||
self.footer = Some(footer);
|
||||
self
|
||||
}
|
||||
|
||||
fn render_popup(self, area: Rect, buf: &mut Buffer) {
|
||||
let mut popup_area = centered_rect(self.percent_x, self.percent_y, area);
|
||||
let height = if popup_area.height < 3 {
|
||||
@@ -109,23 +102,7 @@ impl<'a, T: Widget> Popup<'a, T> {
|
||||
block.render(popup_area, buf);
|
||||
}
|
||||
|
||||
let content_area = if let Some(footer) = self.footer {
|
||||
let [content_area, help_footer_area] =
|
||||
Layout::vertical([Constraint::Fill(0), Constraint::Length(2)])
|
||||
.margin(1)
|
||||
.areas(popup_area);
|
||||
|
||||
Paragraph::new(Text::from(format!(" {footer}").help()))
|
||||
.block(layout_block_top_border())
|
||||
.left_aligned()
|
||||
.render(help_footer_area, buf);
|
||||
|
||||
content_area
|
||||
} else {
|
||||
popup_area
|
||||
};
|
||||
|
||||
self.widget.render(content_area, buf);
|
||||
self.widget.render(popup_area, buf);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ mod tests {
|
||||
assert_eq!(Size::XLarge.to_percent(), (83, 83));
|
||||
assert_eq!(Size::XXLarge.to_percent(), (90, 90));
|
||||
assert_eq!(Size::Long.to_percent(), (65, 75));
|
||||
assert_eq!(Size::LongNarrowTable.to_percent(), (55, 85));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -31,7 +32,6 @@ mod tests {
|
||||
assert_eq!(popup.percent_x, 0);
|
||||
assert_eq!(popup.percent_y, 0);
|
||||
assert_eq!(popup.block, None);
|
||||
assert_eq!(popup.footer, None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -42,7 +42,6 @@ mod tests {
|
||||
assert_eq!(popup.percent_y, 40);
|
||||
assert_eq!(popup.widget, Block::new());
|
||||
assert_eq!(popup.block, None);
|
||||
assert_eq!(popup.footer, None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -53,7 +52,6 @@ mod tests {
|
||||
assert_eq!(popup.percent_y, 50);
|
||||
assert_eq!(popup.widget, Block::new());
|
||||
assert_eq!(popup.block, None);
|
||||
assert_eq!(popup.footer, None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -64,17 +62,5 @@ mod tests {
|
||||
assert_eq!(popup.widget, Block::new());
|
||||
assert_eq!(popup.percent_x, 0);
|
||||
assert_eq!(popup.percent_y, 0);
|
||||
assert_eq!(popup.footer, None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_popup_footer() {
|
||||
let popup = Popup::new(Block::new()).footer("footer");
|
||||
|
||||
assert_eq!(popup.footer, Some("footer"));
|
||||
assert_eq!(popup.widget, Block::new());
|
||||
assert_eq!(popup.percent_x, 0);
|
||||
assert_eq!(popup.percent_y, 0);
|
||||
assert_eq!(popup.block, None);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user