Add resumable downloads, download paths, queue controls and history
This commit is contained in:
1 parent
434f6441da
commit
6027cfabb9
43 files changed
+2138
-291
No files matched your search
@@ -3,6 +3,7 @@ const units = ["B", "KB", "MB", "GB", "TB"];
|
||||
export const statusLabels = {
|
||||
queued: "Queued",
|
||||
downloading: "Downloading",
|
||||
paused: "Paused",
|
||||
extracting: "Extracting",
|
||||
ready: "Ready",
|
||||
moving: "Moving",
|
||||
@@ -21,6 +22,21 @@ export function formatBytes(bytes) {
|
||||
return `${value.toFixed(unitIndex === 0 ? 0 : 1)} ${units[unitIndex]}`;
|
||||
}
|
||||
|
||||
export function formatDuration(seconds) {
|
||||
const total = Math.max(0, Math.round(seconds));
|
||||
const hours = Math.floor(total / 3600);
|
||||
const minutes = Math.floor((total % 3600) / 60);
|
||||
const remainingSeconds = total % 60;
|
||||
if (hours > 0) return `${hours}h ${minutes}m`;
|
||||
if (minutes > 0) return `${minutes}m ${remainingSeconds}s`;
|
||||
return `${remainingSeconds}s`;
|
||||
}
|
||||
|
||||
export function formatDate(value) {
|
||||
const date = new Date(value);
|
||||
return Number.isNaN(date.getTime()) ? "" : date.toLocaleString();
|
||||
}
|
||||
|
||||
export function percentOf(done, total) {
|
||||
if (!total || total <= 0) return null;
|
||||
return Math.min(100, (done / total) * 100);
|
||||
|
||||
Reference in new issue
Block a user