Added country to regions display.

This commit is contained in:
Mike Cao 2023-04-21 14:35:00 -07:00
parent 69b9458975
commit e6c5a9b17d
2 changed files with 3625 additions and 3552 deletions

View File

@ -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 (
<div className={locale}>
<FilterLink id="region" value={x} label={regions[x] || x} />
<FilterLink id="region" value={x} label={renderLabel(x)} />
</div>
);
}
};
return (
<MetricsTable

View File

@ -267,6 +267,8 @@
"BD-63": "Tangail",
"BD-64": "Thakurgaon",
"BE-BRU": "Brussels Hoofdstedelijk Gewest",
"BE-VLG": "Vlaams Gewest",
"BE-WAL": "Waals Gewest",
"BE-VAN": "Antwerpen",
"BE-VBR": "Vlaams-Brabant",
"BE-VLI": "Limburg",
@ -723,6 +725,7 @@
"DO-04": "Barahona",
"DO-05": "Dajabon",
"DO-06": "Duarte",
"DO-07": "Elías Piña",
"DO-08": "El Seibo",
"DO-09": "Espaillat",
"DO-10": "Independencia",
@ -747,6 +750,17 @@
"DO-29": "Monte Plata",
"DO-30": "Hato Mayor",
"DO-31": "San Jose de Ocoa",
"DO-32": "Santo Domingo",
"DO-33": "Cibao Nordeste",
"DO-34": "Cibao Noroeste",
"DO-35": "Cibao Norte",
"DO-36": "Cibao Sur",
"DO-37": "El Valle",
"DO-38": "Enriquillo",
"DO-39": "Higuamo",
"DO-40": "Ozama",
"DO-41": "Valdesia",
"DO-42": "Yuma",
"DZ-01": "Adrar",
"DZ-02": "Chlef",
"DZ-03": "Laghouat",
@ -938,6 +952,7 @@
"FR-OCC": "Occitanie",
"FR-PAC": "Provence-Alpes-Cote-d'Azur",
"FR-PDL": "Pays-de-la-Loire",
"FR-PM": "Saint Pierre and Miquelon",
"GA-1": "Estuaire",
"GA-2": "Haut-Ogooue",
"GA-3": "Moyen-Ogooue",
@ -1045,6 +1060,28 @@
"GT-20": "Chiquimula",
"GT-21": "Jalapa",
"GT-22": "Jutiapa",
"GT-AV": "Alta Verapaz",
"GT-BV": "Baja Verapaz",
"GT-CM": "Chimaltenango",
"GT-CQ": "Chiquimula",
"GT-PR": "El Progreso",
"GT-ES": "Escuintla",
"GT-GU": "Guatemala Department",
"GT-HU": "Huehuetenango",
"GT-IZ": "Izabal",
"GT-JA": "Jalapa",
"GT-JU": "Jutiapa",
"GT-PE": "Petén",
"GT-QZ": "Quetzaltenango",
"GT-QC": "Quiché",
"GT-RE": "Retalhuleu",
"GT-SA": "Sacatepéquez",
"GT-SM": "San Marcos",
"GT-SR": "Santa Rosa",
"GT-SO": "Sololá",
"GT-SU": "Suchitepéquez",
"GT-TO": "Totonicapán",
"GT-ZA": "Zacapa",
"GW-BA": "Bafata",
"GW-BS": "Bissau",
"GW-GA": "Gabu",
@ -1057,6 +1094,24 @@
"GY-MA": "Mahaica-Berbice",
"GY-PT": "Potaro-Siparuni",
"GY-UD": "Upper Demerara-Berbice",
"HK-HCW": "Central and Western",
"HK-HEA": "Eastern",
"HK-HSO": "Southern",
"HK-HWC": "Wan Chai",
"HK-KKC": "Kowloon City",
"HK-KKT": "Kwun Tong",
"HK-KSS": "Sham Shui Po",
"HK-KWT": "Wong Tai Sin",
"HK-KYT": "Yau Tsim Mong",
"HK-NIS": "Islands",
"HK-NKT": "Kwai Tsing",
"HK-NNO": "North",
"HK-NSK": "Sai Kung",
"HK-NST": "Sha Tin",
"HK-NTM": "Tuen Mun",
"HK-NTP": "Tai Po",
"HK-NTW": "Tsuen Wan",
"HK-NYL": "Yuen Long",
"HN-AT": "Atlantida",
"HN-CH": "Choluteca",
"HN-CL": "Colon",
@ -1162,6 +1217,10 @@
"ID-ST": "Sulawesi Tengah",
"ID-SU": "Sumatera Utara",
"ID-YO": "Yogyakarta",
"IE-C": "Connaught",
"IE-L": "Leinster",
"IE-M": "Munster",
"IE-U": "Ulster",
"IE-CE": "Clare",
"IE-CN": "Cavan",
"IE-CO": "Cork",
@ -2193,6 +2252,7 @@
"PE-LAL": "La Libertad",
"PE-LAM": "Lambayeque",
"PE-LIM": "Lima",
"PE-LMA": "Municipalidad Metropolitana de Lima",
"PE-LOR": "Loreto",
"PE-MDD": "Madre de Dios",
"PE-MOQ": "Moquegua",
@ -2203,6 +2263,11 @@
"PE-TAC": "Tacna",
"PE-TUM": "Tumbes",
"PE-UCA": "Ucayali",
"PF-A": "Austral Islands",
"PF-M": "Marquesas Islands",
"PF-S": "Society Islands",
"PF-T": "Tuamotu and Gambier Islands",
"PF-V": "Windward Islands",
"PG-CPK": "Chimbu",
"PG-CPM": "Central",
"PG-EBR": "East New Britain",
@ -2340,6 +2405,8 @@
"PL-28": "Warminsko-mazurskie",
"PL-30": "Wielkopolskie",
"PL-32": "Zachodniopomorskie",
"PM-P": "Saint-Pierre",
"PM-M": "Miquelon-Langlade",
"PS-BTH": "Bethlehem",
"PS-DEB": "Deir El Balah",
"PS-GZA": "Gaza",