From 79420904f49aae2d8de0c69ea354f28e563c300d Mon Sep 17 00:00:00 2001 From: dekun Date: Sun, 19 Jul 2026 08:10:12 +0800 Subject: [PATCH] =?UTF-8?q?Tighten=20=E6=9C=9F=E6=9C=9F=20parameter=20UI:?= =?UTF-8?q?=20compact=20controls,=20less=20copy.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- lib/common/static/hedge_plan.js | 25 +++++---- lib/common/static/instance_theme.css | 51 ++++++++++++++++--- .../templates/hedge_plan_panel.html | 30 ++++++----- 3 files changed, 77 insertions(+), 29 deletions(-) diff --git a/lib/common/static/hedge_plan.js b/lib/common/static/hedge_plan.js index 1c999ea..423a36d 100644 --- a/lib/common/static/hedge_plan.js +++ b/lib/common/static/hedge_plan.js @@ -300,9 +300,7 @@ function syncOoCloseModeUI() { const enabled = !!state.ooCloseModeEnabled; const row = $("hp-oo-close-mode-row"); - const hint = $("hp-oo-close-mode-hint"); if (row) row.classList.toggle("hidden", !enabled); - if (hint) hint.classList.toggle("hidden", !enabled); if (!enabled) state.ooCloseMode = "hold_expiry"; document.querySelectorAll(".hp-oo-close-mode").forEach(function (b) { const on = b.getAttribute("data-oo-close") === state.ooCloseMode; @@ -314,16 +312,23 @@ const line = $("hp-oo-budget-line"); if (!line) return; const b = resolveOoBudget(); - const modeLabel = state.ooSheetsMode === "split_budget" ? "均分预算" : "同张数"; - const parts = [ - "预算 min(交易×" + fmt(b.buf, 2) + ", 单笔) ≈ " + fmt(b.budget, 2) + " USDC", - "模式:" + modeLabel, - ]; - if (b.tradingCap != null) parts.push("交易×缓冲 " + fmt(b.tradingCap, 2)); - if (b.tradeCap != null) parts.push("单笔上限 " + fmt(b.tradeCap, 2)); + const sizeLabel = state.ooSheetsMode === "split_budget" ? "均分" : "同张数"; + const closeLabel = !state.ooCloseModeEnabled + ? "" + : state.ooCloseMode === "hold_expiry" + ? "到期平" + : "全平"; + const parts = ["可用 " + fmt(b.budget, 2) + "U", sizeLabel]; + if (closeLabel) parts.push(closeLabel); if (extra && extra.msg) parts.push(extra.msg); else if (b.msg) parts.push(b.msg); line.textContent = parts.join(" · "); + line.title = + "预算=min(交易×" + + fmt(b.buf, 2) + + ", 单笔)" + + (b.tradingCap != null ? " · 交易×缓冲 " + fmt(b.tradingCap, 2) : "") + + (b.tradeCap != null ? " · 单笔 " + fmt(b.tradeCap, 2) : ""); line.classList.toggle("hp-oo-budget-warn", !!(extra && extra.msg) || !b.ok); } @@ -975,6 +980,7 @@ state.ooSheetsMode = b.getAttribute("data-oo-size") || "same_sheets"; syncOoSizeModeUI(); autoFillOoSheets(); + updateOoBudgetLine(null); }); }); document.querySelectorAll(".hp-oo-close-mode").forEach(function (b) { @@ -983,6 +989,7 @@ state.ooCloseMode = b.getAttribute("data-oo-close") || "close_all"; state._ooCloseModeTouched = true; syncOoCloseModeUI(); + updateOoBudgetLine(null); }); }); if ($("hp-preview-btn")) diff --git a/lib/common/static/instance_theme.css b/lib/common/static/instance_theme.css index 4191811..1bc806f 100644 --- a/lib/common/static/instance_theme.css +++ b/lib/common/static/instance_theme.css @@ -3253,17 +3253,42 @@ html[data-theme="light"] .opt-be-dist-down { color: #ff8a8a; } .hedge-plan-page-wrap .hp-oo-legs { - margin-top: 8px; + margin-top: 10px; display: flex; flex-direction: column; gap: 8px; } -.hedge-plan-page-wrap .hp-oo-size-row { +.hedge-plan-page-wrap .hp-oo-controls { + display: grid; + grid-template-columns: 1fr 1fr; + gap: 10px 14px; + margin: 10px 0 4px; + padding: 10px 12px; + border-radius: 8px; + background: rgba(255, 255, 255, 0.03); + border: 1px solid rgba(255, 255, 255, 0.06); +} +.hedge-plan-page-wrap .hp-oo-ctrl { + display: flex; + flex-direction: column; + gap: 6px; + min-width: 0; +} +.hedge-plan-page-wrap .hp-oo-ctrl-lab { + font-size: 0.72rem; + color: var(--muted, #8b949e); + letter-spacing: 0.02em; +} +.hedge-plan-page-wrap .hp-oo-seg { display: flex; flex-wrap: wrap; - align-items: center; - gap: 8px; - margin: 6px 0 2px; + gap: 6px; +} +.hedge-plan-page-wrap .hp-oo-seg .btn-secondary { + flex: 1 1 auto; + min-width: 4.5em; + justify-content: center; + padding: 5px 8px; } .hedge-plan-page-wrap .hp-oo-size-mode.active, .hedge-plan-page-wrap .hp-oo-close-mode.active { @@ -3271,13 +3296,25 @@ html[data-theme="light"] .opt-be-dist-down { color: var(--text, #fff); background: rgba(0, 212, 255, 0.12); } -.hedge-plan-page-wrap #hp-oo-close-mode-row.hidden, -.hedge-plan-page-wrap #hp-oo-close-mode-hint.hidden { +.hedge-plan-page-wrap #hp-oo-close-mode-row.hidden { display: none !important; } +.hedge-plan-page-wrap .hp-oo-controls:has(#hp-oo-close-mode-row.hidden) { + grid-template-columns: 1fr; +} +.hedge-plan-page-wrap .hp-oo-meta { + margin: 4px 0 0; + font-size: 0.75rem; + line-height: 1.4; +} .hedge-plan-page-wrap #hp-oo-budget-line.hp-oo-budget-warn { color: #ff8a8a; } +@media (max-width: 720px) { + .hedge-plan-page-wrap .hp-oo-controls { + grid-template-columns: 1fr; + } +} .hedge-plan-page-wrap .hp-oo-leg-row { display: flex; flex-wrap: wrap; diff --git a/lib/hedge_plan/templates/hedge_plan_panel.html b/lib/hedge_plan/templates/hedge_plan_panel.html index 1a441bb..2e7b10c 100644 --- a/lib/hedge_plan/templates/hedge_plan_panel.html +++ b/lib/hedge_plan/templates/hedge_plan_panel.html @@ -138,19 +138,23 @@
-

震荡突破:设上下两个目标价(USD);触达任一侧重平盈利腿。张数=期权张 · 权利金=USDC

-
- 自动张数 - - +
+
+ 张数 +
+ + +
+
+
+ 平仓 +
+ + +
+
-
- 平仓模式 - - -
-

盈利腿平后:全平=立刻买一清另一腿(无2×,失败重试);到期平=另一腿持有至到期

-

+

腿A: 尚未选用
@@ -277,4 +281,4 @@
- +