Spaces:
Running
Running
Upload components/ConceptDetail.js with huggingface_hub
Browse files123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227import React from 'react';
const ConceptDetail = ({ concept }) => { if (!concept) { return ( <div className="flex-1 flex flex-col items-center justify-center text-gray-500 bg-gray-900"> <i className="fa-regular fa-folder-open text-6xl mb-6 opacity-20"></i> <h3 className="text-xl font-semibold mb-2">Select a Concept</h3> <p className="max-w-md text-center">Choose a concept from the sidebar to view detailed information, entry criteria, and trading strategies.</p> </div> ); }
return ( <div className="flex-1 flex flex-col bg-gray-900 h-full overflow-hidden"> <div className="h-16 border-b border-gray-700 flex items-center justify-between px-6"> <div className="flex items-center gap-3"> <div className="p-1.5 bg-blue-600/20 rounded-lg text-blue-400"> <i className={`fa-solid ${getIconForType(concept.type)}`}></i> </div> <div> <h2 className="text-xl font-semibold text-gray-100">{concept.title}</h2> <p className="text-sm text-gray-400">{concept.description}</p> </div> </div> <div className="flex items-center gap-3"> <span className="px-3 py-1.5 bg-green-500/10 text-green-400 text-sm font-medium rounded-md border border-green-500/20"> {concept.confidence}% Confidence </span> <button className="flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 rounded-md transition-colors"> <i className="fa-solid fa-play"></i> Backtest Strategy </button> </div> </div>
<div className="flex-1 overflow-y-auto p-6"> <div className="grid grid-cols-1 lg:grid-cols-3 gap-6"> {/* Entry Criteria */} <div className="col-span-1"> <div className="bg-gray-800 rounded-xl border border-gray-700 overflow-hidden"> <div className="p-4 border-b border-gray-700 bg-gray-800/50"> <h3 className="font-semibold text-gray-200 flex items-center gap-2"> <i className="fa-solid fa-bullseye text-blue-400"></i> Entry Criteria </h3> </div> <div className="p-4 space-y-4"> <div> <h4 className="text-sm font-medium text-gray-400 mb-2">Bullish Entry</h4> <p className="text-sm text-gray-300 leading-relaxed">{concept.entry.bullish}</p> </div> <div> <h4 className="text-sm font-medium text-gray-400 mb-2">Bearish Entry</h4> <p className="text-sm text-gray-300 leading-relaxed">{concept.entry.bearish}</p> </div> </div> </div>
<div className="bg-gray-800 rounded-xl border border-gray-700 overflow-hidden mt-6"> <div className="p-4 border-b border-gray-700 bg-gray-800/50"> <h3 className="font-semibold text-gray-200 flex items-center gap-2"> <i className="fa-solid fa-stopwatch text-red-400"></i> Risk Parameters </h3> </div> <div className="p-4 space-y-4"> <div> <h4 className="text-sm font-medium text-gray-400 mb-2">Stop Loss</h4> <div className="space-y-2"> <p className="text-sm text-gray-300">{concept.stop_loss.bullish}</p> <p className="text-sm text-gray-300">{concept.stop_loss.bearish}</p> </div> </div> <div> <h4 className="text-sm font-medium text-gray-400 mb-2">Take Profits</h4> <div className="space-y-2"> {concept.take_profits.map((tp, idx) => ( <div key={idx} className="flex items-start gap-2"> <span className="text-blue-400 font-medium">{idx + 1}x:</span> <span className="text-sm text-gray-300">{tp.description}</span> </div> ))} </div> </div> <div> <h4 className="text-sm font-medium text-gray-400 mb-2">Invalidation</h4> <p className="text-sm text-gray-300">{concept.invalidation}</p> </div> </div> </div> </div>
{/* Confluence Factors */} <div className="col-span-1"> <div className="bg-gray-800 rounded-xl border border-gray-700 overflow-hidden"> <div className="p-4 border-b border-gray-700 bg-gray-800/50"> <h3 className="font-semibold text-gray-200 flex items-center gap-2"> <i className="fa-solid fa-layer-group text-purple-400"></i> Confluence Factors </h3> </div> <div className="p-4"> <div className="space-y-3"> {concept.confluence_factors.map((factor, idx) => ( <div key={idx} className="flex items-start gap-3 p-3 bg-gray-700/30 rounded-lg"> <div className="mt-0.5 w-5 h-5 rounded-full bg-purple-500/20 text-purple-400 flex items-center justify-center text-xs font-bold"> {idx + 1} </div> <p className="text-sm text-gray-300">{factor}</p> </div> ))} </div> </div> </div>
<div className="bg-gray-800 rounded-xl border border-gray-700 overflow-hidden mt-6"> <div className="p-4 border-b border-gray-700 bg-gray-800/50"> <h3 className="font-semibold text-gray-200 flex items-center gap-2"> <i className="fa-solid fa-chart-pie text-green-400"></i> Confidence Boosters </h3> </div> <div className="p-4"> <div className="p-4 bg-green-500/10 rounded-lg border border-green-500/20"> <p className="text-sm text-green-400">{concept.confidence_boost}</p> </div> <div className="mt-4"> <h4 className="text-sm font-medium text-gray-400 mb-2">Key Notes</h4> <p className="text-sm text-gray-300 leading-relaxed">{concept.notes}</p> </div> </div> </div> </div>
{/* Time Examples */} <div className="col-span-1"> <div className="bg-gray-800 rounded-xl border border-gray-700 overflow-hidden"> <div className="p-4 border-b border-gray-700 bg-gray-800/50"> <h3 className="font-semibold text-gray-200 flex items-center gap-2"> <i className="fa-solid fa-clock text-orange-400"></i> Timing Examples </h3> </div> <div className="p-4"> <div className="space-y-3"> {concept.timestamp_examples.map((example, idx) => ( <div key={idx} className="flex items-start gap-3 p-3 bg-gray-700/30 rounded-lg"> <div className="mt-0.5 w-8 h-8 rounded-full bg-orange-500/20 text-orange-400 flex items-center justify-center text-xs font-bold"> {idx + 1} </div> <div> <p className="text-sm text-gray-300">{example.split(' - ')[1]}</p> <span className="text-xs text-gray-500">{example.split(' - ')[0]}</span> </div> </div> ))} </div> </div> </div>
<div className="bg-gray-800 rounded-xl border border-gray-700 overflow-hidden mt-6"> <div className="p-4 border-b border-gray-700 bg-gray-800/50"> <h3 className="font-semibold text-gray-200 flex items-center gap-2"> <i className="fa-solid fa-video text-pink-400"></i> Video Source </h3> </div> <div className="p-4"> <div className="p-4 bg-pink-500/10 rounded-lg border border-pink-500/20"> <h4 className="text-sm font-medium text-gray-300 mb-2">{concept.video_title}</h4> <a href={`https://www.youtube.com/watch?v=${concept.video_id}`} target="_blank" rel="noopener noreferrer" className="text-sm text-pink-400 hover:text-pink-300 flex items-center gap-2" > <i className="fa-brands fa-youtube"></i> Watch Video </a> </div> </div> </div> </div> </div>
{/* Conditions */} <div className="mt-6"> <div className="bg-gray-800 rounded-xl border border-gray-700 overflow-hidden"> <div className="p-4 border-b border-gray-700 bg-gray-800/50"> <h3 className="font-semibold text-gray-200 flex items-center gap-2"> <i className="fa-solid fa-list-check text-blue-400"></i> Conditions </h3> </div> <div className="p-4"> <div className="grid grid-cols-1 md:grid-cols-2 gap-4"> {concept.conditions.map((condition, idx) => ( <div key={idx} className="flex items-start gap-3 p-4 bg-gray-700/30 rounded-lg"> <div className="mt-0.5 w-6 h-6 rounded-full bg-blue-500/20 text-blue-400 flex items-center justify-center text-xs font-bold"> {idx + 1} </div> <div> <h4 className="text-sm font-medium text-gray-300 mb-1">{condition.type.replace('_', ' ').toUpperCase()}</h4> <p className="text-sm text-gray-400">{condition.description}</p> </div> </div> ))} </div> </div> </div> </div> </div> </div> );};
const getIconForType = (type) => { const icons = { core_concept: 'fa-book', supporting_concept: 'fa-bookmark', strategy: 'fa-chart-line', risk_management: 'fa-shield-halved', session_analysis: 'fa-clock' }; return icons[type] || 'fa-file';};components/ConceptDetail.jsAdded+227