2026-02-13 16:41:10 +09:00
|
|
|
import { useState } from "react";
|
2026-02-24 15:43:56 +09:00
|
|
|
import type { DashboardHoldingItem } from "@/features/dashboard/types/dashboard.types";
|
2026-02-12 10:24:03 +09:00
|
|
|
import type { KisRuntimeCredentials } from "@/features/settings/store/use-kis-runtime-store";
|
|
|
|
|
import { StockLineChart } from "@/features/trade/components/chart/StockLineChart";
|
|
|
|
|
import { DashboardLayout } from "@/features/trade/components/layout/DashboardLayout";
|
|
|
|
|
import { OrderForm } from "@/features/trade/components/order/OrderForm";
|
|
|
|
|
import { OrderBook } from "@/features/trade/components/orderbook/OrderBook";
|
|
|
|
|
import type {
|
|
|
|
|
DashboardRealtimeTradeTick,
|
|
|
|
|
DashboardStockItem,
|
|
|
|
|
DashboardStockOrderBookResponse,
|
|
|
|
|
} from "@/features/trade/types/trade.types";
|
|
|
|
|
import { cn } from "@/lib/utils";
|
|
|
|
|
|
|
|
|
|
interface TradeDashboardContentProps {
|
|
|
|
|
selectedStock: DashboardStockItem | null;
|
2026-02-24 15:43:56 +09:00
|
|
|
matchedHolding?: DashboardHoldingItem | null;
|
2026-02-12 10:24:03 +09:00
|
|
|
verifiedCredentials: KisRuntimeCredentials | null;
|
|
|
|
|
latestTick: DashboardRealtimeTradeTick | null;
|
|
|
|
|
recentTradeTicks: DashboardRealtimeTradeTick[];
|
|
|
|
|
orderBook: DashboardStockOrderBookResponse | null;
|
|
|
|
|
isOrderBookLoading: boolean;
|
|
|
|
|
referencePrice?: number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2026-02-24 15:43:56 +09:00
|
|
|
* @description 트레이드 본문(차트/체결+호가/주문)을 조합하여 렌더링합니다.
|
|
|
|
|
* @see features/trade/components/TradeContainer.tsx - TradeDashboardContent 렌더링 (selectedStock, verifiedCredentials 등 전달)
|
|
|
|
|
* @see features/trade/components/layout/DashboardLayout.tsx - 3열 레이아웃(차트 | 체결+호가 | 매도)을 처리합니다.
|
2026-02-12 10:24:03 +09:00
|
|
|
*/
|
|
|
|
|
export function TradeDashboardContent({
|
|
|
|
|
selectedStock,
|
2026-02-24 15:43:56 +09:00
|
|
|
matchedHolding,
|
2026-02-12 10:24:03 +09:00
|
|
|
verifiedCredentials,
|
|
|
|
|
latestTick,
|
|
|
|
|
recentTradeTicks,
|
|
|
|
|
orderBook,
|
|
|
|
|
isOrderBookLoading,
|
|
|
|
|
referencePrice,
|
|
|
|
|
}: TradeDashboardContentProps) {
|
2026-02-24 15:43:56 +09:00
|
|
|
// [State] 차트 영역 보임/숨김 - 요청사항 반영: 모바일에서도 기본 표시
|
|
|
|
|
const [isChartVisible, setIsChartVisible] = useState(true);
|
2026-02-13 16:41:10 +09:00
|
|
|
|
2026-02-12 10:24:03 +09:00
|
|
|
return (
|
|
|
|
|
<div
|
|
|
|
|
className={cn(
|
|
|
|
|
"transition-opacity duration-200 h-full flex-1 min-h-0 overflow-x-hidden",
|
|
|
|
|
!selectedStock && "opacity-20 pointer-events-none",
|
|
|
|
|
)}
|
|
|
|
|
>
|
|
|
|
|
{/* ========== DASHBOARD LAYOUT ========== */}
|
|
|
|
|
<DashboardLayout
|
|
|
|
|
chart={
|
|
|
|
|
selectedStock ? (
|
|
|
|
|
<div className="p-0 h-full flex flex-col">
|
|
|
|
|
<StockLineChart
|
|
|
|
|
symbol={selectedStock.symbol}
|
|
|
|
|
candles={selectedStock.candles}
|
|
|
|
|
credentials={verifiedCredentials}
|
|
|
|
|
latestTick={latestTick}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
) : (
|
|
|
|
|
<div className="h-full flex items-center justify-center text-muted-foreground">
|
|
|
|
|
차트 영역
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
orderBook={
|
|
|
|
|
<OrderBook
|
|
|
|
|
symbol={selectedStock?.symbol}
|
|
|
|
|
referencePrice={referencePrice}
|
|
|
|
|
latestTick={latestTick}
|
|
|
|
|
recentTicks={recentTradeTicks}
|
|
|
|
|
orderBook={orderBook}
|
|
|
|
|
isLoading={isOrderBookLoading}
|
|
|
|
|
/>
|
|
|
|
|
}
|
2026-02-24 15:43:56 +09:00
|
|
|
orderForm={
|
|
|
|
|
<OrderForm
|
|
|
|
|
stock={selectedStock ?? undefined}
|
|
|
|
|
matchedHolding={matchedHolding}
|
|
|
|
|
/>
|
|
|
|
|
}
|
2026-02-13 16:41:10 +09:00
|
|
|
isChartVisible={isChartVisible}
|
|
|
|
|
onToggleChart={() => setIsChartVisible((prev) => !prev)}
|
2026-02-12 10:24:03 +09:00
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|