'use client'
import React, { useState } from 'react'
import AIAnalysisPanel from '../../components/AIAnalysisPanel.tsx'
import TradeExecutionPanel from '../../components/TradeExecutionPanel.js'

export default function AnalysisPage() {
  const [analysisResult, setAnalysisResult] = useState(null)
  const [currentSymbol, setCurrentSymbol] = useState('SOL')

  const handleAnalysisComplete = (analysis, symbol) => {
    setAnalysisResult(analysis)
    setCurrentSymbol(symbol || 'SOL')
  }

  return (
    <div className="space-y-8">
      <div className="flex items-center justify-between">
        <div>
          <h1 className="text-3xl font-bold text-white">AI Analysis & Trading</h1>
          <p className="text-gray-400 mt-2">Get market insights and execute trades based on AI recommendations</p>
        </div>
      </div>
      
      <div className="grid grid-cols-1 xl:grid-cols-3 gap-8">
        <div className="xl:col-span-2">
          <AIAnalysisPanel onAnalysisComplete={handleAnalysisComplete} />
        </div>
        
        <div className="xl:col-span-1">
          <TradeExecutionPanel 
            analysis={analysisResult} 
            symbol={currentSymbol}
          />
        </div>
      </div>
    </div>
  )
}
