feat(ui): Initial UI support for switching to Sonarr tabs

This commit is contained in:
2024-11-29 15:58:19 -07:00
parent 4d1b0fe301
commit 08f190fc6e
13 changed files with 537 additions and 19 deletions
+5 -3
View File
@@ -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,