/** HeatPumpTable — shows available/excluded heat pumps with comparison data. */ import { useState } from 'react'; import { useAnalysisStore } from '../../store/analysisStore'; export default function HeatPumpTable() { const hpiResult = useAnalysisStore((s) => s.hpiResult); const [isExcludedOpen, setIsExcludedOpen] = useState(false); if (!hpiResult) return null; const available = hpiResult.heat_pumps.filter((hp) => hp.available); const excluded = hpiResult.excluded_heat_pumps; if (available.length === 0 && excluded.length === 0) return null; return (
{/* ── Available heat pumps ── */} {available.length > 0 && ( <>

Integrable heat pumps

{available .sort((a, b) => (b.cop ?? 0) - (a.cop ?? 0)) .map((hp) => ( ))}
Heat Pump COP T_source (°C) T_sink (°C) Q_source (kW) Q_sink (kW)
{hp.name} {hp.cop?.toFixed(2) ?? '—'} {hp.t_source?.toFixed(1) ?? '—'} {hp.t_sink?.toFixed(1) ?? '—'} {hp.q_source?.toFixed(1) ?? '—'} {hp.q_sink?.toFixed(1) ?? '—'}
)} {/* ── Excluded heat pumps — collapsible, closed by default ── */} {excluded.length > 0 && (

setIsExcludedOpen(!isExcludedOpen)} style={{ cursor: 'pointer', display: 'flex', alignItems: 'center', justifyContent: 'space-between' }} > Heat pumps that cannot be integrated

{isExcludedOpen && (
{excluded.map((hp) => (
{hp.name} Cannot be integrated
{hp.reason}
))}
)}
)}
); }