mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-15 17:55:08 +01:00
Added country to regions display.
This commit is contained in:
parent
69b9458975
commit
e6c5a9b17d
@ -3,19 +3,25 @@ import { emptyFilter } from 'lib/filters';
|
|||||||
import FilterLink from 'components/common/FilterLink';
|
import FilterLink from 'components/common/FilterLink';
|
||||||
import useLocale from 'hooks/useLocale';
|
import useLocale from 'hooks/useLocale';
|
||||||
import useMessages from 'hooks/useMessages';
|
import useMessages from 'hooks/useMessages';
|
||||||
|
import useCountryNames from 'hooks/useCountryNames';
|
||||||
import regions from 'public/iso-3166-2.json';
|
import regions from 'public/iso-3166-2.json';
|
||||||
|
|
||||||
export function RegionsTable({ websiteId, ...props }) {
|
export function RegionsTable({ websiteId, ...props }) {
|
||||||
const { locale } = useLocale();
|
const { locale } = useLocale();
|
||||||
const { formatMessage, labels } = useMessages();
|
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 (
|
||||||
<div className={locale}>
|
<div className={locale}>
|
||||||
<FilterLink id="region" value={x} label={regions[x] || x} />
|
<FilterLink id="region" value={x} label={renderLabel(x)} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MetricsTable
|
<MetricsTable
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user