From 61da2cb2ce215637f9d05f21debd3d0c6c0aaf98 Mon Sep 17 00:00:00 2001 From: Abdulrahman Oyawoye Date: Thu, 24 Sep 2026 21:58:17 +0100 Subject: [PATCH 1/2] feat(analytics): heatmap legend scale controls and multi-area comparison component --- .../analytics/HeatmapLegendControls.tsx | 68 +++++++++++++++++++ .../analytics/MultiAreaComparison.tsx | 48 +++++++++++++ 2 files changed, 116 insertions(+) create mode 100644 Frontend/src/components/analytics/HeatmapLegendControls.tsx create mode 100644 Frontend/src/components/analytics/MultiAreaComparison.tsx diff --git a/Frontend/src/components/analytics/HeatmapLegendControls.tsx b/Frontend/src/components/analytics/HeatmapLegendControls.tsx new file mode 100644 index 00000000..2cc2b050 --- /dev/null +++ b/Frontend/src/components/analytics/HeatmapLegendControls.tsx @@ -0,0 +1,68 @@ +import React, { useState } from 'react'; + +export interface HeatmapScaleConfig { + minThreshold: number; + maxThreshold: number; + colorScheme: 'indigo' | 'emerald' | 'amber' | 'rose'; +} + +export interface HeatmapLegendControlsProps { + initialConfig?: HeatmapScaleConfig; + onChange?: (config: HeatmapScaleConfig) => void; +} + +export const HeatmapLegendControls: React.FC = ({ + initialConfig = { minThreshold: 0, maxThreshold: 100, colorScheme: 'indigo' }, + onChange, +}) => { + const [config, setConfig] = useState(initialConfig); + + const handleUpdate = (updated: Partial) => { + const next = { ...config, ...updated }; + setConfig(next); + onChange?.(next); + }; + + return ( +
+

+ Heatmap Scale Controls +

+
+ + + +
+
+ ); +}; + +export default HeatmapLegendControls; diff --git a/Frontend/src/components/analytics/MultiAreaComparison.tsx b/Frontend/src/components/analytics/MultiAreaComparison.tsx new file mode 100644 index 00000000..36543f8d --- /dev/null +++ b/Frontend/src/components/analytics/MultiAreaComparison.tsx @@ -0,0 +1,48 @@ +import React from 'react'; + +export interface AreaStats { + areaId: string; + name: string; + gistCount: number; + activeUsers: number; + densityScore: number; +} + +export interface MultiAreaComparisonProps { + areas?: AreaStats[]; +} + +export const MultiAreaComparison: React.FC = ({ + areas = [], +}) => { + return ( +
+

+ Multi-Area Spatial Comparison +

+
+ {areas.map(area => ( +
+

{area.name}

+
+
+ Gist Count: + {area.gistCount} +
+
+ Active Users: + {area.activeUsers} +
+
+ Density Score: + {area.densityScore} +
+
+
+ ))} +
+
+ ); +}; + +export default MultiAreaComparison; From 97d06725dda2e073e649e11bdd13e501aba0b910 Mon Sep 17 00:00:00 2001 From: Abdulrahman Oyawoye Date: Thu, 24 Sep 2026 22:01:14 +0100 Subject: [PATCH 2/2] fix(analytics): replace explicit any with HeatmapScaleConfig colorScheme type --- .../src/components/analytics/HeatmapLegendControls.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Frontend/src/components/analytics/HeatmapLegendControls.tsx b/Frontend/src/components/analytics/HeatmapLegendControls.tsx index 2cc2b050..4e24338c 100644 --- a/Frontend/src/components/analytics/HeatmapLegendControls.tsx +++ b/Frontend/src/components/analytics/HeatmapLegendControls.tsx @@ -1,9 +1,9 @@ -import React, { useState } from 'react'; +import React, { useState } from "react"; export interface HeatmapScaleConfig { minThreshold: number; maxThreshold: number; - colorScheme: 'indigo' | 'emerald' | 'amber' | 'rose'; + colorScheme: "indigo" | "emerald" | "amber" | "rose"; } export interface HeatmapLegendControlsProps { @@ -12,7 +12,7 @@ export interface HeatmapLegendControlsProps { } export const HeatmapLegendControls: React.FC = ({ - initialConfig = { minThreshold: 0, maxThreshold: 100, colorScheme: 'indigo' }, + initialConfig = { minThreshold: 0, maxThreshold: 100, colorScheme: "indigo" }, onChange, }) => { const [config, setConfig] = useState(initialConfig); @@ -51,7 +51,7 @@ export const HeatmapLegendControls: React.FC = ({ Palette: