import React from 'react'; export default function ScoreDial({ score, subScores }) { // Determine color based on score const getScoreColorClass = (val) => { if (val >= 80) return 'text-emerald-400'; if (val >= 60) return 'text-amber-400'; return 'text-rose-500'; }; const getScoreColorHex = (val) => { if (val >= 80) return '#50c878'; // Jade Green if (val >= 60) return '#d4af37'; // Gold return '#e53e3e'; // Rose Red }; const getScoreLabel = (val) => { if (val >= 85) return 'Auspicious (Imperial)'; if (val >= 70) return 'Harmonious (Sheng Qi)'; if (val >= 50) return 'Moderately Balanced'; return 'Inauspicious (Sha Qi)'; }; // SVG parameters const size = 180; const strokeWidth = 12; const center = size / 2; const radius = center - strokeWidth; const circumference = 2 * Math.PI * radius; const offset = circumference - (score / 100) * circumference; return (
{/* Radial SVG Gauge */} {/* Background circle */} {/* Active progress circle */} {/* Core details inside the dial */}
Feng Shui Score {score} out of 100
{getScoreLabel(score)}
{/* Grid of Sub-Scores */}
{[ { key: 'terrain', label: '⛰️ Terrain', value: subScores.terrain }, { key: 'vitality', label: '🌱 Vitality', value: subScores.vitality }, { key: 'water', label: '💧 Water', value: subScores.water }, { key: 'sha_qi', label: '⚡ Sha Qi', value: subScores.sha_qi } ].map((sub) => (
{sub.label} {Math.round(sub.value)}
{/* Progress bar */}
))}
); }