@@ -2,9 +2,10 @@ import React, { useMemo } from 'react';
22import { AppRouterOutput } from '../../../api/trpc' ;
33import { MapContainer , CircleMarker , Popup , TileLayer } from 'react-leaflet' ;
44import { mapCenter } from './utils' ;
5+ import { useTranslation } from '@i18next-toolkit/react' ;
6+ import { useTheme } from '@/store/settings' ;
57import 'leaflet/dist/leaflet.css' ;
68import './VisitorLeafletMap.css' ;
7- import { useTranslation } from '@i18next-toolkit/react' ;
89
910export const UserDataPoint : React . FC < {
1011 pointRadius ?: number ;
@@ -40,6 +41,7 @@ UserDataPoint.displayName = 'UserDataPoint';
4041export const VisitorLeafletMap : React . FC < {
4142 data : AppRouterOutput [ 'website' ] [ 'geoStats' ] ;
4243} > = React . memo ( ( props ) => {
44+ const theme = useTheme ( ) ;
4345 const pointRadius = useMemo ( ( ) => {
4446 if ( props . data . length > 20000 ) {
4547 return 1 ;
@@ -65,7 +67,13 @@ export const VisitorLeafletMap: React.FC<{
6567 maxZoom = { 10 }
6668 scrollWheelZoom = { true }
6769 >
68- < TileLayer url = "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" />
70+ { /* <TileLayer url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" /> */ }
71+
72+ { theme === 'light' ? (
73+ < TileLayer url = "https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png" />
74+ ) : (
75+ < TileLayer url = "https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png" />
76+ ) }
6977
7078 { props . data . map ( ( item ) => (
7179 < UserDataPoint
0 commit comments