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:
@@ -6882,6 +6882,7 @@ def render_main_page(page="trade", embed_mode=None):
|
|||||||
|
|
||||||
_hedge_po_mode_payload = _po_mode_public()
|
_hedge_po_mode_payload = _po_mode_public()
|
||||||
template_ctx = dict(
|
template_ctx = dict(
|
||||||
|
auth_disabled=AUTH_DISABLED,
|
||||||
page=page,
|
page=page,
|
||||||
key=key_list,
|
key=key_list,
|
||||||
key_history=key_history,
|
key_history=key_history,
|
||||||
|
|||||||
@@ -74,19 +74,22 @@
|
|||||||
|
|
||||||
function lockPoUnderlyingUI() {
|
function lockPoUnderlyingUI() {
|
||||||
const opt = state.optionUnderly || "ETH";
|
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) {
|
document.querySelectorAll(".hp-uly-btn").forEach(function (b) {
|
||||||
const uly = (b.getAttribute("data-uly") || "").toUpperCase();
|
b.hidden = true;
|
||||||
const on = uly === opt;
|
|
||||||
b.classList.toggle("active", on);
|
|
||||||
b.disabled = true;
|
b.disabled = true;
|
||||||
b.title = "由 HEDGE_PO_MODE 锁定(" + (root.getAttribute("data-po-mode-label") || poMode) + ")";
|
|
||||||
});
|
});
|
||||||
const badge = $("hp-po-mode-badge");
|
const badge = $("hp-po-mode-badge");
|
||||||
if (badge) {
|
if (badge) {
|
||||||
const perp = state.perpUnderly || opt;
|
|
||||||
badge.textContent =
|
badge.textContent =
|
||||||
(root.getAttribute("data-po-mode-label") || poMode) +
|
modeLabel + (crossAsset ? " · 期权" + opt + "/永续" + perp : "");
|
||||||
(crossAsset ? " · 期权" + opt + "/永续" + perp : "");
|
|
||||||
}
|
}
|
||||||
const ratioEl = $("hp-opt-perp-ratio");
|
const ratioEl = $("hp-opt-perp-ratio");
|
||||||
if (ratioEl && lockedRatio > 0) {
|
if (ratioEl && lockedRatio > 0) {
|
||||||
|
|||||||
@@ -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}
|
.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}
|
.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{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{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-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-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{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}
|
.top-nav a.active{background:#2a3f6c;color:#dbe4ff}
|
||||||
|
|||||||
@@ -3637,10 +3637,41 @@ html[data-theme="light"] .opt-be-dist-down {
|
|||||||
gap: 6px;
|
gap: 6px;
|
||||||
align-items: center;
|
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 {
|
.hedge-plan-page-wrap .hp-uly-lock .hp-uly-btn:disabled {
|
||||||
opacity: 0.75;
|
opacity: 0.75;
|
||||||
cursor: not-allowed;
|
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 {
|
.hedge-plan-page-wrap .hp-po-gate-inline {
|
||||||
font-size: 0.82rem;
|
font-size: 0.82rem;
|
||||||
line-height: 1.35;
|
line-height: 1.35;
|
||||||
|
|||||||
@@ -67,8 +67,7 @@
|
|||||||
</details>
|
</details>
|
||||||
<div class="form-row hp-opt-toolbar hp-po-opt-toolbar options-chain-toolbar">
|
<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 锁定,不可页内切换">
|
<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>
|
<span class="hp-uly-single" id="hp-uly-single" aria-live="polite">{{ hedge_option_underlying or options_default_underly or 'ETH' }}</span>
|
||||||
<button type="button" class="btn-secondary hp-uly-btn" data-uly="BTC" disabled>BTC</button>
|
|
||||||
</span>
|
</span>
|
||||||
<select id="hp-exp-select"><option value="">选择到期日</option></select>
|
<select id="hp-exp-select"><option value="">选择到期日</option></select>
|
||||||
<span class="hp-oo-seg hp-po-dir-seg" role="group" aria-label="期权类型">
|
<span class="hp-oo-seg hp-po-dir-seg" role="group" aria-label="期权类型">
|
||||||
@@ -508,4 +507,4 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script src="/static/hedge_plan.js?v=62"></script>
|
<script src="/static/hedge_plan.js?v=63"></script>
|
||||||
|
|||||||
@@ -7,8 +7,8 @@
|
|||||||
<script src="/static/autofill_guard.js?v=1"></script>
|
<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/instance_theme_early.css?v=4">
|
||||||
<link rel="stylesheet" href="/static/account_risk_badge.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_page.css?v=28">
|
||||||
<link rel="stylesheet" href="/static/instance_theme.css?v=123">
|
<link rel="stylesheet" href="/static/instance_theme.css?v=124">
|
||||||
<script src="/static/account_risk_badge.js?v=4"></script>
|
<script src="/static/account_risk_badge.js?v=4"></script>
|
||||||
<script src="/static/open_submit_gate.js?v=1"></script>
|
<script src="/static/open_submit_gate.js?v=1"></script>
|
||||||
<meta name="theme-color" content="#0b0d14">
|
<meta name="theme-color" content="#0b0d14">
|
||||||
@@ -29,6 +29,9 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
{% include 'instance_brand_header.html' %}
|
{% include 'instance_brand_header.html' %}
|
||||||
<nav class="top-nav embed-top-nav" aria-label="实例导航">
|
<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">
|
<div class="top-nav-links">
|
||||||
{% if hedge_plan_nav_visible and display.show_nav_hedge_plan %}
|
{% 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>
|
<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>
|
||||||
|
|||||||
@@ -18,8 +18,8 @@
|
|||||||
<link rel="apple-touch-icon" href="/static/icons/apple-touch-icon.png">
|
<link rel="apple-touch-icon" href="/static/icons/apple-touch-icon.png">
|
||||||
<link rel="manifest" href="/static/icons/manifest.webmanifest">
|
<link rel="manifest" href="/static/icons/manifest.webmanifest">
|
||||||
<title>{{ pwa_app_name }}</title>
|
<title>{{ pwa_app_name }}</title>
|
||||||
<link rel="stylesheet" href="/static/instance_page.css?v=27">
|
<link rel="stylesheet" href="/static/instance_page.css?v=28">
|
||||||
<link rel="stylesheet" href="/static/instance_theme.css?v=123">
|
<link rel="stylesheet" href="/static/instance_theme.css?v=124">
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body
|
<body
|
||||||
@@ -152,6 +152,9 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
{% include 'instance_brand_header.html' %}
|
{% include 'instance_brand_header.html' %}
|
||||||
<div class="top-nav">
|
<div class="top-nav">
|
||||||
|
{% if not auth_disabled %}
|
||||||
|
<a href="/logout" class="top-nav-logout" title="退出登录">退出</a>
|
||||||
|
{% endif %}
|
||||||
<div class="top-nav-links">
|
<div class="top-nav-links">
|
||||||
{% if hedge_plan_nav_visible and display.show_nav_hedge_plan %}
|
{% 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>
|
<a href="/hedge-plan" class="{% if page == 'hedge_plan' %}active{% endif %}">{% if hedge_plan_show_options_options %}期期对冲{% else %}永期对冲{% endif %}</a>
|
||||||
|
|||||||
Reference in New Issue
Block a user