fix: Update collection label retrieval to support titles and improve SVG error handling

This commit is contained in:
sha
2025-06-18 16:49:05 +03:00
parent 5baa4bfab4
commit 83dd8245a8
2 changed files with 106 additions and 93 deletions
+5 -3
View File
@@ -45,7 +45,8 @@
dropdownOpen = false;
}
$: currentLabel = (collections.find(c => c.name === collection)?.label || "Logo Gallery").replace(/s$/, "");
$: currentCollectionObj = collections.find(c => c.name === collection);
$: currentLabel = (currentCollectionObj?.title || currentCollectionObj?.label || "Logo Gallery").replace(/s$/, "");
</script>
<header class="main-header">
@@ -55,7 +56,7 @@
<img src="favicon.svg" alt="Logo Gallery icon" />
</div>
<button class="collection-title-btn" on:click={handleTitleClick} aria-haspopup="listbox" aria-expanded={dropdownOpen}>
{currentLabel} Gallery <span class="triangle"></span>
{currentLabel} <span class="triangle"></span>
</button>
{#if dropdownOpen}
<ul class="collection-dropdown" role="listbox">
@@ -72,7 +73,7 @@
handleCollectionSelect(c.name);
}
}}
>{c.label} Gallery</li>
>{c.title} Gallery</li>
{/each}
</ul>
{/if}
@@ -107,6 +108,7 @@
{getTagObj}
{compactMode}
{setCompactMode}
collection={currentCollectionObj}
/>
<ListViewSwitcher
{viewMode}