'use client'; import React from 'react'; import { motion } from 'framer-motion'; interface RiskRingProps { disease: string; percentage: number; description?: string; } export const RiskRing: React.FC = ({ disease, percentage, description = '', }) => { // Determine color based on risk level const getColor = (percent: number) => { if (percent >= 80) return 'from-red-500 to-red-600'; if (percent >= 60) return 'from-orange-500 to-orange-600'; if (percent >= 40) return 'from-yellow-500 to-yellow-600'; return 'from-green-500 to-green-600'; }; const getTextColor = (percent: number) => { if (percent >= 80) return 'text-red-400'; if (percent >= 60) return 'text-orange-400'; if (percent >= 40) return 'text-yellow-400'; return 'text-green-400'; }; // SVG Circle progress calculation const radius = 45; const circumference = 2 * Math.PI * radius; const offset = circumference - (percentage / 100) * circumference; return (
{/* Background circle */} {/* Progress circle */} {/* Gradient definition */} = 80 ? '#ef4444' : percentage >= 60 ? '#f97316' : percentage >= 40 ? '#eab308' : '#22c55e'} /> = 80 ? '#7f1d1d' : percentage >= 60 ? '#7c2d12' : percentage >= 40 ? '#713f12' : '#15803d'} /> {/* Center text */}

{Math.round(percentage)}%

{disease}

{description && (

{description}

)} {/* Risk level indicator */}

{percentage >= 80 ? '⚠️ High Risk' : percentage >= 60 ? '⚡ Elevated' : percentage >= 40 ? '⏱️ Moderate' : '✅ Low Risk'}

); }; interface RiskGridProps { risks: { diabetes: number; hypertension: number; cardiovascular: number; }; } export const RiskGrid: React.FC = ({ risks }) => { return ( ); }; export default RiskGrid;