Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions desktop/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -3023,6 +3023,39 @@ input:not([type]) {
box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15);
}

.observations-overview-map-cluster {
display: grid;
place-items: center;
border-radius: 999px;
background: rgba(255, 255, 255, 0.78);
box-shadow:
0 1px 4px rgba(0, 0, 0, 0.5),
0 0 0 1px rgba(13, 20, 36, 0.55);
}

.observations-overview-map-cluster span {
display: grid;
width: calc(100% - 6px);
height: calc(100% - 6px);
place-items: center;
border-radius: inherit;
background: #243a73;
color: #fff;
font-size: 0.75rem;
font-weight: 700;
font-variant-numeric: tabular-nums;
line-height: 1;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.45);
}

.observations-overview-map-cluster--medium span {
font-size: 0.8rem;
}

.observations-overview-map-cluster--large span {
font-size: 0.85rem;
}

.observations-overview-totals-row th,
.observations-overview-totals-row td {
font-weight: 600;
Expand Down
12 changes: 11 additions & 1 deletion desktop/src/components/ObservationMapChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { useEffect, useMemo } from 'react';
import L from 'leaflet';
import 'leaflet/dist/leaflet.css';
import 'leaflet.markercluster/dist/MarkerCluster.css';
import 'leaflet.markercluster/dist/MarkerCluster.Default.css';
import 'leaflet.markercluster';
import { MapContainer, TileLayer, useMap } from 'react-leaflet';
import {
Expand Down Expand Up @@ -57,6 +56,17 @@ function MapMarkers({ points }: { points: ObservationMapPoint[] }) {
const group = L.markerClusterGroup({
maxClusterRadius: 48,
showCoverageOnHover: false,
iconCreateFunction: cluster => {
const count = cluster.getChildCount();
const size = count < 10 ? 'small' : count < 100 ? 'medium' : 'large';
const pixels = size === 'small' ? 36 : size === 'medium' ? 42 : 48;

return L.divIcon({
className: `observations-overview-map-cluster observations-overview-map-cluster--${size}`,
html: `<span>${count}</span>`,
iconSize: [pixels, pixels],
});
},
});

for (const point of points) {
Expand Down
Loading