feat(library): add source badge to album cards in Local Library

Albums now show a small badge indicating their source:
- HardDrive icon for local files (source='user')
- Qobuz logo for offline cached content (source='qobuz_download')

Badge appears in bottom-right corner of album artwork.
This commit is contained in:
vicrodh committed 2026-01-28 02:40:00 -06:00
1 parent e025882a9f
commit e8f0c96ccc
7 files changed
+820 -6

No files matched your search

+40 -2
View File
@@ -1,6 +1,6 @@
<script lang="ts">
import { onMount, tick } from 'svelte';
import { Play, Disc3, Heart } from 'lucide-svelte';
import { Play, Disc3, Heart, HardDrive } from 'lucide-svelte';
import AlbumMenu from './AlbumMenu.svelte';
import {
subscribe as subscribeAlbumFavorites,
@@ -34,6 +34,8 @@
onOpenContainingFolder?: () => void;
onReDownloadAlbum?: () => void;
downloadStateVersion?: number;
/** Source badge for local library: 'user' for local files, 'qobuz_download' for Qobuz offline */
sourceBadge?: 'user' | 'qobuz_download';
}
let {
@@ -60,7 +62,8 @@
isAlbumFullyDownloaded = false,
onOpenContainingFolder,
onReDownloadAlbum,
downloadStateVersion
downloadStateVersion,
sourceBadge
}: Props = $props();
const isDownloaded = $derived.by(() => {
@@ -251,6 +254,17 @@
</div>
</div>
{/if}
<!-- Source Badge (Local Library only) -->
{#if sourceBadge}
<div class="source-badge" title={sourceBadge === 'user' ? 'Local file' : 'Qobuz offline'}>
{#if sourceBadge === 'user'}
<HardDrive size={14} />
{:else}
<img src="/qobuz-logo-filled.svg" alt="Qobuz" class="qobuz-badge-icon" />
{/if}
</div>
{/if}
</div>
<!-- Text Info -->
@@ -334,6 +348,30 @@
border: 1px solid rgba(40, 42, 54, 0.95) !important;
}
/* Source badge for Local Library albums */
.source-badge {
position: absolute;
bottom: 6px;
right: 6px;
z-index: 3;
display: flex;
align-items: center;
justify-content: center;
width: 24px;
height: 24px;
background: rgba(0, 0, 0, 0.7);
border-radius: 4px;
color: var(--text-secondary);
backdrop-filter: blur(4px);
}
.source-badge .qobuz-badge-icon {
width: 14px;
height: 14px;
filter: brightness(0) invert(1);
opacity: 0.85;
}
.play-overlay {
position: absolute;
inset: 0;
@@ -17,6 +17,7 @@
bit_depth?: number;
sample_rate: number;
directory_path: string;
source?: string; // 'user' for local files, 'qobuz_download' for offline cached
}
interface AlbumGroup {
@@ -43,6 +44,8 @@
onAlbumQueueNext: (album: LocalAlbum) => void;
onAlbumQueueLater: (album: LocalAlbum) => void;
scrollToGroupId?: string;
/** Show source badge on albums (for Local Library) */
showSourceBadge?: boolean;
}
let {
@@ -58,6 +61,7 @@
onAlbumQueueNext,
onAlbumQueueLater,
scrollToGroupId,
showSourceBadge = false,
}: Props = $props();
// Constants
@@ -320,6 +324,7 @@
onPlayNext={() => onAlbumQueueNext(album)}
onPlayLater={() => onAlbumQueueLater(album)}
onclick={() => onAlbumClick(album)}
sourceBadge={showSourceBadge ? (album.source === 'qobuz_download' ? 'qobuz_download' : 'user') : undefined}
/>
{/each}
</div>
@@ -85,6 +85,7 @@
bit_depth?: number;
sample_rate: number;
directory_path: string;
source?: string; // 'user' for local files, 'qobuz_download' for offline cached
}
interface LocalArtist {
@@ -2902,6 +2903,7 @@
onAlbumQueueNext={handleAlbumQueueNextFromGrid}
onAlbumQueueLater={handleAlbumQueueLaterFromGrid}
scrollToGroupId={virtualizedScrollTarget}
showSourceBadge={true}
/>
</div>