feat(ui): Initial UI support for switching to Sonarr tabs
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use std::iter;
|
||||
use std::{cmp, iter};
|
||||
|
||||
use chrono::{Duration, Utc};
|
||||
use ratatui::layout::{Constraint, Layout, Rect};
|
||||
@@ -178,15 +178,17 @@ fn draw_downloads_context(f: &mut Frame<'_>, app: &App<'_>, area: Rect) {
|
||||
if !downloads_vec.is_empty() {
|
||||
f.render_widget(block, area);
|
||||
|
||||
let max_items = (((area.height as f64 / 2.0).floor() * 2.0) as usize) / 2;
|
||||
let items = cmp::min(downloads_vec.len(), max_items - 1);
|
||||
let download_item_areas = Layout::vertical(
|
||||
iter::repeat(Constraint::Length(2))
|
||||
.take(downloads_vec.len())
|
||||
.take(items)
|
||||
.collect::<Vec<Constraint>>(),
|
||||
)
|
||||
.margin(1)
|
||||
.split(area);
|
||||
|
||||
for i in 0..downloads_vec.len() {
|
||||
for i in 0..items {
|
||||
let DownloadRecord {
|
||||
title,
|
||||
sizeleft,
|
||||
|
||||
Reference in New Issue
Block a user