import React from 'react';
import MarketPanel from '../../components/MarketPanel';
import { useWidgetDashboard } from '../WidgetDashboardContext';

/** 종목 목록 — MarketPanel 재사용 */
const MarketListWidgetHost: React.FC = () => {
  const {
    selectedMarket, setSelectedMarket, tickers, marketInfos, marketLoading, usdRate,
  } = useWidgetDashboard();

  return (
    <div className="wd-widget-host wd-widget-host--market">
      <MarketPanel
        open
        tickers={tickers}
        marketInfos={marketInfos}
        loading={marketLoading}
        usdRate={usdRate}
        activeSymbol={selectedMarket}
        onSymbolSelect={setSelectedMarket}
      />
    </div>
  );
};

export default MarketListWidgetHost;
