From a86da75eff0732ee49f26dcce5b46dadd509dee6 Mon Sep 17 00:00:00 2001 From: weikejia <21105355@qq.com> Date: Mon, 6 Jul 2026 03:01:06 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=9C=8B=E6=9D=BF=E6=B6=A8=E5=B9=85?= =?UTF-8?q?=E6=A6=9C/=E8=B7=8C=E5=B9=85=E6=A6=9C/=E6=88=90=E4=BA=A4?= =?UTF-8?q?=E9=A2=9D=E6=A6=9C/=E6=B4=BB=E8=B7=83=E6=A6=9C/=E9=A2=86?= =?UTF-8?q?=E6=B6=A8=E9=A2=86=E8=B7=8C=E6=A6=82=E5=BF=B5=E4=B8=AA=E8=82=A1?= =?UTF-8?q?=E5=8F=AF=E7=82=B9=E5=87=BB=E6=9F=A5=E7=9C=8B=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/pages/Dashboard.tsx | 54 ++++++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 13 deletions(-) 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)} + />
) }