From 3b5a8c1ff95aa807c671b302f84452c04766f5a8 Mon Sep 17 00:00:00 2001 From: dekun Date: Fri, 7 Aug 2026 17:37:34 +0800 Subject: [PATCH] =?UTF-8?q?Highlight=20=E6=9C=9F=E6=9C=9F=20hedge=20mode?= =?UTF-8?q?=20in=20control=20monitor=20with=20amber.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- control/frontend/src/pages/Monitor.tsx | 45 ++++++++++++++++++++++---- control/frontend/src/styles.css | 11 +++++++ 2 files changed, 50 insertions(+), 6 deletions(-) diff --git a/control/frontend/src/pages/Monitor.tsx b/control/frontend/src/pages/Monitor.tsx index edfa877..e3003e5 100644 --- a/control/frontend/src/pages/Monitor.tsx +++ b/control/frontend/src/pages/Monitor.tsx @@ -242,11 +242,41 @@ function hedgeModeShort(strat: Record): string { return hm === "option_option" ? "期期" : "永期"; } -function modeLabel(mode: string, strat: Record): string { +function modeParts( + mode: string, + strat: Record, +): { head: string; hedge: string; isOo: boolean } { const m = String(mode || "-").toUpperCase(); const short = m.includes("LIVE") ? "LIVE" : m.includes("SIM") ? "SIM" : m || "-"; - // A=以损定仓,B=手动开仓;永期=永续+期权,期期=双期权 - return `${short}/${riskLines(strat).sizingShort}/${hedgeModeShort(strat)}`; + const hedge = hedgeModeShort(strat); + return { + head: `${short}/${riskLines(strat).sizingShort}`, + hedge, + isOo: hedge === "期期", + }; +} + +function modeLabel(mode: string, strat: Record): string { + const p = modeParts(mode, strat); + return `${p.head}/${p.hedge}`; +} + +function ModeLabelView({ + mode, + strat, +}: { + mode: string; + strat: Record; +}) { + const p = modeParts(mode, strat); + return ( + <> + {p.head}/ + + {p.hedge} + + + ); } function modeLabelTitle(mode: string, strat: Record): string { @@ -793,7 +823,7 @@ export default function MonitorPage() { className="mono" title={modeLabelTitle(s.mode, s.strat)} > - {modeLabel(s.mode, s.strat)} + {s.exchange} @@ -992,8 +1022,11 @@ export default function MonitorPage() { {detailRunning ? "运行中" : "已停"} · {detail.phase} - {modeLabel(detail.mode, detail.strat)} /{" "} - {detail.exchange} + {" "} + / {detail.exchange} {detail.rounds ?? "—"} diff --git a/control/frontend/src/styles.css b/control/frontend/src/styles.css index dd013c9..c93265a 100644 --- a/control/frontend/src/styles.css +++ b/control/frontend/src/styles.css @@ -413,6 +413,17 @@ input { text-shadow: 0 0 8px rgba(0, 200, 255, 0.25); } +/* 中控模式列:期期高亮,永期保持弱化 */ +.mode-hedge-oo { + color: #ffb020; + text-shadow: 0 0 8px rgba(255, 176, 32, 0.45); + font-weight: 700; +} + +.mode-hedge-po { + color: var(--muted); +} + .dot { width: 9px; height: 9px;