mirror of
https://github.com/kremalicious/umami.git
synced 2025-02-14 21:10:34 +01:00
Merge pull request #3060 from eremannisto/improve-handling-of-undefined-regions
Use `unknown` label for `undefined` countries
This commit is contained in:
commit
cd72fcacf4
@ -28,6 +28,7 @@ export function WorldMap({
|
|||||||
const { formatMessage, labels } = useMessages();
|
const { formatMessage, labels } = useMessages();
|
||||||
const { countryNames } = useCountryNames(locale);
|
const { countryNames } = useCountryNames(locale);
|
||||||
const visitorsLabel = formatMessage(labels.visitors).toLocaleLowerCase(locale);
|
const visitorsLabel = formatMessage(labels.visitors).toLocaleLowerCase(locale);
|
||||||
|
const unknownLabel = formatMessage(labels.unknown);
|
||||||
const {
|
const {
|
||||||
dateRange: { startDate, endDate },
|
dateRange: { startDate, endDate },
|
||||||
} = useDateRange(websiteId);
|
} = useDateRange(websiteId);
|
||||||
@ -62,7 +63,9 @@ export function WorldMap({
|
|||||||
if (code === 'AQ') return;
|
if (code === 'AQ') return;
|
||||||
const country = metrics?.find(({ x }) => x === code);
|
const country = metrics?.find(({ x }) => x === code);
|
||||||
setTooltipPopup(
|
setTooltipPopup(
|
||||||
`${countryNames[code]}: ${formatLongNumber(country?.y || 0)} ${visitorsLabel}` as any,
|
`${countryNames[code] || unknownLabel}: ${formatLongNumber(
|
||||||
|
country?.y || 0,
|
||||||
|
)} ${visitorsLabel}` as any,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user