From e6c5a9b17dd763953edef8c8b2ddbcd84a81d141 Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Fri, 21 Apr 2023 14:35:00 -0700 Subject: [PATCH] Added country to regions display. --- components/metrics/RegionsTable.js | 12 +- public/iso-3166-2.json | 7165 ++++++++++++++-------------- 2 files changed, 3625 insertions(+), 3552 deletions(-) diff --git a/components/metrics/RegionsTable.js b/components/metrics/RegionsTable.js index b94ae5cc..fe4d5b91 100644 --- a/components/metrics/RegionsTable.js +++ b/components/metrics/RegionsTable.js @@ -3,19 +3,25 @@ import { emptyFilter } from 'lib/filters'; import FilterLink from 'components/common/FilterLink'; import useLocale from 'hooks/useLocale'; import useMessages from 'hooks/useMessages'; +import useCountryNames from 'hooks/useCountryNames'; import regions from 'public/iso-3166-2.json'; export function RegionsTable({ websiteId, ...props }) { const { locale } = useLocale(); const { formatMessage, labels } = useMessages(); + const countryNames = useCountryNames(locale); - function renderLink({ x }) { + const renderLabel = x => { + return regions[x] ? `${regions[x]}, ${countryNames[x.split('-')[0]]}` : x; + }; + + const renderLink = ({ x }) => { return (
- +
); - } + }; return (