Spaces:
Running
Running
File size: 3,758 Bytes
e13b3bf | 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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | import { ArrowUpRight, ArrowDownRight, Target, ShieldAlert, TrendingUp, Activity } from 'lucide-react'
import { motion } from 'framer-motion'
export default function TradeSignalCard({ signal, currentPrice }) {
if (!signal) return null
const isLong = signal.action === 'LONG'
const colorClass = isLong ? 'text-success' : 'text-danger'
const bgClass = isLong ? 'bg-success/10 border-success/20' : 'bg-danger/10 border-danger/20'
const iconBg = isLong ? 'bg-success/20' : 'bg-danger/20'
return (
<motion.div
initial={{ opacity: 0, y: 20 }}
animate={{ opacity: 1, y: 0 }}
className="card border-l-4 border-l-primary-500 relative overflow-hidden"
>
<div className={`absolute -right-10 -top-10 w-40 h-40 rounded-full blur-3xl opacity-10 ${isLong ? 'bg-success' : 'bg-danger'}`}></div>
<div className="p-6 relative z-10">
<div className="flex justify-between items-start mb-6">
<div>
<div className="flex items-center space-x-2 mb-1">
<span className="text-xs font-bold text-primary-400 uppercase tracking-wider">Active Signal</span>
{signal.isCustom && <span className="text-[10px] bg-primary-500/20 text-primary-300 px-1.5 py-0.5 rounded">Custom Rule</span>}
</div>
<h3 className="text-xl font-bold text-white">{signal.rule}</h3>
</div>
<div className={`p-3 rounded-xl ${iconBg} ${colorClass}`}>
{isLong ? <ArrowUpRight className="w-8 h-8" /> : <ArrowDownRight className="w-8 h-8" />}
</div>
</div>
<div className="grid grid-cols-3 gap-4 mb-6">
<div className="bg-dark-900/50 rounded-xl p-3 border border-white/5">
<div className="flex items-center space-x-1.5 text-dark-400 text-xs mb-1">
<Activity className="w-3 h-3" />
<span>Entry Point</span>
</div>
<div className="text-lg font-mono font-bold text-white">
${signal.entryPrice?.toFixed(2)}
</div>
</div>
<div className="bg-dark-900/50 rounded-xl p-3 border border-white/5">
<div className="flex items-center space-x-1.5 text-dark-400 text-xs mb-1">
<ShieldAlert className="w-3 h-3 text-danger" />
<span>Stop Loss</span>
</div>
<div className="text-lg font-mono font-bold text-danger">
${signal.stopLoss?.toFixed(2)}
</div>
</div>
<div className="bg-dark-900/50 rounded-xl p-3 border border-white/5">
<div className="flex items-center space-x-1.5 text-dark-400 text-xs mb-1">
<Target className="w-3 h-3 text-success" />
<span>Target</span>
</div>
<div className="text-lg font-mono font-bold text-success">
${signal.takeProfit?.toFixed(2)}
</div>
</div>
</div>
<div className="space-y-3">
<div className="flex justify-between items-center text-sm">
<span className="text-dark-400">Risk/Reward Ratio</span>
<span className="text-white font-mono font-medium">1 : {signal.riskRewardRatio}</span>
</div>
<div className="w-full bg-dark-700 h-1.5 rounded-full overflow-hidden">
<div className="bg-gradient-to-r from-primary-500 to-indigo-500 h-full rounded-full" style={{ width: `${Math.min(signal.confidenceValue, 100)}%` }}></div>
</div>
<div className="flex justify-between text-xs">
<span className="text-dark-500">Confidence</span>
<span className={colorClass}>{signal.confidence}</span>
</div>
</div>
</div>
</motion.div>
)
} |