diff --git a/frontend/src/components/StockInfoBar.tsx b/frontend/src/components/StockInfoBar.tsx index 84737cf..7f01ebd 100644 --- a/frontend/src/components/StockInfoBar.tsx +++ b/frontend/src/components/StockInfoBar.tsx @@ -1,10 +1,11 @@ import { useState, type ReactNode } from 'react' -import { Settings2, RadioTower, Star } from 'lucide-react' +import { Settings2, RadioTower, Star, ExternalLink } from 'lucide-react' import type { KlineRow, FinancialMetricRecord } from '@/lib/api' import { fmtPrice, fmtBigNum, fmtVolume } from '@/lib/format' import { ListColumnCustomizer } from '@/components/ListColumnCustomizer' import { WatchlistAddMenu } from '@/components/WatchlistAddMenu' import { INFO_GROUPS, type ColumnConfig } from '@/lib/stock-info-fields' +import { buildStockExternalUrl, loadStockExternalTemplate } from '@/lib/stock-external-link' const BULL = '#C74040' const BEAR = '#2D9B65' @@ -235,6 +236,8 @@ export function StockInfoBar({ ) } + const extUrl = buildStockExternalUrl(loadStockExternalTemplate(), symbol) + return (
{/* Row 1: code, name, price, change, change% */} @@ -250,8 +253,19 @@ export function StockInfoBar({ {isUp ? '+' : ''}{fmtPrice(chgPct)}% - {/* 右侧操作按钮:加自选 + 加监控 + 信息条配置 */} + {/* 右侧操作按钮:外链 + 加自选 + 加监控 + 信息条配置 */}
+ {extUrl && ( + + + + )} {inWatchlist && onRemoveFromWatchlist ? (
+
+
+ +

个股详情外链

+
+ +
+
+
详情页 URL 模板
+
{"支持 {code} {market} {symbol} · 留空关闭外链"}
+
+ { + setExtTpl(e.target.value) + saveStockExternalTemplate(e.target.value) + }} + placeholder="https://..." + spellCheck={false} + className="w-[26rem] max-w-[60%] h-8 px-2.5 rounded-btn border border-border bg-base text-xs font-mono text-foreground focus:border-accent/50 focus:outline-none" + /> +
+
+