fix(settings): improve artwork cache display and button style

- Handle undefined/null values in cache stats with nullish coalescing
- Show "No cached artwork" when both counts are 0
- Use outlined style for Clear All button (consistent with others)
- Simplified description text
This commit is contained in:
vicrodh committed 2026-01-28 12:12:59 -06:00
1 parent 685efcfd76
commit b1bc4091e0
1 file changed
+12 -15
+12 -15
View File
@@ -2553,7 +2553,15 @@
<span class="setting-label">Artwork Thumbnails</span> <span class="setting-label">Artwork Thumbnails</span>
<small class="setting-note"> <small class="setting-note">
{#if artworkCacheStats} {#if artworkCacheStats}
{artworkCacheStats.thumbnail_file_count} thumbnails ({formatBytes(artworkCacheStats.thumbnails_cache_bytes)}){#if artworkCacheStats.artwork_file_count > 0}, {artworkCacheStats.artwork_file_count} legacy files ({formatBytes(artworkCacheStats.artwork_cache_bytes)}){/if} {@const thumbCount = artworkCacheStats.thumbnail_file_count ?? 0}
{@const thumbBytes = artworkCacheStats.thumbnails_cache_bytes ?? 0}
{@const legacyCount = artworkCacheStats.artwork_file_count ?? 0}
{@const legacyBytes = artworkCacheStats.artwork_cache_bytes ?? 0}
{#if thumbCount > 0 || legacyCount > 0}
{#if thumbCount > 0}{thumbCount} thumbnails ({formatBytes(thumbBytes)}){/if}{#if thumbCount > 0 && legacyCount > 0}, {/if}{#if legacyCount > 0}{legacyCount} legacy files ({formatBytes(legacyBytes)}){/if}
{:else}
No cached artwork
{/if}
{:else} {:else}
- -
{/if} {/if}
@@ -2562,7 +2570,7 @@
<button <button
class="clear-btn" class="clear-btn"
onclick={handleClearArtworkCache} onclick={handleClearArtworkCache}
disabled={isClearingArtwork || !artworkCacheStats || (artworkCacheStats.thumbnails_cache_bytes === 0 && artworkCacheStats.artwork_cache_bytes === 0)} disabled={isClearingArtwork || !artworkCacheStats || ((artworkCacheStats.thumbnails_cache_bytes ?? 0) === 0 && (artworkCacheStats.artwork_cache_bytes ?? 0) === 0)}
> >
{isClearingArtwork ? $t('settings.storage.clearing') : $t('actions.clear')} {isClearingArtwork ? $t('settings.storage.clearing') : $t('actions.clear')}
</button> </button>
@@ -2571,11 +2579,11 @@
<div class="setting-info"> <div class="setting-info">
<span class="setting-label">Clear All Caches</span> <span class="setting-label">Clear All Caches</span>
<small class="setting-note"> <small class="setting-note">
Clears all cached data above (queue, lyrics, metadata, vectors, artwork) Clears all cached data above
</small> </small>
</div> </div>
<button <button
class="clear-btn danger" class="clear-btn"
onclick={handleClearAllCaches} onclick={handleClearAllCaches}
disabled={isClearingAllCaches} disabled={isClearingAllCaches}
> >
@@ -3089,17 +3097,6 @@ flatpak override --user --filesystem=/home/USUARIO/Música com.blitzfc.qbz</pre>
cursor: not-allowed; cursor: not-allowed;
} }
.clear-btn.danger {
background: #ff6b6b;
color: white;
border-color: #ff6b6b;
}
.clear-btn.danger:hover:not(:disabled) {
background: #ff5252;
border-color: #ff5252;
}
.folder-btn { .folder-btn {
display: flex; display: flex;
align-items: center; align-items: center;