diff --git a/lib/common/static/instance_page.css b/lib/common/static/instance_page.css index b99e8ab..f54458d 100644 --- a/lib/common/static/instance_page.css +++ b/lib/common/static/instance_page.css @@ -11,7 +11,10 @@ .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-links{grid-column:2;display:flex;gap:8px;flex-wrap:wrap;justify-content: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 内,勿被 1fr|auto|1fr 拉成三列变形 */ + .top-nav > a{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} diff --git a/lib/common/static/instance_theme.css b/lib/common/static/instance_theme.css index 72db053..0a7f532 100644 --- a/lib/common/static/instance_theme.css +++ b/lib/common/static/instance_theme.css @@ -661,9 +661,15 @@ html[data-theme="light"] .theme-toggle-btn.is-active { 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-spot-tickers { display: flex; flex-direction: column; diff --git a/lib/common/static/instance_theme.js b/lib/common/static/instance_theme.js index 670b50b..8133ab8 100644 --- a/lib/common/static/instance_theme.js +++ b/lib/common/static/instance_theme.js @@ -171,6 +171,8 @@ function patchHubNavLinks(theme) { if (!isHubLinked()) return; + // embed 壳由 InstanceEmbed 软切 tab,勿改写为 /xxx?embed=1(会绕开壳落到 index 顶栏变形) + if (document.body && document.body.getAttribute("data-embed-shell") === "1") return; const t = normalize(theme || get()); document .querySelectorAll(".top-nav a[href], .strategy-subnav a[href]") diff --git a/lib/instance/instance_embed_lib.py b/lib/instance/instance_embed_lib.py index 614f8fe..1bf93d2 100644 --- a/lib/instance/instance_embed_lib.py +++ b/lib/instance/instance_embed_lib.py @@ -83,11 +83,13 @@ _SETTINGS_SUB_TABS = frozenset( def redirect_to_embed_shell_if_enabled(page: str): - """直连 /trade 等整页路由时,重定向到 embed 壳(顶栏常驻,tab 软切换).""" + """直连 /trade 等整页路由时,重定向到 embed 壳(顶栏常驻,tab 软切换). + + 注意:中控 iframe 会给导航链加 embed=1;若因此跳过重定向,会落到 index 整页, + 顶栏链接变成 3 列 grid 子项而变形.embed=1 时仍应进 /embed 壳. + """ if not embed_shell_enabled(): return None - if (request.args.get("embed") or "").strip() == "1": - return None if (request.path or "").rstrip("/") == "/embed": return None q = {k: v for k, v in request.args.items()} diff --git a/lib/instance/templates/embed_shell.html b/lib/instance/templates/embed_shell.html index bfe77ab..56a580e 100644 --- a/lib/instance/templates/embed_shell.html +++ b/lib/instance/templates/embed_shell.html @@ -4,12 +4,12 @@ - + - - + + diff --git a/lib/instance/templates/index.html b/lib/instance/templates/index.html index ac05576..8665f3d 100644 --- a/lib/instance/templates/index.html +++ b/lib/instance/templates/index.html @@ -4,7 +4,7 @@ - + @@ -18,8 +18,8 @@ {{ pwa_app_name }} - - + +

加密货币|交易监控 + AI复盘一体化

-
+
+ {% include 'nav_spot_tickers.html' %} + {% with msg=get_flashed_messages() %}{% if msg %}
{{ msg[0] }}
{% endif %}{% endwith %} {% include 'instance_header_panel.html' %} @@ -2077,6 +2080,7 @@ setInterval(refreshPriceSnapshotConditional, {{ price_refresh_seconds * 1000 }}) +