'use client'; interface ScoreRingProps { score: number; maxScore: number; size?: number; strokeWidth?: number; label?: string; showPercentage?: boolean; color?: string; } export default function ScoreRing({ score, maxScore, size = 120, strokeWidth = 8, label, showPercentage = true, color, }: ScoreRingProps) { const radius = (size - strokeWidth) / 2; const circumference = 2 * Math.PI * radius; const percentage = Math.min((score / maxScore) * 100, 100); const offset = circumference - (percentage / 100) * circumference; const getColor = () => { if (color) return color; if (percentage >= 80) return 'var(--success)'; if (percentage >= 60) return 'var(--primary)'; if (percentage >= 40) return 'var(--warning)'; return 'var(--danger)'; }; const ringColor = getColor(); return (
{/* Background circle */} {/* Score circle */} {/* Center text */}
{showPercentage ? `${Math.round(percentage)}%` : score.toFixed(1)} {!showPercentage && ( / {maxScore} )}
{label && ( {label} )}
); }