import React, { useState } from 'react';
import MainLayout from './components/layout/MainLayout';
import Dashboard from './pages/dashboard/Dashboard';
import Detail from './pages/detail/Detail';
import RiskControl from './pages/risk-control/RiskControl';
import Config from './pages/config/Config';
import './App.css';

function App() {
  const [currentMenu, setCurrentMenu] = useState('dashboard');

  // 渲染当前页面
  const renderCurrentPage = () => {
    switch (currentMenu) {
      case 'dashboard':
        return <Dashboard />;
      case 'detail':
        return <Detail />;
      case 'risk-control':
        return <RiskControl />;
      case 'config':
        return <Config />;
      default:
        return <Dashboard />;
    }
  };

  return (
    <MainLayout currentMenu={currentMenu} onMenuSelect={setCurrentMenu}>
      {renderCurrentPage()}
    </MainLayout>
  );
}

export default App;
