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.

refactor: add revealFile function and update download item actions

Tonho54eeee46b8e8
diff --git a/src/routes/downloads/+page.svelte b/src/routes/downloads/+page.svelte
index cff15344..381a6e8c 100644
--- a/src/routes/downloads/+page.svelte
+++ b/src/routes/downloads/+page.svelte
@@ -111,6 +111,15 @@
showToast("error", msg);
}
}
+
+ async function revealFile(path: string) {
+ try {
+ await invoke("reveal_file", { path });
+ } catch (e: any) {
+ const msg = typeof e === "string" ? e : e.message ?? $t("common.error");
+ showToast("error", msg);
+ }
+ }
</script>
{#if hasDownloads}
@@ -244,6 +253,36 @@
<path d="M18 6L6 18M6 6l12 12" />
</svg>
</button>
+ {:else if item.status === "complete" && item.filePath}
+ <button
+ class="action-icon-btn"
+ onclick={() => revealFile(item.filePath!)}
+ aria-label={$t('downloads.open_folder')}
+ title={$t('downloads.open_folder')}
+ >
+ <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
+ <path d="M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z" />
+ </svg>
+ </button>
+ <button
+ class="action-icon-btn"
+ onclick={() => removeItem(item.id)}
+ aria-label={$t('common.close')}
+ >
+ <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
+ <path d="M18 6L6 18M6 6l12 12" />
+ </svg>
+ </button>
+ {:else if item.status === "complete"}
+ <button
+ class="action-icon-btn"
+ onclick={() => removeItem(item.id)}
+ aria-label={$t('common.close')}
+ >
+ <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
+ <path d="M18 6L6 18M6 6l12 12" />
+ </svg>
+ </button>
{:else if item.status === "queued"}
<button
class="action-icon-btn"