From 5baa4bfab4d9ffe9c646a0882a4af20bc10a99b2 Mon Sep 17 00:00:00 2001 From: sHa Date: Wed, 18 Jun 2025 14:55:13 +0300 Subject: [PATCH] Add titles to collections and update image URL resolution in components - Added 'title' property to collections for 'Logos', 'Flags', and 'Emblems'. - Updated image URL generation in CardMiddle, CardSmall, and CardTiny components to dynamically resolve the current collection based on window.appData. --- public/data/emblems.json | 2 +- .../emblems/{Escudo_de_España.svg => Escudo_de_Espana.svg} | 0 src/collections.js | 3 +++ src/components/CardMiddle.svelte | 7 ++++++- src/components/CardSmall.svelte | 7 ++++++- src/components/CardTiny.svelte | 7 ++++++- 6 files changed, 22 insertions(+), 4 deletions(-) rename public/images/emblems/{Escudo_de_España.svg => Escudo_de_Espana.svg} (100%) diff --git a/public/data/emblems.json b/public/data/emblems.json index 87ebc68..6608b11 100644 --- a/public/data/emblems.json +++ b/public/data/emblems.json @@ -1,7 +1,7 @@ [ { "name": "Escudo De España", - "path": "Escudo_de_España.svg", + "path": "Escudo_de_Espana.svg", "format": "SVG", "disable": false, "tags": [ diff --git a/public/images/emblems/Escudo_de_España.svg b/public/images/emblems/Escudo_de_Espana.svg similarity index 100% rename from public/images/emblems/Escudo_de_España.svg rename to public/images/emblems/Escudo_de_Espana.svg diff --git a/src/collections.js b/src/collections.js index a3fb397..27d2f57 100644 --- a/src/collections.js +++ b/src/collections.js @@ -3,6 +3,7 @@ export const collections = [ { name: 'logos', label: 'Logos', + title: 'Logo Gallery', baseDir: 'images/logos', varDir: 'images/logos_variants', dataFile: 'data/logos.json' @@ -10,6 +11,7 @@ export const collections = [ { name: 'flags', label: 'Flags', + title: 'Flag Gallery', baseDir: 'images/flags', varDir: 'images/flags_variants', dataFile: 'data/flags.json' @@ -17,6 +19,7 @@ export const collections = [ { name: 'emblems', label: 'Emblems', + title: 'Emblem Gallery', baseDir: 'images/emblems', varDir: 'images/emblems_variants', dataFile: 'data/emblems.json' diff --git a/src/components/CardMiddle.svelte b/src/components/CardMiddle.svelte index b7a9ace..130e083 100644 --- a/src/components/CardMiddle.svelte +++ b/src/components/CardMiddle.svelte @@ -41,7 +41,12 @@ } } function getImageUrl(logo) { - return `/${collection.baseDir}/${logo.path}`; + // Always resolve collection for each logo based on current collection name + let currentCollection = collection; + if (typeof window !== 'undefined' && window.appData && window.appData.collection) { + currentCollection = collections.find(c => c.name === window.appData.collection) || collections[0]; + } + return `/${currentCollection.baseDir}/${logo.path}`; } $: getLogoThemeColor = (logo) => getDefaultLogoColor(logo.colors, theme); diff --git a/src/components/CardSmall.svelte b/src/components/CardSmall.svelte index 9e9b2a2..a4611fa 100644 --- a/src/components/CardSmall.svelte +++ b/src/components/CardSmall.svelte @@ -44,7 +44,12 @@ } } function getImageUrl(logo) { - return `/${collection.baseDir}/${logo.path}`; + // Always resolve collection for each logo based on current collection name + let currentCollection = collection; + if (typeof window !== 'undefined' && window.appData && window.appData.collection) { + currentCollection = collections.find(c => c.name === window.appData.collection) || collections[0]; + } + return `/${currentCollection.baseDir}/${logo.path}`; } diff --git a/src/components/CardTiny.svelte b/src/components/CardTiny.svelte index 5c8dc6d..66aabfb 100644 --- a/src/components/CardTiny.svelte +++ b/src/components/CardTiny.svelte @@ -50,7 +50,12 @@ } } function getImageUrl(logo) { - return `/${collection.baseDir}/${logo.path}`; + // Always resolve collection for each logo based on current collection name + let currentCollection = collection; + if (typeof window !== 'undefined' && window.appData && window.appData.collection) { + currentCollection = collections.find(c => c.name === window.appData.collection) || collections[0]; + } + return `/${currentCollection.baseDir}/${logo.path}`; }