mirror of
https://github.com/shadoll/sLogos.git
synced 2026-02-04 11:03:24 +00:00
feat: add Armenian flag SVG and update existing flag SVGs
- Added a new SVG file for the Armenian flag (am-1952–1990.svg). - Updated the existing Armenian flag SVG (am.svg) to use a new structure and color scheme. - Refactored logo loading logic in App.svelte to reset filters and state when loading a new collection. - Simplified PNG and JPG download functions in Actions.svelte to directly use collection variable directory. - Enhanced SVG source fetching in CardFull.svelte to utilize a helper function for image URL generation.
This commit is contained in:
@@ -50,23 +50,39 @@
|
||||
console.log("loadCollectionData: fetch status", response.status);
|
||||
if (response.ok) {
|
||||
logos = await response.json();
|
||||
console.log("loadCollectionData: loaded", logos.length, "items for", collection);
|
||||
logos = [...logos]; // trigger reactivity
|
||||
// Only use the current collection's data
|
||||
allTags = [];
|
||||
selectedTags = [];
|
||||
selectedBrands = [];
|
||||
selectedVariants = [];
|
||||
filteredLogos = logos;
|
||||
displayLogos = logos;
|
||||
// Reset filters and state for new collection
|
||||
searchQuery = "";
|
||||
tagDropdownOpen = false;
|
||||
compactMode = false;
|
||||
} else {
|
||||
logos = [];
|
||||
filteredLogos = [];
|
||||
displayLogos = [];
|
||||
allTags = [];
|
||||
selectedTags = [];
|
||||
selectedBrands = [];
|
||||
selectedVariants = [];
|
||||
tagDropdownOpen = false;
|
||||
compactMode = false;
|
||||
} else {
|
||||
logos = [];
|
||||
console.log("loadCollectionData: failed to load data for", collection);
|
||||
}
|
||||
} catch (error) {
|
||||
logos = [];
|
||||
filteredLogos = [];
|
||||
displayLogos = [];
|
||||
allTags = [];
|
||||
selectedTags = [];
|
||||
selectedBrands = [];
|
||||
selectedVariants = [];
|
||||
tagDropdownOpen = false;
|
||||
compactMode = false;
|
||||
console.error("loadCollectionData: error loading data for", collection, error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,8 +182,7 @@
|
||||
// Download PNG using the same logic as JPG
|
||||
async function handleDownloadPngClick(e) {
|
||||
e.stopPropagation();
|
||||
const varDir = getVarDir(logo);
|
||||
const pngUrl = `/${varDir}/${getBaseName(logo.path)}.png`;
|
||||
const pngUrl = `/${collection.varDir}/${getBaseName(logo.path)}.png`;
|
||||
try {
|
||||
const res = await fetch(pngUrl, { method: 'HEAD' });
|
||||
if (res.ok) {
|
||||
@@ -215,8 +214,7 @@
|
||||
}
|
||||
|
||||
async function downloadJpg(logo) {
|
||||
const varDir = getVarDir(logo);
|
||||
const jpgUrl = `/${varDir}/${getBaseName(logo.path)}.jpg`;
|
||||
const jpgUrl = `/${collection.varDir}/${getBaseName(logo.path)}.jpg`;
|
||||
try {
|
||||
const res = await fetch(jpgUrl, { method: 'HEAD' });
|
||||
if (res.ok) {
|
||||
@@ -265,6 +263,10 @@
|
||||
console.error('Error copying SVG source:', err);
|
||||
}
|
||||
}
|
||||
|
||||
function getBaseName(filename) {
|
||||
return filename.replace(/^.*[\\/]/, '').replace(/\.[^/.]+$/, '');
|
||||
}
|
||||
</script>
|
||||
|
||||
<span class="action-group">
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
$: if (show && logo) {
|
||||
if (logo.format === "SVG" && !svgSource) {
|
||||
isFetchingSvgSource = true;
|
||||
fetchSvgSource(logo.path)
|
||||
fetchSvgSource(getImageUrl(logo))
|
||||
.then((source) => {
|
||||
svgSource = source;
|
||||
isFetchingSvgSource = false;
|
||||
|
||||
Reference in New Issue
Block a user