| 72 | } |
| 73 | |
| 74 | export function ScoreRing({ score, color, size }: { score: number; color: string; size: number }) { |
| 75 | const r = (size - 6) / 2; |
| 76 | const c = Math.PI * 2 * r; |
| 77 | const offset = c - (score / 100) * c; |
| 78 | const fontSize = size > 80 ? 22 : size > 60 ? 20 : 14; |
| 79 | return html` |
| 80 | <svg class="score-ring" width=${size} height=${size} viewBox=${'0 0 ' + size + ' ' + size}> |
| 81 | <circle cx=${size / 2} cy=${size / 2} r=${r} fill="none" stroke="rgba(255,255,255,0.06)" stroke-width="5"/> |
| 82 | <circle cx=${size / 2} cy=${size / 2} r=${r} fill="none" stroke=${color} stroke-width="5" |
| 83 | stroke-dasharray=${c} stroke-dashoffset=${offset} stroke-linecap="round" |
| 84 | transform=${'rotate(-90 ' + size / 2 + ' ' + size / 2 + ')'}/> |
| 85 | <text x=${size / 2} y=${size / 2} text-anchor="middle" dominant-baseline="central" |
| 86 | fill=${color} font-size=${fontSize} font-weight="700">${score}</text> |
| 87 | </svg>`; |
| 88 | } |
| 89 | |
| 90 | export function PctBadge({ pct, label }: { pct: number; label: string }) { |
| 91 | if (pct === 0) return html`<span class="trend-badge trend-stable">${label} 0%</span>`; |