import { Activity, ShieldCheck } from "lucide-react"; import { Card, CardContent, CardHeader, CardTitle, CardDescription, } from "@/components/ui/card"; import { StockLineChart } from "@/features/dashboard/components/chart/StockLineChart"; import { StockPriceBadge } from "@/features/dashboard/components/details/StockPriceBadge"; import type { DashboardStockItem, DashboardPriceSource, DashboardMarketPhase, } from "@/features/dashboard/types/dashboard.types"; const PRICE_FORMATTER = new Intl.NumberFormat("ko-KR"); function formatVolume(value: number) { return `${PRICE_FORMATTER.format(value)}주`; } function getPriceSourceLabel( source: DashboardPriceSource, marketPhase: DashboardMarketPhase, ) { switch (source) { case "inquire-overtime-price": return "시간외 현재가(inquire-overtime-price)"; case "inquire-ccnl": return marketPhase === "afterHours" ? "체결가 폴백(inquire-ccnl)" : "체결가(inquire-ccnl)"; default: return "현재가(inquire-price)"; } } function PriceStat({ label, value }: { label: string; value: string }) { return (

{label}

{value}

); } interface StockOverviewCardProps { stock: DashboardStockItem; priceSource: DashboardPriceSource; marketPhase: DashboardMarketPhase; isRealtimeConnected: boolean; realtimeTrId: string | null; lastRealtimeTickAt: number | null; } export function StockOverviewCard({ stock, priceSource, marketPhase, isRealtimeConnected, realtimeTrId, lastRealtimeTickAt, }: StockOverviewCardProps) { const apiPriceSourceLabel = getPriceSourceLabel(priceSource, marketPhase); const effectivePriceSourceLabel = isRealtimeConnected && lastRealtimeTickAt ? `실시간 체결(WebSocket ${realtimeTrId || ""})` : apiPriceSourceLabel; return (
{stock.name} {stock.symbol} {stock.market}
{effectivePriceSourceLabel} {isRealtimeConnected && ( 실시간 )}
{/* Chart Area */}
주요 시세 정보
); }