mirror of
https://github.com/kremalicious/umami.git
synced 2024-12-18 15:23:38 +01:00
Use datamaps world map instead of world-110m
This commit is contained in:
parent
94af336388
commit
edc3251966
@ -4,17 +4,14 @@ import ReactTooltip from 'react-tooltip';
|
|||||||
import { ComposableMap, Geographies, Geography, ZoomableGroup } from 'react-simple-maps';
|
import { ComposableMap, Geographies, Geography, ZoomableGroup } from 'react-simple-maps';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import tinycolor from 'tinycolor2';
|
import tinycolor from 'tinycolor2';
|
||||||
|
import Datamap from 'datamaps';
|
||||||
import useTheme from 'hooks/useTheme';
|
import useTheme from 'hooks/useTheme';
|
||||||
import { THEME_COLORS } from 'lib/constants';
|
import { THEME_COLORS } from 'lib/constants';
|
||||||
import styles from './WorldMap.module.css';
|
import styles from './WorldMap.module.css';
|
||||||
import useCountryNames from 'hooks/useCountryNames';
|
import useCountryNames from 'hooks/useCountryNames';
|
||||||
import useLocale from 'hooks/useLocale';
|
import useLocale from 'hooks/useLocale';
|
||||||
import { useRouter } from 'next/router';
|
|
||||||
|
|
||||||
const geoUrl = '/world-110m.json';
|
|
||||||
|
|
||||||
function WorldMap({ data, className }) {
|
function WorldMap({ data, className }) {
|
||||||
const { basePath } = useRouter();
|
|
||||||
const [tooltip, setTooltip] = useState();
|
const [tooltip, setTooltip] = useState();
|
||||||
const [theme] = useTheme();
|
const [theme] = useTheme();
|
||||||
const colors = useMemo(
|
const colors = useMemo(
|
||||||
@ -60,7 +57,7 @@ function WorldMap({ data, className }) {
|
|||||||
>
|
>
|
||||||
<ComposableMap projection="geoMercator">
|
<ComposableMap projection="geoMercator">
|
||||||
<ZoomableGroup zoom={0.8} minZoom={0.7} center={[0, 40]}>
|
<ZoomableGroup zoom={0.8} minZoom={0.7} center={[0, 40]}>
|
||||||
<Geographies geography={`${basePath}${geoUrl}`}>
|
<Geographies geography={Datamap.prototype.worldTopo}>
|
||||||
{({ geographies }) => {
|
{({ geographies }) => {
|
||||||
return geographies.map(geo => {
|
return geographies.map(geo => {
|
||||||
const code = geo.properties.ISO_A2;
|
const code = geo.properties.ISO_A2;
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user