import { useState } from 'react' function colorFor(v) { if (v == null) return '#0F1729' if (v < 30) { const t = v / 30 return `rgb(${Math.round(15 + t * 10)}, ${Math.round(28 + t * 40)}, ${Math.round(60 + t * 80)})` } if (v < 60) { const t = (v - 30) / 30 return `rgb(${Math.round(25 + t * (0 - 25))}, ${Math.round(68 + t * (212 - 68))}, ${Math.round(140 + t * (255 - 140))})` } if (v < 80) { const t = (v - 60) / 20 return `rgb(${Math.round(t * 245)}, ${Math.round(212 + t * (158 - 212))}, ${Math.round(255 + t * (11 - 255))})` } const t = (v - 80) / 20 return `rgb(${Math.round(245 + t * (239 - 245))}, ${Math.round(158 + t * (68 - 158))}, ${Math.round(11 + t * (68 - 11))})` } export default function Heatmap({ data, ids, onSelectPair }) { const [tip, setTip] = useState(null) const [selected, setSelected] = useState(null) // { i, j } if (!data || !ids || ids.length === 0) { return