All files / src/pages/flowsheet-page/pinch-analysis/hen-generation HENPinchLine.tsx

100% Statements 3/3
50% Branches 5/10
100% Functions 2/2
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92                                  98x 98x                 1x                                                                                                                                
export default function PinchLine({
  x,
  height,
  onShowHover,
  onHideHover,
  hoverBuilders,
  hotPinch,
  coldPinch,
}: {
  x: number;
  height: number;
  onShowHover;
  onHideHover;
  hoverBuilders;
  hotPinch?;
  coldPinch?;
}) {
  const Y_MARGIN = 20;
  return (
    <>
      <rect
        x={x - 6}
        y={0}
        width={12}
        height={height}
        fill="transparent"
        onMouseMove={(e) =>
          onShowHover?.(e, hoverBuilders?.pinch({ hotPinch, coldPinch }), {
            width: 200,
          })
        }
        onMouseLeave={onHideHover}
        aria-label="pinch-line"
      />
      <line
        x1={x}
        x2={x}
        y1={Y_MARGIN + 10}
        y2={hotPinch && coldPinch ? height - Y_MARGIN : height}
        stroke="hsl(var(--hen-diagram-foreground))"
        strokeWidth={1}
        strokeDasharray="3 3"
        pointerEvents="none"
      />
      {hotPinch && coldPinch ? (
        <>
          <text
            x={x + 3}
            y={15}
            textAnchor="middle"
            fontFamily="Inter"
            className="text-base font-semibold text-white"
          >
            Hot Pinch: {hotPinch!.toFixed(2)} °C
          </text>
 
          <text
            x={x + 3}
            y={height - Y_MARGIN + 15}
            textAnchor="middle"
            fontFamily="Inter"
            className="text-base font-semibold text-white"
          >
            Cold Pinch: {coldPinch!.toFixed(2)} °C
          </text>
        </>
      ) : !hotPinch ? (
        <text
            x={x + 3}
            y={22}
            textAnchor="middle"
            fontFamily="Inter"
            className="text-base font-semibold text-white"
            fill="hsl(var(--hen-diagram-foreground))"
          >
            Cold Pinch: {coldPinch!.toFixed(2)} °C
          </text>
      ) : (
        <text
            x={x + 3}
            y={22}
            textAnchor="middle"
            fontFamily="Inter"
            className="text-base font-semibold text-white"
          >
            Hot Pinch: {hotPinch!.toFixed(2)} °C
          </text>
      )}
    </>
  );
}