fix: IACE mitigations page — remove broken 'm.' prefix + accept 'protective' type

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-05-05 15:52:10 +02:00
parent e3ae35891f
commit 3ac8d0cba8
2 changed files with 12 additions and 12 deletions
@@ -128,7 +128,7 @@ export function useMitigations(projectId: string) {
const byType = { const byType = {
design: mitigations.filter((m) => m.reduction_type === 'design'), design: mitigations.filter((m) => m.reduction_type === 'design'),
protection: mitigations.filter((m) => m.reduction_type === 'protection'), protection: mitigations.filter((m) => m.reduction_type === 'protection' || m.reduction_type === 'protective'),
information: mitigations.filter((m) => m.reduction_type === 'information'), information: mitigations.filter((m) => m.reduction_type === 'information'),
} }
@@ -63,8 +63,8 @@ export default function MitigationsPage() {
</p> </p>
</div> </div>
<div className="flex items-center gap-3"> <div className="flex items-center gap-3">
{m.hazards.length > 0 && ( {hazards.length > 0 && (
<button onClick={() => m.setShowSuggest(true)} <button onClick={() => setShowSuggest(true)}
className="flex items-center gap-2 px-3 py-2 border border-green-300 text-green-700 rounded-lg hover:bg-green-50 transition-colors text-sm"> className="flex items-center gap-2 px-3 py-2 border border-green-300 text-green-700 rounded-lg hover:bg-green-50 transition-colors text-sm">
<svg className="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor"> <svg className="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M9 3v2m6-2v2M9 19v2m6-2v2M5 9H3m2 6H3m18-6h-2m2 6h-2M7 19h10a2 2 0 002-2V7a2 2 0 00-2-2H7a2 2 0 00-2 2v10a2 2 0 002 2zM9 9h6v6H9V9z" /> <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M9 3v2m6-2v2M9 19v2m6-2v2M5 9H3m2 6H3m18-6h-2m2 6h-2M7 19h10a2 2 0 002-2V7a2 2 0 00-2-2H7a2 2 0 00-2 2v10a2 2 0 002 2zM9 9h6v6H9V9z" />
@@ -72,7 +72,7 @@ export default function MitigationsPage() {
Vorschlaege Vorschlaege
</button> </button>
)} )}
<button onClick={() => m.handleOpenLibrary()} <button onClick={() => handleOpenLibrary()}
className="flex items-center gap-2 px-4 py-2 bg-white border border-purple-300 text-purple-700 rounded-lg hover:bg-purple-50 transition-colors"> className="flex items-center gap-2 px-4 py-2 bg-white border border-purple-300 text-purple-700 rounded-lg hover:bg-purple-50 transition-colors">
<svg className="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor"> <svg className="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253" /> <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253" />
@@ -108,16 +108,16 @@ export default function MitigationsPage() {
{showLibrary && ( {showLibrary && (
<MeasuresLibraryModal <MeasuresLibraryModal
measures={m.measures} onSelect={m.handleSelectMeasure} measures={measures} onSelect={handleSelectMeasure}
onClose={() => m.setShowLibrary(false)} filterType={m.libraryFilter} onClose={() => setShowLibrary(false)} filterType={libraryFilter}
/> />
)} )}
{showSuggest && ( {showSuggest && (
<SuggestMeasuresModal <SuggestMeasuresModal
hazards={m.hazards} projectId={projectId} hazards={hazards} projectId={projectId}
onAddMeasure={m.handleAddSuggestedMeasure} onAddMeasure={handleAddSuggestedMeasure}
onClose={() => m.setShowSuggest(false)} onClose={() => setShowSuggest(false)}
/> />
)} )}
@@ -125,7 +125,7 @@ export default function MitigationsPage() {
<div className="grid grid-cols-1 lg:grid-cols-3 gap-6"> <div className="grid grid-cols-1 lg:grid-cols-3 gap-6">
{(['design', 'protection', 'information'] as const).map((type) => { {(['design', 'protection', 'information'] as const).map((type) => {
const config = REDUCTION_TYPES[type] const config = REDUCTION_TYPES[type]
const items = m.byType[type] const items = byType[type]
return ( return (
<div key={type} className={`rounded-xl border ${config.color} p-4`}> <div key={type} className={`rounded-xl border ${config.color} p-4`}>
<div className={`flex items-center gap-2 px-3 py-2 rounded-lg ${config.headerColor} mb-3`}> <div className={`flex items-center gap-2 px-3 py-2 rounded-lg ${config.headerColor} mb-3`}>
@@ -149,11 +149,11 @@ export default function MitigationsPage() {
))} ))}
</div> </div>
<div className="mt-3 flex gap-2"> <div className="mt-3 flex gap-2">
<button onClick={() => m.handleAddForType(type)} <button onClick={() => handleAddForType(type)}
className="flex-1 py-2 text-sm text-gray-500 hover:text-purple-600 hover:bg-white rounded-lg border border-dashed border-gray-300 hover:border-purple-300 transition-colors"> className="flex-1 py-2 text-sm text-gray-500 hover:text-purple-600 hover:bg-white rounded-lg border border-dashed border-gray-300 hover:border-purple-300 transition-colors">
+ Hinzufuegen + Hinzufuegen
</button> </button>
<button onClick={() => m.handleOpenLibrary(type)} <button onClick={() => handleOpenLibrary(type)}
className="py-2 px-3 text-sm text-gray-400 hover:text-purple-600 hover:bg-white rounded-lg border border-dashed border-gray-300 hover:border-purple-300 transition-colors" className="py-2 px-3 text-sm text-gray-400 hover:text-purple-600 hover:bg-white rounded-lg border border-dashed border-gray-300 hover:border-purple-300 transition-colors"
title="Aus Bibliothek waehlen"> title="Aus Bibliothek waehlen">
<svg className="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor"> <svg className="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">