diff --git a/admin-compliance/app/sdk/iace/[projectId]/benchmark/_components/HazardComparisonTable.tsx b/admin-compliance/app/sdk/iace/[projectId]/benchmark/_components/HazardComparisonTable.tsx index 618a7433..9c430cd1 100644 --- a/admin-compliance/app/sdk/iace/[projectId]/benchmark/_components/HazardComparisonTable.tsx +++ b/admin-compliance/app/sdk/iace/[projectId]/benchmark/_components/HazardComparisonTable.tsx @@ -163,7 +163,7 @@ function DetailComparison({ gt, engine }: { gt: GroundTruthEntry; engine: Hazard
Engine (automatisch)
- + {engine.lifecycle_phase && ( @@ -178,11 +178,55 @@ function DetailComparison({ gt, engine }: { gt: GroundTruthEntry; engine: Hazard ) : ( )} + {(() => { + const clarifications = extractClarifications(engine.description) + if (clarifications.length === 0) return null + return '• ' + c).join('\n')} multiline /> + })()} + {(() => { + const norms = extractEngineNorms(engine.description) + if (norms.length === 0) return null + return + })()}
) } +/** + * The Go init handler appends two annotated blocks to Hazard.Description: + * "\n\nMit Anlagenbauer zu klaeren:\n- frage 1\n- frage 2\n\n + * Referenzierte Normen: EN 60204-1 Ziff. 6.2 | EN 61140" + * These helpers split that string back into structured pieces so the UI + * can render scenario, clarifications and norms as separate sections. + */ +function extractScenario(desc?: string): string { + if (!desc) return '' + const idx = desc.indexOf('\n\nMit Anlagenbauer zu klaeren') + const cut = idx >= 0 ? desc.slice(0, idx) : desc + // Also cut off a trailing norm line if it's the only suffix + const normIdx = cut.indexOf('\n\nReferenzierte Normen') + return (normIdx >= 0 ? cut.slice(0, normIdx) : cut).trim() +} + +function extractClarifications(desc?: string): string[] { + if (!desc) return [] + const start = desc.indexOf('Mit Anlagenbauer zu klaeren:') + if (start < 0) return [] + const after = desc.slice(start + 'Mit Anlagenbauer zu klaeren:'.length) + // Stop at the next double-newline section (e.g. norm block) + const stop = after.indexOf('\n\n') + const block = stop >= 0 ? after.slice(0, stop) : after + return block.split('\n').map(s => s.replace(/^[\s-]+/, '').trim()).filter(Boolean) +} + +function extractEngineNorms(desc?: string): string[] { + if (!desc) return [] + const m = desc.match(/Referenzierte Normen:\s*([^\n]+)/) + if (!m) return [] + return m[1].split('|').map(s => s.trim()).filter(Boolean) +} + function DetailRow({ label, gt, multiline }: { label: string; gt: string; multiline?: boolean }) { return (