import { Check, X, Minus } from 'lucide-react';
interface AccuracyBadgeProps {
correct: boolean | null;
returnPercent: number;
size?: 'small' | 'default';
}
export default function AccuracyBadge({
correct,
returnPercent,
size = 'default',
}: AccuracyBadgeProps) {
const isPositiveReturn = returnPercent >= 0;
const sizeClasses = size === 'small' ? 'text-xs px-1.5 py-0.5 gap-1' : 'text-sm px-2 py-1 gap-1.5';
const iconSize = size === 'small' ? 'w-3 h-3' : 'w-3.5 h-3.5';
if (correct === null) {
return (
Pending
);
}
if (correct) {
return (
{isPositiveReturn ? '+' : ''}{returnPercent.toFixed(1)}%
);
}
return (
{isPositiveReturn ? '+' : ''}{returnPercent.toFixed(1)}%
);
}
interface AccuracyRateProps {
rate: number;
label?: string;
size?: 'small' | 'default';
}
export function AccuracyRate({ rate, label = 'Accuracy', size = 'default' }: AccuracyRateProps) {
const percentage = rate * 100;
const isGood = percentage >= 60;
const isModerate = percentage >= 40 && percentage < 60;
const sizeClasses = size === 'small' ? 'text-xs' : 'text-sm';
const colorClass = isGood
? 'text-green-600 dark:text-green-400'
: isModerate
? 'text-amber-600 dark:text-amber-400'
: 'text-red-600 dark:text-red-400';
return (
{label}:
{percentage.toFixed(0)}%
);
}