refactor: Use is_multiple_of for the tick counter in the UI module
This commit is contained in:
@@ -88,7 +88,7 @@ fn draw_downloads(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
output_path.as_ref().unwrap().scroll_left_or_reset(
|
||||
get_width_from_percentage(area, 18),
|
||||
current_selection == *download_record,
|
||||
app.tick_count % app.ticks_until_scroll == 0,
|
||||
app.tick_count.is_multiple_of(app.ticks_until_scroll),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ fn draw_history_table(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
source_title.scroll_left_or_reset(
|
||||
get_width_from_percentage(area, 40),
|
||||
current_selection == *history_item,
|
||||
app.tick_count % app.ticks_until_scroll == 0,
|
||||
app.tick_count.is_multiple_of(app.ticks_until_scroll),
|
||||
);
|
||||
|
||||
Row::new(vec![
|
||||
|
||||
@@ -44,7 +44,7 @@ fn draw_test_all_indexers_test_results(f: &mut Frame<'_>, app: &mut App<'_>, are
|
||||
result.validation_failures.scroll_left_or_reset(
|
||||
get_width_from_percentage(area, 86),
|
||||
*result == current_selection,
|
||||
app.tick_count % app.ticks_until_scroll == 0,
|
||||
app.tick_count.is_multiple_of(app.ticks_until_scroll),
|
||||
);
|
||||
let pass_fail = if result.is_valid { "✔" } else { "❌" };
|
||||
let row = Row::new(vec![
|
||||
|
||||
@@ -119,7 +119,7 @@ fn draw_add_series_search(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
series.title.scroll_left_or_reset(
|
||||
get_width_from_percentage(area, 27),
|
||||
*series == current_selection,
|
||||
app.tick_count % app.ticks_until_scroll == 0,
|
||||
app.tick_count.is_multiple_of(app.ticks_until_scroll),
|
||||
);
|
||||
|
||||
Row::new(vec![
|
||||
|
||||
@@ -280,7 +280,7 @@ fn draw_episode_history_table(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect)
|
||||
source_title.scroll_left_or_reset(
|
||||
get_width_from_percentage(area, 40),
|
||||
current_selection == *history_item,
|
||||
app.tick_count % app.ticks_until_scroll == 0,
|
||||
app.tick_count.is_multiple_of(app.ticks_until_scroll),
|
||||
);
|
||||
|
||||
Row::new(vec![
|
||||
@@ -424,7 +424,7 @@ fn draw_episode_releases(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
get_width_from_percentage(area, 30),
|
||||
current_selection == *release
|
||||
&& active_sonarr_block != ActiveSonarrBlock::ManualEpisodeSearchConfirmPrompt,
|
||||
app.tick_count % app.ticks_until_scroll == 0,
|
||||
app.tick_count.is_multiple_of(app.ticks_until_scroll),
|
||||
);
|
||||
let size = convert_to_gb(*size);
|
||||
let rejected_str = if *rejected { "⛔" } else { "" };
|
||||
|
||||
@@ -95,7 +95,7 @@ fn draw_library(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
series.title.scroll_left_or_reset(
|
||||
get_width_from_percentage(area, 23),
|
||||
*series == current_selection,
|
||||
app.tick_count % app.ticks_until_scroll == 0,
|
||||
app.tick_count.is_multiple_of(app.ticks_until_scroll),
|
||||
);
|
||||
let monitored = if series.monitored { "🏷" } else { "" };
|
||||
let certification = series.certification.clone().unwrap_or_default();
|
||||
|
||||
@@ -271,7 +271,7 @@ fn draw_season_history_table(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
source_title.scroll_left_or_reset(
|
||||
get_width_from_percentage(area, 40),
|
||||
current_selection == *history_item,
|
||||
app.tick_count % app.ticks_until_scroll == 0,
|
||||
app.tick_count.is_multiple_of(app.ticks_until_scroll),
|
||||
);
|
||||
|
||||
Row::new(vec![
|
||||
@@ -376,7 +376,7 @@ fn draw_season_releases(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
get_width_from_percentage(area, 30),
|
||||
current_selection == *release
|
||||
&& active_sonarr_block != ActiveSonarrBlock::ManualSeasonSearchConfirmPrompt,
|
||||
app.tick_count % app.ticks_until_scroll == 0,
|
||||
app.tick_count.is_multiple_of(app.ticks_until_scroll),
|
||||
);
|
||||
let size = convert_to_gb(*size);
|
||||
let rejected_str = if *rejected { "⛔" } else { "" };
|
||||
|
||||
@@ -315,7 +315,7 @@ fn draw_series_history_table(f: &mut Frame<'_>, app: &mut App<'_>, area: Rect) {
|
||||
source_title.scroll_left_or_reset(
|
||||
get_width_from_percentage(area, 40),
|
||||
current_selection == *history_item,
|
||||
app.tick_count % app.ticks_until_scroll == 0,
|
||||
app.tick_count.is_multiple_of(app.ticks_until_scroll),
|
||||
);
|
||||
|
||||
Row::new(vec![
|
||||
|
||||
Reference in New Issue
Block a user