'use client' interface RiskScoreGaugeProps { score: number // 0-100 riskLevel: string size?: 'sm' | 'md' | 'lg' } const RISK_COLORS: Record = { MINIMAL: '#22c55e', LOW: '#84cc16', MEDIUM: '#eab308', HIGH: '#f97316', UNACCEPTABLE: '#ef4444', } const RISK_LABELS: Record = { MINIMAL: 'Minimal', LOW: 'Niedrig', MEDIUM: 'Mittel', HIGH: 'Hoch', UNACCEPTABLE: 'Unzulaessig', } export function RiskScoreGauge({ score, riskLevel, size = 'md' }: RiskScoreGaugeProps) { const color = RISK_COLORS[riskLevel] || '#9ca3af' const label = RISK_LABELS[riskLevel] || riskLevel const sizes = { sm: { w: 80, r: 30, stroke: 6, fontSize: '1rem', labelSize: '0.65rem' }, md: { w: 120, r: 46, stroke: 8, fontSize: '1.5rem', labelSize: '0.75rem' }, lg: { w: 160, r: 62, stroke: 10, fontSize: '2rem', labelSize: '0.875rem' }, } const s = sizes[size] const circumference = 2 * Math.PI * s.r const dashOffset = circumference - (score / 100) * circumference return (
{/* Background circle */} {/* Score arc */} {/* Score text */} {score} {label}
) }