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;
@@ -67,8 +67,7 @@
</details>
<div class="form-row hp-opt-toolbar hp-po-opt-toolbar options-chain-toolbar">
<span class="hp-uly-lock" id="hp-uly-lock" title="由 HEDGE_PO_MODE 锁定,不可页内切换">
<button type="button" class="btn-secondary hp-uly-btn active" data-uly="ETH" disabled>ETH</button>
<button type="button" class="btn-secondary hp-uly-btn" data-uly="BTC" disabled>BTC</button>
<span class="hp-uly-single" id="hp-uly-single" aria-live="polite">{{ hedge_option_underlying or options_default_underly or 'ETH' }}</span>
</span>
<select id="hp-exp-select"><option value="">选择到期日</option></select>
<span class="hp-oo-seg hp-po-dir-seg" role="group" aria-label="期权类型">
@@ -508,4 +507,4 @@
</div>
</div>
</div>
<script src="/static/hedge_plan.js?v=62"></script>
<script src="/static/hedge_plan.js?v=63"></script>
+5 -2
View File
@@ -7,8 +7,8 @@
<script src="/static/autofill_guard.js?v=1"></script>
<link rel="stylesheet" href="/static/instance_theme_early.css?v=4">
<link rel="stylesheet" href="/static/account_risk_badge.css?v=4">
<link rel="stylesheet" href="/static/instance_page.css?v=27">
<link rel="stylesheet" href="/static/instance_theme.css?v=123">
<link rel="stylesheet" href="/static/instance_page.css?v=28">
<link rel="stylesheet" href="/static/instance_theme.css?v=124">
<script src="/static/account_risk_badge.js?v=4"></script>
<script src="/static/open_submit_gate.js?v=1"></script>
<meta name="theme-color" content="#0b0d14">
@@ -29,6 +29,9 @@
<div class="container">
{% include 'instance_brand_header.html' %}
<nav class="top-nav embed-top-nav" aria-label="实例导航">
{% if not auth_disabled %}
<a href="/logout" class="top-nav-logout" title="退出登录">退出</a>
{% endif %}
<div class="top-nav-links">
{% if hedge_plan_nav_visible and display.show_nav_hedge_plan %}
<a href="/hedge-plan" data-embed-tab="hedge_plan" class="{% if initial_tab == 'hedge_plan' %}active{% endif %}">{% if hedge_plan_show_options_options %}期期对冲{% else %}永期对冲{% endif %}</a>
+5 -2
View File
@@ -18,8 +18,8 @@
<link rel="apple-touch-icon" href="/static/icons/apple-touch-icon.png">
<link rel="manifest" href="/static/icons/manifest.webmanifest">
<title>{{ pwa_app_name }}</title>
<link rel="stylesheet" href="/static/instance_page.css?v=27">
<link rel="stylesheet" href="/static/instance_theme.css?v=123">
<link rel="stylesheet" href="/static/instance_page.css?v=28">
<link rel="stylesheet" href="/static/instance_theme.css?v=124">
</head>
<body
@@ -152,6 +152,9 @@
<div class="container">
{% include 'instance_brand_header.html' %}
<div class="top-nav">
{% if not auth_disabled %}
<a href="/logout" class="top-nav-logout" title="退出登录">退出</a>
{% endif %}
<div class="top-nav-links">
{% if hedge_plan_nav_visible and display.show_nav_hedge_plan %}
<a href="/hedge-plan" class="{% if page == 'hedge_plan' %}active{% endif %}">{% if hedge_plan_show_options_options %}期期对冲{% else %}永期对冲{% endif %}</a>