'use client' import React, { useState, useEffect } from 'react' import TradingChart from '../../components/TradingChart' import CompactTradingPanel from '../../components/CompactTradingPanel' export default function ChartTradingPageSimple() { const [currentPrice, setCurrentPrice] = useState(166.21) const [positions, setPositions] = useState([ // Mock position data for demo { id: 'demo_pos_1', symbol: 'SOL/USDC', side: 'BUY' as 'BUY' | 'SELL', amount: 0.5, entryPrice: 165.50, stopLoss: 160.00, takeProfit: 170.00, currentPrice: 166.21, unrealizedPnl: 0.355, } ]) const [selectedSymbol, setSelectedSymbol] = useState('SOL') const handleTrade = async (tradeData: any) => { try { console.log('Trade executed (demo):', tradeData) // Create a mock position for demo const newPosition = { id: `demo_${Date.now()}`, symbol: `${tradeData.symbol}/USDC`, side: tradeData.side, amount: tradeData.amount, entryPrice: tradeData.price, stopLoss: tradeData.stopLoss, takeProfit: tradeData.takeProfit, currentPrice: currentPrice, unrealizedPnl: 0, } setPositions(prev => [...prev, newPosition]) alert(`Demo trade executed: ${tradeData.side} ${tradeData.amount} ${tradeData.symbol}`) } catch (error) { console.error('Trade execution error:', error) } } const handlePriceUpdate = (price: number) => { setCurrentPrice(price) // Update position P&L based on new price setPositions(prev => prev.map(pos => ({ ...pos, currentPrice: price, unrealizedPnl: pos.side === 'BUY' ? (price - pos.entryPrice) * pos.amount : (pos.entryPrice - price) * pos.amount }))) } const handleClosePosition = (positionId: string) => { setPositions(prev => prev.filter(pos => pos.id !== positionId)) alert('Position closed (demo)') } return (