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.

fix formatvalue for city showing undefined

Francis Cao8f2fac10d10d
diff --git a/src/components/hooks/useFormat.ts b/src/components/hooks/useFormat.ts
index 06585e497..3057e9d87 100644
--- a/src/components/hooks/useFormat.ts
+++ b/src/components/hooks/useFormat.ts
@@ -2,7 +2,7 @@ import useMessages from './useMessages';
import { BROWSERS } from 'lib/constants';
import useLocale from './useLocale';
import useCountryNames from './useCountryNames';
-import regions from 'public/iso-3166-2.json';
+import regions from '../../../public/iso-3166-2.json';
export function useFormat() {
const { formatMessage, labels } = useMessages();
@@ -23,7 +23,7 @@ export function useFormat() {
};
const formatCity = (value: string, country?: string): string => {
- return `${value}, ${countryNames[country]}`;
+ return countryNames[country] ? `${value}, ${countryNames[country]}` : value;
};
const formatDevice = (value: string): string => {
diff --git a/src/components/metrics/RegionsTable.tsx b/src/components/metrics/RegionsTable.tsx
index 187e3768d..ee95d58eb 100644
--- a/src/components/metrics/RegionsTable.tsx
+++ b/src/components/metrics/RegionsTable.tsx
@@ -4,7 +4,7 @@ import useLocale from 'components/hooks/useLocale';
import useMessages from 'components/hooks/useMessages';
import useCountryNames from 'components/hooks/useCountryNames';
import MetricsTable, { MetricsTableProps } from './MetricsTable';
-import regions from 'public/iso-3166-2.json';
+import regions from '../../../public/iso-3166-2.json';
export function RegionsTable(props: MetricsTableProps) {
const { locale } = useLocale();