'use client' import { useMemo } from 'react' import { Language } from '@/lib/compliance-i18n' import { Risk, RISK_BADGE_COLORS } from './risk-heatmap-types' interface RiskDistributionProps { risks: Risk[] lang?: Language } export function RiskDistribution({ risks, lang = 'de' }: RiskDistributionProps) { const stats = useMemo(() => { const byLevel: Record = { critical: 0, high: 0, medium: 0, low: 0 } risks.forEach((r) => { byLevel[r.inherent_risk] = (byLevel[r.inherent_risk] || 0) + 1 }) return byLevel }, [risks]) const total = risks.length || 1 return (
{['critical', 'high', 'medium', 'low'].map((level) => { const count = stats[level] const percentage = (count / total) * 100 return (
{level}
{count}
) })}
) }