feat: Implement Jupiter-style trading interface with token selection
- Add 'You're paying' and 'You're receiving' sections with proper token dropdowns - Implement balance display and MAX button functionality - Add automatic receiving amount calculation based on paying amount - Enhance token selector with icons, names, and balance information - Improve leverage position value calculations and risk warnings - Update trade execution to use new paying/receiving token structure - Maintain all existing functionality including stop loss, take profit, and position management This creates a more intuitive and professional trading interface that matches Jupiter's UX patterns.
This commit is contained in:
@@ -48,9 +48,27 @@ export default function TradeExecutionPanel({ analysis, symbol = 'SOL' }) {
|
||||
setTakeProfit(analysis.takeProfits.tp1.price.toString())
|
||||
setEnableTakeProfit(true)
|
||||
}
|
||||
// Set trade type based on analysis recommendation
|
||||
if (analysis.recommendation === 'BUY' || analysis.sentiment === 'BULLISH') {
|
||||
setTradeType('BUY')
|
||||
} else if (analysis.recommendation === 'SELL' || analysis.sentiment === 'BEARISH') {
|
||||
setTradeType('SELL')
|
||||
}
|
||||
}
|
||||
}, [analysis])
|
||||
|
||||
// Initialize coin selection based on symbol prop
|
||||
useEffect(() => {
|
||||
if (symbol && availableCoins.find(coin => coin.symbol === symbol)) {
|
||||
setFromCoin(symbol)
|
||||
setPerpCoin(symbol)
|
||||
// If it's not a stablecoin, trade it against USDC
|
||||
if (symbol !== 'USDC' && symbol !== 'USDT') {
|
||||
setToCoin('USDC')
|
||||
}
|
||||
}
|
||||
}, [symbol])
|
||||
|
||||
// Get recommended price from analysis
|
||||
const getRecommendedPrice = () => {
|
||||
if (!analysis) return null
|
||||
|
||||
Reference in New Issue
Block a user