From 1c586aa7dc60cc4669e7fe0cd1f7d46793f15b63 Mon Sep 17 00:00:00 2001 From: Ike Saunders Date: Tue, 13 Feb 2024 10:24:24 -0500 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=8E=89=20add=20tag=20icons?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/images/tag-icons/Age Structure.svg | 1 + public/images/tag-icons/Animal Welfare.svg | 1 + public/images/tag-icons/CO2 & Greenhouse Gas Emissions.svg | 1 + public/images/tag-icons/COVID-19.svg | 1 + public/images/tag-icons/Cardiovascular Diseases.svg | 1 + public/images/tag-icons/Economic Growth.svg | 1 + public/images/tag-icons/Energy.svg | 1 + public/images/tag-icons/Global Health.svg | 1 + public/images/tag-icons/Life Expectancy.svg | 1 + public/images/tag-icons/Mental Health.svg | 1 + public/images/tag-icons/Pandemics.svg | 1 + public/images/tag-icons/Plastic Pollution.svg | 1 + public/images/tag-icons/Population.svg | 1 + public/images/tag-icons/Poverty.svg | 1 + public/images/tag-icons/Space Exploration & Satellites.svg | 1 + public/images/tag-icons/Terrorism.svg | 1 + public/images/tag-icons/Tuberculosis.svg | 1 + 17 files changed, 17 insertions(+) create mode 100644 public/images/tag-icons/Age Structure.svg create mode 100644 public/images/tag-icons/Animal Welfare.svg create mode 100644 public/images/tag-icons/CO2 & Greenhouse Gas Emissions.svg create mode 100644 public/images/tag-icons/COVID-19.svg create mode 100644 public/images/tag-icons/Cardiovascular Diseases.svg create mode 100644 public/images/tag-icons/Economic Growth.svg create mode 100644 public/images/tag-icons/Energy.svg create mode 100644 public/images/tag-icons/Global Health.svg create mode 100644 public/images/tag-icons/Life Expectancy.svg create mode 100644 public/images/tag-icons/Mental Health.svg create mode 100644 public/images/tag-icons/Pandemics.svg create mode 100644 public/images/tag-icons/Plastic Pollution.svg create mode 100644 public/images/tag-icons/Population.svg create mode 100644 public/images/tag-icons/Poverty.svg create mode 100644 public/images/tag-icons/Space Exploration & Satellites.svg create mode 100644 public/images/tag-icons/Terrorism.svg create mode 100644 public/images/tag-icons/Tuberculosis.svg diff --git a/public/images/tag-icons/Age Structure.svg b/public/images/tag-icons/Age Structure.svg new file mode 100644 index 00000000000..016eb0935c7 --- /dev/null +++ b/public/images/tag-icons/Age Structure.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/images/tag-icons/Animal Welfare.svg b/public/images/tag-icons/Animal Welfare.svg new file mode 100644 index 00000000000..07fff56647b --- /dev/null +++ b/public/images/tag-icons/Animal Welfare.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/images/tag-icons/CO2 & Greenhouse Gas Emissions.svg b/public/images/tag-icons/CO2 & Greenhouse Gas Emissions.svg new file mode 100644 index 00000000000..bd30d636d31 --- /dev/null +++ b/public/images/tag-icons/CO2 & Greenhouse Gas Emissions.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/images/tag-icons/COVID-19.svg b/public/images/tag-icons/COVID-19.svg new file mode 100644 index 00000000000..bbc6f660ac6 --- /dev/null +++ b/public/images/tag-icons/COVID-19.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/images/tag-icons/Cardiovascular Diseases.svg b/public/images/tag-icons/Cardiovascular Diseases.svg new file mode 100644 index 00000000000..3b480dfddd0 --- /dev/null +++ b/public/images/tag-icons/Cardiovascular Diseases.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/images/tag-icons/Economic Growth.svg b/public/images/tag-icons/Economic Growth.svg new file mode 100644 index 00000000000..133b43fca93 --- /dev/null +++ b/public/images/tag-icons/Economic Growth.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/images/tag-icons/Energy.svg b/public/images/tag-icons/Energy.svg new file mode 100644 index 00000000000..ed866762a8a --- /dev/null +++ b/public/images/tag-icons/Energy.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/images/tag-icons/Global Health.svg b/public/images/tag-icons/Global Health.svg new file mode 100644 index 00000000000..e6925c1d627 --- /dev/null +++ b/public/images/tag-icons/Global Health.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/images/tag-icons/Life Expectancy.svg b/public/images/tag-icons/Life Expectancy.svg new file mode 100644 index 00000000000..0c8706d0166 --- /dev/null +++ b/public/images/tag-icons/Life Expectancy.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/images/tag-icons/Mental Health.svg b/public/images/tag-icons/Mental Health.svg new file mode 100644 index 00000000000..4c0249d2b39 --- /dev/null +++ b/public/images/tag-icons/Mental Health.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/images/tag-icons/Pandemics.svg b/public/images/tag-icons/Pandemics.svg new file mode 100644 index 00000000000..3c3ebe1c424 --- /dev/null +++ b/public/images/tag-icons/Pandemics.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/images/tag-icons/Plastic Pollution.svg b/public/images/tag-icons/Plastic Pollution.svg new file mode 100644 index 00000000000..9a2e0314e04 --- /dev/null +++ b/public/images/tag-icons/Plastic Pollution.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/images/tag-icons/Population.svg b/public/images/tag-icons/Population.svg new file mode 100644 index 00000000000..9ae5c4efab3 --- /dev/null +++ b/public/images/tag-icons/Population.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/images/tag-icons/Poverty.svg b/public/images/tag-icons/Poverty.svg new file mode 100644 index 00000000000..6a526632d08 --- /dev/null +++ b/public/images/tag-icons/Poverty.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/images/tag-icons/Space Exploration & Satellites.svg b/public/images/tag-icons/Space Exploration & Satellites.svg new file mode 100644 index 00000000000..bce5cdb0e17 --- /dev/null +++ b/public/images/tag-icons/Space Exploration & Satellites.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/images/tag-icons/Terrorism.svg b/public/images/tag-icons/Terrorism.svg new file mode 100644 index 00000000000..fe1c25de8fd --- /dev/null +++ b/public/images/tag-icons/Terrorism.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/images/tag-icons/Tuberculosis.svg b/public/images/tag-icons/Tuberculosis.svg new file mode 100644 index 00000000000..11574cbb6c3 --- /dev/null +++ b/public/images/tag-icons/Tuberculosis.svg @@ -0,0 +1 @@ + \ No newline at end of file From c30fa744001317e089d258b47dc690ece5fcf5e5 Mon Sep 17 00:00:00 2001 From: Ike Saunders Date: Tue, 13 Feb 2024 10:47:12 -0500 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=8E=89=20validate=20tag=20icons=20dur?= =?UTF-8?q?ing=20bake?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- baker/SiteBaker.tsx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/baker/SiteBaker.tsx b/baker/SiteBaker.tsx index 60c6a3f5086..0d69c2d59ca 100644 --- a/baker/SiteBaker.tsx +++ b/baker/SiteBaker.tsx @@ -779,6 +779,25 @@ export class SiteBaker { this.progressBar.tick({ name: "✅ baked google drive images" }) } + // Make sure that our tag icons don't have typos, nor reference tags that have been renamed + // We want to be sure that if we have a tag name, we'll be able to load its icon like so: + // + private async validateTagIcons() { + const allTags = await db + .knexTable("tags") + .select<{ name: string }[]>("name") + const tagNames = new Set(allTags.map((tag) => tag.name)) + const tagIcons = await fs.readdir("public/images/tag-icons") + for (const icon of tagIcons) { + const iconName = icon.split(".")[0] + if (!tagNames.has(iconName)) { + logErrorAndMaybeSendToBugsnag( + `Tag icon "${icon}" does not have a corresponding tag in the database.` + ) + } + } + } + // Bake the static assets private async bakeAssets() { if (!this.bakeSteps.has("assets")) return @@ -793,6 +812,7 @@ export class SiteBaker { await execWrapper( `rm -rf ${this.bakedSiteDir}/assets && cp -r ${BASE_DIR}/dist/assets ${this.bakedSiteDir}/assets` ) + await this.validateTagIcons() await execWrapper( `rsync -hav --delete ${BASE_DIR}/public/* ${this.bakedSiteDir}/ ${excludes}` ) From ca6cd14facdb04d5768a872fc345e6d742f57a2d Mon Sep 17 00:00:00 2001 From: Ike Saunders Date: Wed, 14 Feb 2024 12:05:29 -0500 Subject: [PATCH 3/3] =?UTF-8?q?=E2=9C=A8=20improve=20tag-icon=20validation?= =?UTF-8?q?=20comment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- baker/SiteBaker.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/baker/SiteBaker.tsx b/baker/SiteBaker.tsx index 0d69c2d59ca..eaa194b7fee 100644 --- a/baker/SiteBaker.tsx +++ b/baker/SiteBaker.tsx @@ -779,9 +779,8 @@ export class SiteBaker { this.progressBar.tick({ name: "✅ baked google drive images" }) } - // Make sure that our tag icons don't have typos, nor reference tags that have been renamed - // We want to be sure that if we have a tag name, we'll be able to load its icon like so: - // + // We don't have an icon for every single tag (yet), but for the icons that we *do* have, + // we want to make sure that we have a corresponding tag in the database. private async validateTagIcons() { const allTags = await db .knexTable("tags")