Add logout control and show a single locked underlying on hedge select.

Nav gains an exit link when auth is enabled; PO option picker no longer shows unused ETH/BTC toggles.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-10-14 20:22:06 +08:00
parent 5d161b4220
commit 2fecbda450
7 changed files with 57 additions and 15 deletions
+10 -7
View File
@@ -74,19 +74,22 @@
function lockPoUnderlyingUI() {
const opt = state.optionUnderly || "ETH";
const perp = state.perpUnderly || opt;
const modeLabel = root.getAttribute("data-po-mode-label") || poMode;
// 实例模式锁定:手动选约只显示一种标的(不展示 ETH/BTC 双钮)
const single = $("hp-uly-single");
if (single) {
single.textContent = crossAsset ? opt + "→" + perp : opt;
single.title = "由 HEDGE_PO_MODE 锁定(" + modeLabel + "),不可页内切换";
}
document.querySelectorAll(".hp-uly-btn").forEach(function (b) {
const uly = (b.getAttribute("data-uly") || "").toUpperCase();
const on = uly === opt;
b.classList.toggle("active", on);
b.hidden = true;
b.disabled = true;
b.title = "由 HEDGE_PO_MODE 锁定(" + (root.getAttribute("data-po-mode-label") || poMode) + ")";
});
const badge = $("hp-po-mode-badge");
if (badge) {
const perp = state.perpUnderly || opt;
badge.textContent =
(root.getAttribute("data-po-mode-label") || poMode) +
(crossAsset ? " · 期权" + opt + "/永续" + perp : "");
modeLabel + (crossAsset ? " · 期权" + opt + "/永续" + perp : "");
}
const ratioEl = $("hp-opt-perp-ratio");
if (ratioEl && lockedRatio > 0) {
+3 -1
View File
@@ -18,9 +18,11 @@
.exchange-tag{font-size:.82rem;font-weight:600;color:#b8f5d0;background:#14241e;border:1px solid #2d6a4f;padding:5px 14px;border-radius:999px;letter-spacing:.06em}
.header-row{display:flex;align-items:center;gap:8px;flex-wrap:wrap;justify-content:center}
.top-nav{display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);align-items:center;gap:10px 12px;margin-bottom:12px}
.top-nav-logout{grid-column:1;justify-self:start;align-self:center;padding:6px 10px;border:1px solid #304164;border-radius:8px;background:#151a2a;color:#c9d2ef;text-decoration:none;white-space:nowrap;font-size:.9rem}
.top-nav-logout:hover{border-color:#5a6f9a;color:#fff}
.top-nav-links{grid-column:2;display:flex;gap:8px;flex-wrap:wrap;justify-content:center;align-items:center;min-width:0}
.top-nav-links > a{flex:0 0 auto;white-space:nowrap}
.top-nav > a{justify-self:center;align-self:center;width:max-content;max-width:100%}
.top-nav > a:not(.top-nav-logout){justify-self:center;align-self:center;width:max-content;max-width:100%}
.top-nav-spot-tickers{grid-column:3;justify-self:end;display:flex;flex-direction:column;gap:3px;min-width:0}
.top-nav a{padding:6px 10px;border:1px solid #304164;border-radius:8px;background:#151a2a;color:#8fc8ff;text-decoration:none}
.top-nav a.active{background:#2a3f6c;color:#dbe4ff}
+31
View File
@@ -3637,10 +3637,41 @@ html[data-theme="light"] .opt-be-dist-down {
gap: 6px;
align-items: center;
}
.hedge-plan-page-wrap .hp-uly-single {
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 3.2rem;
padding: 6px 12px;
border: 1px solid #3a4a6e;
border-radius: 8px;
background: #1a2238;
color: #dbe4ff;
font-weight: 600;
font-size: 0.88rem;
letter-spacing: 0.03em;
cursor: default;
user-select: none;
}
.hedge-plan-page-wrap .hp-uly-lock .hp-uly-btn:disabled {
opacity: 0.75;
cursor: not-allowed;
}
.top-nav-logout {
grid-column: 1;
justify-self: start;
align-self: center;
}
html[data-theme="light"] .top-nav-logout {
color: #334;
background: #f3f5fa;
border-color: #c5cddf;
}
html[data-theme="light"] .hedge-plan-page-wrap .hp-uly-single {
background: #eef1f8;
border-color: #c5cddf;
color: #1a2438;
}
.hedge-plan-page-wrap .hp-po-gate-inline {
font-size: 0.82rem;
line-height: 1.35;