Spaces:
Running
Running
Download components/SignalPanel.js from powerllm/anycoder-cf48624d: direct link, hf CLI and curl.
- Browser
- Download file 5.13 kB
-
https://huggingface.co/spaces/powerllm/anycoder-cf48624d/resolve/main/components/SignalPanel.js
- Command line
-
hf download hf://spaces/powerllm/anycoder-cf48624d/components/SignalPanel.js
-
curl -L -o SignalPanel.js https://huggingface.co/spaces/powerllm/anycoder-cf48624d/resolve/main/components/SignalPanel.js
5.13 kB
| import { ArrowUpRight, ArrowDownRight, AlertTriangle, Zap, FileJson } from 'lucide-react' | |
| export default function SignalPanel({ signals, marketData }) { | |
| const latestSignal = signals[0] | |
| return ( | |
| <div className="grid grid-cols-1 md:grid-cols-3 gap-4"> | |
| {/* Main Signal Card */} | |
| <div className="card p-6 flex flex-col justify-between relative overflow-hidden"> | |
| <div className="absolute top-0 right-0 p-4 opacity-10"> | |
| <Zap className="w-24 h-24 text-white" /> | |
| </div> | |
| <div> | |
| <h3 className="text-dark-400 text-sm font-medium mb-1">AI Recommendation</h3> | |
| {latestSignal ? ( | |
| <div className="flex items-center space-x-3"> | |
| <div className={`p-3 rounded-lg ${ | |
| latestSignal.action === 'LONG' ? 'bg-success/20 text-success' : 'bg-danger/20 text-danger' | |
| }`}> | |
| {latestSignal.action === 'LONG' ? <ArrowUpRight className="w-8 h-8" /> : <ArrowDownRight className="w-8 h-8" />} | |
| </div> | |
| <div> | |
| <div className={`text-2xl font-bold ${ | |
| latestSignal.action === 'LONG' ? 'text-success' : 'text-danger' | |
| }`}> | |
| {latestSignal.action} | |
| </div> | |
| <div className="flex items-center space-x-2"> | |
| <span className="text-xs text-dark-400">{latestSignal.rule}</span> | |
| {latestSignal.isCustom && <FileJson className="w-3 h-3 text-primary-400" />} | |
| </div> | |
| </div> | |
| </div> | |
| ) : ( | |
| <div className="flex items-center space-x-3 text-dark-500"> | |
| <AlertTriangle className="w-8 h-8 opacity-50" /> | |
| <div> | |
| <div className="text-lg font-medium">Neutral / Hold</div> | |
| <div className="text-xs">No strong signals detected</div> | |
| </div> | |
| </div> | |
| )} | |
| </div> | |
| {latestSignal && ( | |
| <div className="mt-4 pt-4 border-t border-dark-700"> | |
| <div className="text-xs text-dark-400 mb-1">Reasoning:</div> | |
| <div className="text-sm text-white font-medium">{latestSignal.reason}</div> | |
| <div className="mt-2 flex items-center space-x-2"> | |
| <span className="text-xs text-dark-500">Confidence:</span> | |
| <div className="flex-1 h-1.5 bg-dark-700 rounded-full overflow-hidden"> | |
| <div | |
| className={`h-full rounded-full ${ | |
| latestSignal.confidence === 'High' ? 'bg-success w-full' : | |
| latestSignal.confidence === 'Medium' ? 'bg-primary-500 w-2/3' : 'bg-yellow-500 w-1/3' | |
| }`} | |
| ></div> | |
| </div> | |
| <span className="text-xs text-white">{latestSignal.confidence}</span> | |
| </div> | |
| </div> | |
| )} | |
| </div> | |
| {/* Market Stats */} | |
| <div className="card p-6 flex flex-col justify-center space-y-4"> | |
| <div> | |
| <div className="text-xs text-dark-400 mb-1">Current Price</div> | |
| <div className="text-2xl font-bold text-white"> | |
| ${marketData.price ? marketData.price.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2}) : '---'} | |
| </div> | |
| </div> | |
| <div> | |
| <div className="text-xs text-dark-400 mb-1">RSI (14)</div> | |
| <div className={`text-lg font-medium ${ | |
| marketData.rsi > 70 ? 'text-danger' : marketData.rsi < 30 ? 'text-success' : 'text-white' | |
| }`}> | |
| {marketData.rsi ? marketData.rsi.toFixed(2) : '---'} | |
| </div> | |
| </div> | |
| <div> | |
| <div className="text-xs text-dark-400 mb-1">24h Volume</div> | |
| <div className="text-lg font-medium text-white"> | |
| {marketData.volume ? (marketData.volume / 1000000).toFixed(2) + 'M' : '---'} | |
| </div> | |
| </div> | |
| </div> | |
| {/* Active Rules Log */} | |
| <div className="card p-6 flex flex-col"> | |
| <h3 className="text-dark-400 text-sm font-medium mb-3">Active Triggers</h3> | |
| <div className="flex-1 overflow-y-auto space-y-2 max-h-[160px]"> | |
| {signals.length > 0 ? ( | |
| signals.map((signal, idx) => ( | |
| <div key={idx} className="flex items-center justify-between text-sm p-2 bg-dark-900 rounded border border-dark-700"> | |
| <div className="flex items-center space-x-2"> | |
| <span className="text-white">{signal.rule}</span> | |
| {signal.isCustom && <FileJson className="w-3 h-3 text-primary-400" />} | |
| </div> | |
| <span className={`text-xs px-2 py-0.5 rounded ${ | |
| signal.action === 'LONG' ? 'bg-success/20 text-success' : 'bg-danger/20 text-danger' | |
| }`}> | |
| {signal.action} | |
| </span> | |
| </div> | |
| )) | |
| ) : ( | |
| <div className="text-center text-dark-500 text-sm py-4"> | |
| Scanning market conditions... | |
| </div> | |
| )} | |
| </div> | |
| </div> | |
| </div> | |
| ) | |
| } |