diff --git a/frontend/src/pages/Dashboard.tsx b/frontend/src/pages/Dashboard.tsx index 9dd9235..feff432 100644 --- a/frontend/src/pages/Dashboard.tsx +++ b/frontend/src/pages/Dashboard.tsx @@ -385,7 +385,10 @@ function MiniMetric({ label, value, cls = 'text-foreground' }: { label: string; ) } -function StockList({ title, rows, mode }: { title: string; rows: MarketSnapshotRow[]; mode: 'gain' | 'loss' | 'amount' | 'active' }) { +function StockList({ title, rows, mode, onStockClick }: { + title: string; rows: MarketSnapshotRow[]; mode: 'gain' | 'loss' | 'amount' | 'active'; + onStockClick?: (symbol: string, name?: string) => void; +}) { return (
@@ -394,7 +397,11 @@ function StockList({ title, rows, mode }: { title: string; rows: MarketSnapshotR
{rows.slice(0, 8).map((r, idx) => ( -
+
onStockClick?.(r.symbol, r.name ?? undefined)} + > {idx + 1}
{r.name || r.symbol}
@@ -427,7 +434,10 @@ function StockList({ title, rows, mode }: { title: string; rows: MarketSnapshotR ) } -function RankColumn({ title, rows, tone }: { title: string; rows: OverviewDimensionRankItem[]; tone: 'bull' | 'bear' }) { +function RankColumn({ title, rows, tone, onStockClick }: { + title: string; rows: OverviewDimensionRankItem[]; tone: 'bull' | 'bear'; + onStockClick?: (symbol: string, name?: string) => void; +}) { return (
{title}
@@ -436,7 +446,15 @@ function RankColumn({ title, rows, tone }: { title: string; rows: OverviewDimens {idx + 1}
{r.name}
-
{r.count}只 · {r.leader?.name ?? '—'}
+
+ {r.count}只 · {r.leader?.symbol ? ( + + ) : r.leader?.name ?? '—'} +
{fmtStockPct(r.avg_pct)}
@@ -446,15 +464,18 @@ function RankColumn({ title, rows, tone }: { title: string; rows: OverviewDimens ) } -function HotRankCard({ title, rank, configUrl }: { title: string; rank?: OverviewMarket['concept_rank']; configUrl: string }) { +function HotRankCard({ title, rank, configUrl, onStockClick }: { + title: string; rank?: OverviewMarket['concept_rank']; configUrl: string; + onStockClick?: (symbol: string, name?: string) => void; +}) { const hasData = (rank?.leading?.length ?? 0) > 0 || (rank?.lagging?.length ?? 0) > 0 return (
{hasData ? (
- - + +
) : (
@@ -475,6 +496,7 @@ export function Dashboard() { const qc = useQueryClient() const [selectedDate, setSelectedDate] = useState() const [manualFetching, setManualFetching] = useState(false) + const [previewStock, setPreviewStock] = useState<{symbol: string; name?: string} | null>(null) // 首次使用(无数据 + 未完成引导)自动弹窗: 同一会话只弹一次 const [showWelcomeModal, setShowWelcomeModal] = useState(false) const dataStatus = useDataStatus({ staleTime: 60_000 }) @@ -729,15 +751,15 @@ export function Dashboard() {
- - + setPreviewStock({symbol, name})} /> + setPreviewStock({symbol, name})} />
- - - - + setPreviewStock({symbol, name})} /> + setPreviewStock({symbol, name})} /> + setPreviewStock({symbol, name})} /> + setPreviewStock({symbol, name})} />
@@ -761,6 +783,12 @@ export function Dashboard() {
+ + setPreviewStock(null)} + />
) }