Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

Added fallback in case country code not found.

Mike Caob6f3f57455d9
diff --git a/components/metrics/CountriesTable.js b/components/metrics/CountriesTable.js
index 6dfb91958..2d7b5ceb8 100644
--- a/components/metrics/CountriesTable.js
+++ b/components/metrics/CountriesTable.js
@@ -17,7 +17,7 @@ export function CountriesTable({ websiteId, ...props }) {
value={countryNames[code] && code}
label={countryNames[code]}
>
- <img src={`/images/flags/${code.toLowerCase()}.png`} alt={code} />
+ <img src={`/images/flags/${code?.toLowerCase() || 'xx'}.png`} alt={code} />
</FilterLink>
);
}
diff --git a/components/metrics/RegionsTable.js b/components/metrics/RegionsTable.js
index 83296d97a..c8e0b7686 100644
--- a/components/metrics/RegionsTable.js
+++ b/components/metrics/RegionsTable.js
@@ -18,7 +18,7 @@ export function RegionsTable({ websiteId, ...props }) {
const renderLink = ({ x: code }) => {
return (
<FilterLink id="region" className={locale} value={code} label={renderLabel(code)}>
- <img src={`/images/flags/${code.split('-')[0].toLowerCase()}.png`} alt={code} />
+ <img src={`/images/flags/${code?.split('-')?.[0]?.toLowerCase() || 'xx'}.png`} alt={code} />
</FilterLink>
);
};
diff --git a/public/images/flags/xx.png b/public/images/flags/xx.png
new file mode 100644
index 000000000..520580267
Binary files /dev/null and b/public/images/flags/xx.png differ