From caf4996159334be0f43821104acf56f44378cd6e Mon Sep 17 00:00:00 2001 From: dekun Date: Tue, 23 Jun 2026 17:19:12 +0800 Subject: [PATCH] Add settings toggles for plan, archive, and AI coach nav items. Co-authored-by: Cursor --- manual_trading_hub/hub.py | 3 +++ manual_trading_hub/settings_store.py | 3 +++ manual_trading_hub/static/app.js | 33 ++++++++++++++++++++++++++++ manual_trading_hub/static/index.html | 16 ++++++++++++-- 4 files changed, 53 insertions(+), 2 deletions(-) diff --git a/manual_trading_hub/hub.py b/manual_trading_hub/hub.py index 889b33f..1d6933a 100644 --- a/manual_trading_hub/hub.py +++ b/manual_trading_hub/hub.py @@ -790,6 +790,9 @@ class SettingsDisplayBody(BaseModel): show_account_pnl: bool = True show_nav_funds: bool = True show_nav_dashboard: bool = True + show_nav_plan: bool = True + show_nav_archive: bool = True + show_nav_ai: bool = True class SettingsBody(BaseModel): diff --git a/manual_trading_hub/settings_store.py b/manual_trading_hub/settings_store.py index 142852e..1ee77d2 100644 --- a/manual_trading_hub/settings_store.py +++ b/manual_trading_hub/settings_store.py @@ -13,6 +13,9 @@ DEFAULT_DISPLAY = { "show_account_pnl": True, "show_nav_funds": True, "show_nav_dashboard": True, + "show_nav_plan": True, + "show_nav_archive": True, + "show_nav_ai": True, } DEFAULT_EXCHANGES = [ diff --git a/manual_trading_hub/static/app.js b/manual_trading_hub/static/app.js index 6c6d1e6..6b16a43 100644 --- a/manual_trading_hub/static/app.js +++ b/manual_trading_hub/static/app.js @@ -21,17 +21,38 @@ return displayPref("show_nav_dashboard", true); } + function showNavPlanPref() { + return displayPref("show_nav_plan", true); + } + + function showNavArchivePref() { + return displayPref("show_nav_archive", true); + } + + function showNavAiPref() { + return displayPref("show_nav_ai", true); + } + function syncNavVisibility(data) { const d = (data && data.display) || {}; const navFunds = document.getElementById("nav-funds"); const navDash = document.getElementById("nav-dashboard"); + const navPlan = document.getElementById("nav-plan"); + const navArchive = document.getElementById("nav-archive"); + const navAi = document.getElementById("nav-ai"); if (navFunds) navFunds.classList.toggle("nav-hidden", d.show_nav_funds === false); if (navDash) navDash.classList.toggle("nav-hidden", d.show_nav_dashboard === false); + if (navPlan) navPlan.classList.toggle("nav-hidden", d.show_nav_plan === false); + if (navArchive) navArchive.classList.toggle("nav-hidden", d.show_nav_archive === false); + if (navAi) navAi.classList.toggle("nav-hidden", d.show_nav_ai === false); } function pageNavAllowed(page) { if (page === "funds") return showNavFundsPref(); if (page === "dashboard") return showNavDashboardPref(); + if (page === "plan") return showNavPlanPref(); + if (page === "archive") return showNavArchivePref(); + if (page === "ai") return showNavAiPref(); return true; } @@ -40,9 +61,15 @@ const pnlCb = document.getElementById("pref-show-account-pnl"); const fundsCb = document.getElementById("pref-show-nav-funds"); const dashCb = document.getElementById("pref-show-nav-dashboard"); + const planCb = document.getElementById("pref-show-nav-plan"); + const archiveCb = document.getElementById("pref-show-nav-archive"); + const aiCb = document.getElementById("pref-show-nav-ai"); if (pnlCb) pnlCb.checked = d.show_account_pnl !== false; if (fundsCb) fundsCb.checked = d.show_nav_funds !== false; if (dashCb) dashCb.checked = d.show_nav_dashboard !== false; + if (planCb) planCb.checked = d.show_nav_plan !== false; + if (archiveCb) archiveCb.checked = d.show_nav_archive !== false; + if (aiCb) aiCb.checked = d.show_nav_ai !== false; syncNavVisibility(data); } @@ -3740,12 +3767,18 @@ const pnlCb = document.getElementById("pref-show-account-pnl"); const fundsCb = document.getElementById("pref-show-nav-funds"); const dashCb = document.getElementById("pref-show-nav-dashboard"); + const planCb = document.getElementById("pref-show-nav-plan"); + const archiveCb = document.getElementById("pref-show-nav-archive"); + const aiCb = document.getElementById("pref-show-nav-ai"); return { version: 1, display: { show_account_pnl: pnlCb ? !!pnlCb.checked : true, show_nav_funds: fundsCb ? !!fundsCb.checked : true, show_nav_dashboard: dashCb ? !!dashCb.checked : true, + show_nav_plan: planCb ? !!planCb.checked : true, + show_nav_archive: archiveCb ? !!archiveCb.checked : true, + show_nav_ai: aiCb ? !!aiCb.checked : true, }, exchanges: rows.map((card) => { const caps = []; diff --git a/manual_trading_hub/static/index.html b/manual_trading_hub/static/index.html index a24ec20..d63b26a 100644 --- a/manual_trading_hub/static/index.html +++ b/manual_trading_hub/static/index.html @@ -723,7 +723,19 @@ 顶栏显示「数据看板」 -

保存至 hub_settings.json,换浏览器同样生效。关闭导航后对应页面将不可从顶栏进入。

+ + + +

保存至 hub_settings.json,换浏览器同样生效。关闭导航后对应页面将不可从顶栏进入,直接访问 URL 会跳回监控区。

宏观关键数据(风控前置)

@@ -816,6 +828,6 @@ - +