import { useState } from 'react'; import { useJGraph } from './JGraphContext.js'; interface JsCouplingProps { value: number; } export default function JsCoupling({ value }: JsCouplingProps) { const { scaleY, maxValue } = useJGraph(); const [isOver, setOver] = useState(false); if (!scaleY) return null; return ( setOver(true)} onMouseLeave={() => setOver(false)} cx={0} cy={0} r={4} fill={`hsl(${(value * 360) / maxValue},100%,${isOver ? 45 : 50}%)`} pointerEvents="all" /> {isOver && ( {`${value.toFixed(1)} Hz`} {`${value.toFixed(1)} Hz`} )} ); }