diff --git a/src/lib/components/QualityBadge.svelte b/src/lib/components/QualityBadge.svelte index 2ca436f99..95625aa65 100644 --- a/src/lib/components/QualityBadge.svelte +++ b/src/lib/components/QualityBadge.svelte @@ -4,13 +4,15 @@ bitDepth?: number; samplingRate?: number; format?: string; + compact?: boolean; } let { quality = '', bitDepth, samplingRate, - format + format, + compact = false }: Props = $props(); // Determine quality tier @@ -53,7 +55,7 @@ return 'cd'; // Default to CD instead of unknown }); - // Format the display text + // Format the display text for full mode const displayText = $derived.by(() => { if (tier === 'max') { const depth = bitDepth || 24; @@ -77,6 +79,19 @@ return '16-bit / 44.1 kHz'; }); + // Format the compact display text + const compactText = $derived.by(() => { + if (tier === 'max' || tier === 'hires') { + const depth = bitDepth || 24; + const rate = samplingRate || (tier === 'max' ? 192 : 96); + return `${depth}bit/${rate}kHz`; + } + if (tier === 'mp3') { + return 'MP3'; + } + return 'CD Quality'; + }); + const tierLabel = $derived.by(() => { if (tier === 'max') return 'Hi-Res'; if (tier === 'hires') return 'Hi-Res'; @@ -96,23 +111,52 @@ const isHiRes = $derived(tier === 'max' || tier === 'hires'); -
- - {tierLabel} +{#if compact} + + {compactText} + +{:else} +
+ + {tierLabel} - -
- {tierLabel} - {displayText} + +
+ {tierLabel} + {displayText} +
-
+{/if}