fix: app nap ipc drop and implement delete modal

This commit is contained in:
NimBold
2026-06-15 13:29:20 +03:30
parent d046c95c28
commit 9e26be5b2c
8 changed files with 141 additions and 78 deletions
+14 -1
View File
@@ -18,7 +18,7 @@ use tokio::{
};
use uuid::Uuid;
const PROGRESS_INTERVAL: Duration = Duration::from_millis(150);
const PROGRESS_INTERVAL: Duration = Duration::from_millis(1000);
const WRITE_BUFFER_CAPACITY: usize = 256 * 1024;
#[derive(Debug)]
@@ -153,6 +153,7 @@ impl CoordinatorEventSink {
fraction,
speed: format_speed(speed_bytes),
eta,
size: total.map(|t| format_size(t as f64)),
},
);
}
@@ -586,6 +587,18 @@ fn format_speed(bytes_per_second: f64) -> String {
}
}
fn format_size(bytes: f64) -> String {
if bytes >= 1024.0 * 1024.0 * 1024.0 {
format!("{:.2} GB", bytes / (1024.0 * 1024.0 * 1024.0))
} else if bytes >= 1024.0 * 1024.0 {
format!("{:.1} MB", bytes / (1024.0 * 1024.0))
} else if bytes >= 1024.0 {
format!("{:.1} KB", bytes / 1024.0)
} else {
format!("{bytes:.0} B")
}
}
fn format_duration(seconds: f64) -> String {
if seconds >= 3600.0 {
format!("{:.0}h {:.0}m", seconds / 3600.0, (seconds % 3600.0) / 60.0)