feat: Normen-Referenzen in Hazards + Massnahmen + Normenrecherche-Tab

- Hazard Log: Top 2 relevante Normen pro Kategorie unter dem Kategorie-Badge
- Massnahmen: Normen-Referenzen aus measures_library inline anzeigen
- Navigation: Neuer Normenrecherche-Tab (zwischen Grenzen und Komponenten)
- Normenrecherche-Seite: SuggestedNorms + A/B/C Erklaerung

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-05-08 00:18:45 +02:00
parent 21c01d6405
commit 136dc4d553
4 changed files with 95 additions and 1 deletions
@@ -1,6 +1,6 @@
'use client'
import { useState } from 'react'
import { useState, useEffect } from 'react'
import { useParams } from 'next/navigation'
import { REDUCTION_TYPES, Mitigation } from './_components/types'
import { HierarchyWarning } from './_components/HierarchyWarning'
@@ -21,6 +21,24 @@ export default function MitigationsPage() {
fetchMeasuresLibrary, handleSubmit, handleAddSuggestedMeasure, handleVerify, handleDelete,
} = useMitigations(projectId)
const [measureNorms, setMeasureNorms] = useState<Record<string, string[]>>({})
useEffect(() => {
fetch('/api/sdk/v1/iace/protective-measures-library')
.then(r => r.ok ? r.json() : null)
.then(json => {
if (!json?.protective_measures) return
const map: Record<string, string[]> = {}
for (const m of json.protective_measures) {
if (m.norm_references?.length > 0) {
map[(m.name || '').toLowerCase()] = m.norm_references
}
}
setMeasureNorms(map)
})
.catch(() => {})
}, [])
const [showForm, setShowForm] = useState(false)
const [preselectedType, setPreselectedType] = useState<'design' | 'protection' | 'information' | undefined>()
const [showLibrary, setShowLibrary] = useState(false)
@@ -195,6 +213,12 @@ export default function MitigationsPage() {
<div className="min-w-0">
<div className="text-sm text-gray-900 dark:text-white">{m.title || ''}</div>
{m.description && <div className="text-xs text-gray-400 mt-0.5">{m.description}</div>}
{(() => {
const refs = measureNorms[(m.title || '').toLowerCase()]
return refs?.length > 0 ? (
<div className="text-[9px] text-blue-500 mt-0.5">Normen: {refs.join(', ')}</div>
) : null
})()}
</div>
<div className="text-xs text-gray-500">
{(m.linked_hazard_names || []).join(', ') || '-'}