fix: implement trade button integration with AI analysis
- Add trade button next to each analysis result - Fix TradeModal to properly receive and display analysis data - Update TypeScript interfaces to match actual data structure - Pre-fill Entry Price, Stop Loss, and Take Profit values from AI analysis - Fix duplicate variable declarations causing build errors - Remove TradeExecutionPanel from analysis page (reverted to original design) Trade button now opens modal with correct pre-filled values Analysis data properly passed between components Build errors resolved
This commit is contained in:
@@ -7,10 +7,13 @@ interface TradeModalProps {
|
||||
tradeData: {
|
||||
entry: string
|
||||
tp: string
|
||||
tp2?: string
|
||||
sl: string
|
||||
risk: string
|
||||
reward: string
|
||||
action: 'BUY' | 'SELL'
|
||||
symbol?: string
|
||||
timeframe?: string
|
||||
risk?: string
|
||||
reward?: string
|
||||
action?: 'BUY' | 'SELL'
|
||||
} | null
|
||||
onExecute: (data: any) => void
|
||||
}
|
||||
@@ -55,6 +58,21 @@ export default function TradeModal({ isOpen, onClose, tradeData, onExecute }: Tr
|
||||
}
|
||||
}, [isOpen])
|
||||
|
||||
// Update form data when tradeData changes
|
||||
useEffect(() => {
|
||||
if (tradeData) {
|
||||
console.log('🔄 TradeModal updating form with new tradeData:', tradeData)
|
||||
setFormData(prev => ({
|
||||
...prev,
|
||||
entry: tradeData.entry || '',
|
||||
tp1: tradeData.tp || '',
|
||||
tp2: tradeData.tp2 || '',
|
||||
sl: tradeData.sl || '',
|
||||
tradingCoin: tradeData.symbol ? tradeData.symbol.replace('USD', '') : 'SOL'
|
||||
}))
|
||||
}
|
||||
}, [tradeData])
|
||||
|
||||
const fetchWalletBalance = async () => {
|
||||
try {
|
||||
const response = await fetch('/api/wallet/balance')
|
||||
|
||||
Reference in New Issue
Block a user