Spaces:
Running

anycoder-cf48624d / components /TradeSignalCard.js
powerllm's picture
Upload components/TradeSignalCard.js with huggingface_hub
73a4b1d verified
Raw History Blame Contribute Delete
3.76 kB
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>
)
}