From 6d65b782b8d6b314e1ad8a8438efee24ece2714b Mon Sep 17 00:00:00 2001 From: Floke Date: Wed, 4 Feb 2026 14:16:50 +0000 Subject: [PATCH] refactor([2fd88f42]): remove legend component --- .../frontend/src/components/Legend.tsx | 68 ------------------- .../frontend/src/components/MapDisplay.tsx | 2 - 2 files changed, 70 deletions(-) delete mode 100644 heatmap-tool/frontend/src/components/Legend.tsx diff --git a/heatmap-tool/frontend/src/components/Legend.tsx b/heatmap-tool/frontend/src/components/Legend.tsx deleted file mode 100644 index 3e7b182d..00000000 --- a/heatmap-tool/frontend/src/components/Legend.tsx +++ /dev/null @@ -1,68 +0,0 @@ -// src/components/Legend.tsx -import React from 'react'; - -interface LegendProps { - getColor: (count: number) => string; - maxCount: number; -} - -const Legend: React.FC = ({ getColor, maxCount }) => { - // Dynamically generate grades based on the maxCount of the current dataset - const grades = [ - 1, - Math.round(maxCount / 5), - Math.round(maxCount / 2.5), - Math.round(maxCount / 1.5), - maxCount - ]; - - // Remove duplicates and filter out zero or invalid numbers, then sort - const uniqueGrades = [...new Set(grades)].filter(g => g > 0).sort((a,b) => a-b); - if (uniqueGrades.length > 1 && uniqueGrades[1] <= 1) { - uniqueGrades.shift(); // remove the '1' if the next step is too close - } - - return ( - <> - -
-

Count

- {uniqueGrades.map((grade, index) => { - const from = grade; - const to = uniqueGrades[index + 1]; - return ( -
- - {from}{to ? `–${to - 1}` : '+'} -
- ); - })} -
- - ); -}; - -export default Legend; diff --git a/heatmap-tool/frontend/src/components/MapDisplay.tsx b/heatmap-tool/frontend/src/components/MapDisplay.tsx index b53793ef..681416f5 100644 --- a/heatmap-tool/frontend/src/components/MapDisplay.tsx +++ b/heatmap-tool/frontend/src/components/MapDisplay.tsx @@ -6,7 +6,6 @@ import 'leaflet/dist/leaflet.css'; import 'leaflet.heat'; import type { HeatmapPoint, MapMode } from '../App'; import MarkerClusterGroup from 'react-leaflet-cluster'; -import Legend from './Legend'; interface MapDisplayProps { heatmapData: HeatmapPoint[]; @@ -85,7 +84,6 @@ const MapDisplay: React.FC = ({ heatmapData, radiusMultiplier, attribution='© OpenStreetMap contributors' /> {viewMode === 'points' ? renderPoints() : renderHeatmap()} - {viewMode === 'points' && } ); };