forked from StellarSplit/StellarSplit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConfidenceIndicator.tsx
More file actions
40 lines (34 loc) · 1.18 KB
/
Copy pathConfidenceIndicator.tsx
File metadata and controls
40 lines (34 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { AlertCircle, CheckCircle, AlertTriangle } from 'lucide-react';
interface ConfidenceIndicatorProps {
confidence: number; // 0-100
size?: 'sm' | 'md' | 'lg';
}
export const ConfidenceIndicator = ({
confidence,
size = 'md',
}: ConfidenceIndicatorProps) => {
const getColor = () => {
if (confidence >= 80) return { bg: 'bg-green-100', text: 'text-green-700', border: 'border-green-200' };
if (confidence >= 50) return { bg: 'bg-yellow-100', text: 'text-yellow-700', border: 'border-yellow-200' };
return { bg: 'bg-red-100', text: 'text-red-700', border: 'border-red-200' };
};
const getIcon = () => {
if (confidence >= 80) return <CheckCircle size={16} />;
if (confidence >= 50) return <AlertTriangle size={16} />;
return <AlertCircle size={16} />;
};
const sizeClasses = {
sm: 'px-2 py-1 text-xs',
md: 'px-3 py-1.5 text-sm',
lg: 'px-4 py-2 text-base',
};
const colors = getColor();
return (
<div
className={`inline-flex items-center gap-1.5 rounded-full border ${colors.bg} ${colors.text} ${colors.border} ${sizeClasses[size]}`}
>
{getIcon()}
<span className="font-medium">{confidence}%</span>
</div>
);
};