Skip to content

Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.

feat: enhance download display by separating course and generic items in the downloads page

Tonho611e6e4253f6
diff --git a/src/routes/downloads/+page.svelte b/src/routes/downloads/+page.svelte
index 0127eb6d..5338d45f 100644
--- a/src/routes/downloads/+page.svelte
+++ b/src/routes/downloads/+page.svelte
@@ -8,14 +8,19 @@
formatSpeed,
getEtaI18n,
type CourseDownloadItem,
+ type GenericDownloadItem,
} from "$lib/stores/download-store.svelte";
+ import PlatformIcon from "$components/icons/PlatformIcon.svelte";
import Mascot from "$components/mascot/Mascot.svelte";
let downloads = $derived(getDownloads());
- let downloadList = $derived(
+ let courseList = $derived(
[...downloads.values()].filter((d): d is CourseDownloadItem => d.kind === "course")
);
- let hasDownloads = $derived(downloadList.length > 0);
+ let genericList = $derived(
+ [...downloads.values()].filter((d): d is GenericDownloadItem => d.kind === "generic")
+ );
+ let hasDownloads = $derived(courseList.length > 0 || genericList.length > 0);
async function cancelDownload(courseId: number) {
try {
@@ -32,7 +37,37 @@
<div class="downloads-page">
<h2>{$t('downloads.title')}</h2>
<div class="download-list">
- {#each downloadList as item (item.id)}
+ {#each genericList as item (item.id)}
+ <div class="download-item" data-status={item.status}>
+ <div class="item-header">
+ <div class="item-header-left">
+ <PlatformIcon platform={item.platform} size={16} />
+ <span class="item-name">{item.name}</span>
+ </div>
+ <span class="item-status" data-status={item.status}>
+ {$t(`downloads.status.${item.status}`)}
+ </span>
+ </div>
+
+ <span class="item-detail">{item.platform.charAt(0).toUpperCase() + item.platform.slice(1)}</span>
+
+ {#if item.status === "error" && item.error}
+ <span class="item-error">{item.error}</span>
+ {/if}
+
+ <div class="progress-track">
+ <div
+ class="progress-fill"
+ data-status={item.status}
+ style="width: {item.percent.toFixed(1)}%"
+ ></div>
+ </div>
+
+ <span class="item-percent">{item.percent.toFixed(0)}%</span>
+ </div>
+ {/each}
+
+ {#each courseList as item (item.id)}
<div class="download-item" data-status={item.status}>
<div class="item-header">
<span class="item-name">{item.name}</span>
@@ -170,6 +205,14 @@
flex-shrink: 0;
}
+ .item-header-left {
+ display: flex;
+ align-items: center;
+ gap: calc(var(--padding) / 2);
+ min-width: 0;
+ flex: 1;
+ }
+
.item-name {
font-size: 14.5px;
font-weight: 500;