Files
o2o-infinith-demo/src/components/report/ui/ScoreRing.tsx
T
Haewon KamandClaude Fable 5 18740ca800 feat: AI Discovery 랜딩 /discovery 구현 (시안 ai_discovery_landing.html 기준)
- 신규 라우트 /discovery → DiscoveryLandingPage, 기존 /discovery/:id 리포트와 공존
- 섹션 9종: Hero(ABMR 루프 + AI 답변 목업) / Why Now / How It Works / Sample Report / 8주 로드맵 / 정직성 스트립 / 최종 CTA
- ABMR 루프는 Solution.tsx 다이어그램 구조 복제, AGDP → ABMR 워딩 교체
- 점수·등급·카테고리 %·항목 수 전부 scoreDiscovery 계산값 파생, JSX 수치 하드코딩 없음
  (nextGradeTarget·scorePctColor 헬퍼를 discoveryScore에 추가)
- ScoreRing에 valueClassName·subLabel 옵션 prop 추가 (하위 호환)
- AI 답변 목업 "AEO / GEO 구축 후 목표 상태 예시" 라벨 유지, 연락처 o2oteam@o2o.kr 단일
- 시안 HTML·핸드오버 문서·POC 덱 산출물 포함

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WgWoJZAvvzMxTpWeenZSia
2026-08-31 16:17:25 +09:00

81 lines
2.5 KiB
TypeScript

import { motion } from 'motion/react';
interface ScoreRingProps {
score: number;
maxScore?: number;
size?: number;
label?: string;
color?: string;
/** 링 중앙 숫자 타이포 오버라이드 (기본 text-2xl) */
valueClassName?: string;
/** 링 중앙 숫자 아래 보조 표기 (예: "/ 100") */
subLabel?: string;
}
function getScoreColor(score: number, maxScore: number): string {
const pct = (score / maxScore) * 100;
if (pct <= 40) return '#C084CF'; // soft violet — critical
if (pct <= 60) return '#8B9CF7'; // periwinkle blue — caution
if (pct <= 80) return '#7C6DD8'; // medium purple — good
return '#6C5CE7'; // Infinith primary purple — excellent
}
export function ScoreRing({
score,
maxScore = 100,
size = 120,
label,
color,
valueClassName = 'text-2xl',
subLabel,
}: ScoreRingProps) {
const strokeWidth = 8;
const radius = (size - strokeWidth) / 2;
const circumference = 2 * Math.PI * radius;
const progress = Math.min(score / maxScore, 1);
const strokeDashoffset = circumference * (1 - progress);
const resolvedColor = color ?? getScoreColor(score, maxScore);
return (
<div className="flex flex-col items-center gap-2">
<div className="relative" style={{ width: size, height: size }}>
<svg
width={size}
height={size}
viewBox={`0 0 ${size} ${size}`}
className="-rotate-90"
>
<circle
cx={size / 2}
cy={size / 2}
r={radius}
fill="none"
stroke="#f1f5f9"
strokeWidth={strokeWidth}
/>
<motion.circle
cx={size / 2}
cy={size / 2}
r={radius}
fill="none"
stroke={resolvedColor}
strokeWidth={strokeWidth}
strokeLinecap="round"
strokeDasharray={circumference}
initial={{ strokeDashoffset: circumference }}
animate={{ strokeDashoffset }}
transition={{ duration: 1, ease: 'easeOut' }}
/>
</svg>
<div className="absolute inset-0 flex flex-col items-center justify-center">
<span className={`${valueClassName} font-bold text-[#0A1128]`}>{score}</span>
{subLabel && <span className="text-[13px] text-slate-400">{subLabel}</span>}
</div>
</div>
{label && (
<span className="text-sm text-slate-500 text-center">{label}</span>
)}
</div>
);
}