import { CheckCircle } from 'lucide-react'; import { Spinner } from '@/components/ui/spinner'; import { TradingViewWidget } from '@/components/TradingViewWidget'; interface StockChartProps { unifiedSymbol: string; marketParam: string; realtime: any; realtimeLoading: boolean; realtimeError: any; } export function StockChart({ unifiedSymbol, marketParam, realtime, realtimeLoading, realtimeError, }: StockChartProps) { return (

股价图表(来自 TradingView)

实时股价图表 - {unifiedSymbol}
{realtimeLoading ? ( 正在获取实时报价… ) : realtimeError ? ( 实时报价不可用 ) : (() => { const priceRaw = realtime?.price; const priceNum = typeof priceRaw === 'number' ? priceRaw : Number(priceRaw); const tsRaw = realtime?.ts; const tsDate = tsRaw == null ? null : new Date(typeof tsRaw === 'number' ? tsRaw : String(tsRaw)); const tsText = tsDate && !isNaN(tsDate.getTime()) ? `(${tsDate.toLocaleString()})` : ''; if (Number.isFinite(priceNum)) { return 价格 {priceNum.toLocaleString()} {tsText}; } return 暂无最新报价; })()}
); }