mirror of
https://github.com/markuryy/shark.git
synced 2025-12-12 11:41:02 +00:00
feat(ui): show active download count in navigation
This commit is contained in:
@@ -5,11 +5,20 @@
|
||||
import ToolBar from "$lib/ToolBar.svelte";
|
||||
import { settings, loadSettings } from '$lib/stores/settings';
|
||||
import { scanPlaylists, type Playlist } from '$lib/library/scanner';
|
||||
import { downloadQueue } from '$lib/stores/downloadQueue';
|
||||
|
||||
let { children } = $props();
|
||||
|
||||
let playlists = $state<Playlist[]>([]);
|
||||
|
||||
// Count active downloads (queued or downloading)
|
||||
let activeDownloads = $derived(
|
||||
$downloadQueue.queueOrder.filter(id => {
|
||||
const item = $downloadQueue.queue[id];
|
||||
return item && (item.status === 'queued' || item.status === 'downloading');
|
||||
}).length
|
||||
);
|
||||
|
||||
onMount(async () => {
|
||||
await loadSettings();
|
||||
await loadPlaylists();
|
||||
@@ -46,7 +55,7 @@
|
||||
</a>
|
||||
<a href="/downloads" class="nav-item">
|
||||
<img src="/icons/cd-audio.png" alt="" class="nav-icon" />
|
||||
Downloads
|
||||
Downloads{#if activeDownloads > 0} ({activeDownloads}){/if}
|
||||
</a>
|
||||
<details class="nav-collapsible">
|
||||
<summary class="nav-item">
|
||||
|
||||
Reference in New Issue
Block a user