feat: remove unused hub nav items from user edition.

Drop plan/strategy/help/archive/quotes/logs from top nav and force their display prefs off.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-17 18:13:45 +08:00
parent 7e06db758d
commit d497d99a88
4 changed files with 41 additions and 109 deletions
+6 -6
View File
@@ -1101,14 +1101,14 @@ 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_quotes: bool = True
show_nav_plan: bool = False
show_nav_archive: bool = False
show_nav_quotes: bool = False
show_nav_ai: bool = True
show_nav_calculator: bool = True
show_nav_strategy: bool = True
show_nav_help: bool = True
show_nav_logs: bool = True
show_nav_strategy: bool = False
show_nav_help: bool = False
show_nav_logs: bool = False
class SupervisorSettingsBody(BaseModel):
+18 -6
View File
@@ -24,16 +24,26 @@ DEFAULT_DISPLAY = {
"show_account_pnl": True,
"show_nav_funds": True,
"show_nav_dashboard": True,
"show_nav_plan": True,
"show_nav_archive": True,
"show_nav_quotes": True,
"show_nav_plan": False,
"show_nav_archive": False,
"show_nav_quotes": False,
"show_nav_ai": True,
"show_nav_calculator": True,
"show_nav_strategy": True,
"show_nav_help": True,
"show_nav_logs": True,
"show_nav_strategy": False,
"show_nav_help": False,
"show_nav_logs": False,
}
# 用户版中控已下线的顶栏入口:读/写设置时强制关闭
REMOVED_NAV_DISPLAY_KEYS = (
"show_nav_plan",
"show_nav_archive",
"show_nav_quotes",
"show_nav_strategy",
"show_nav_help",
"show_nav_logs",
)
DEFAULT_EXCHANGES = [
{
"id": "0",
@@ -86,6 +96,8 @@ def normalize_display_prefs(raw: dict | None) -> dict:
for key in DEFAULT_DISPLAY:
if key in raw:
out[key] = bool(raw.get(key))
for key in REMOVED_NAV_DISPLAY_KEYS:
out[key] = False
return out
+16 -60
View File
@@ -21,18 +21,6 @@
return displayPref("show_nav_dashboard", true);
}
function showNavPlanPref() {
return displayPref("show_nav_plan", true);
}
function showNavArchivePref() {
return displayPref("show_nav_archive", true);
}
function showNavQuotesPref() {
return displayPref("show_nav_quotes", true);
}
function showNavAiPref() {
return displayPref("show_nav_ai", true);
}
@@ -41,31 +29,13 @@
return displayPref("show_nav_calculator", true);
}
function showNavStrategyPref() {
return displayPref("show_nav_strategy", true);
}
function showNavHelpPref() {
return displayPref("show_nav_help", true);
}
function showNavLogsPref() {
return displayPref("show_nav_logs", true);
}
function syncNavVisibility(data) {
const d = (data && data.display) || {};
const pairs = [
["nav-funds", "m-nav-funds", d.show_nav_funds === false],
["nav-dashboard", "m-nav-dashboard", d.show_nav_dashboard === false],
["nav-plan", "m-nav-plan", d.show_nav_plan === false],
["nav-archive", "m-nav-archive", d.show_nav_archive === false],
["nav-quotes", "m-nav-quotes", d.show_nav_quotes === false],
["nav-ai", "m-tab-ai", d.show_nav_ai === false],
["nav-calculator", "m-tab-calculator", d.show_nav_calculator === false],
["nav-strategy", "m-nav-strategy", d.show_nav_strategy === false],
["nav-help", "m-nav-help", d.show_nav_help === false],
["nav-logs", "m-nav-logs", d.show_nav_logs === false],
];
pairs.forEach(([desktopId, mobileId, hide]) => {
const a = document.getElementById(desktopId);
@@ -130,14 +100,18 @@
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 === "quotes") return showNavQuotesPref();
if (
page === "plan" ||
page === "archive" ||
page === "quotes" ||
page === "strategy" ||
page === "help" ||
page === "logs"
) {
return false;
}
if (page === "ai") return showNavAiPref();
if (page === "calculator") return showNavCalculatorPref();
if (page === "strategy") return showNavStrategyPref();
if (page === "help") return showNavHelpPref();
if (page === "logs") return showNavLogsPref();
return true;
}
@@ -146,25 +120,13 @@
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 quotesCb = document.getElementById("pref-show-nav-quotes");
const aiCb = document.getElementById("pref-show-nav-ai");
const calcCb = document.getElementById("pref-show-nav-calculator");
const strategyCb = document.getElementById("pref-show-nav-strategy");
const helpCb = document.getElementById("pref-show-nav-help");
const logsCb = document.getElementById("pref-show-nav-logs");
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 (quotesCb) quotesCb.checked = d.show_nav_quotes !== false;
if (aiCb) aiCb.checked = d.show_nav_ai !== false;
if (calcCb) calcCb.checked = d.show_nav_calculator !== false;
if (strategyCb) strategyCb.checked = d.show_nav_strategy !== false;
if (helpCb) helpCb.checked = d.show_nav_help !== false;
if (logsCb) logsCb.checked = d.show_nav_logs !== false;
syncNavVisibility(data);
}
@@ -5034,14 +4996,8 @@
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 quotesCb = document.getElementById("pref-show-nav-quotes");
const aiCb = document.getElementById("pref-show-nav-ai");
const calcCb = document.getElementById("pref-show-nav-calculator");
const strategyCb = document.getElementById("pref-show-nav-strategy");
const helpCb = document.getElementById("pref-show-nav-help");
const logsCb = document.getElementById("pref-show-nav-logs");
const supEnabled = document.getElementById("supervisor-enabled");
const supProg = document.getElementById("supervisor-wechat-program");
const supWebhook = document.getElementById("supervisor-wechat-webhook");
@@ -5057,14 +5013,14 @@
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_quotes: quotesCb ? !!quotesCb.checked : true,
show_nav_plan: false,
show_nav_archive: false,
show_nav_quotes: false,
show_nav_ai: aiCb ? !!aiCb.checked : true,
show_nav_calculator: calcCb ? !!calcCb.checked : true,
show_nav_strategy: strategyCb ? !!strategyCb.checked : true,
show_nav_help: helpCb ? !!helpCb.checked : true,
show_nav_logs: logsCb ? !!logsCb.checked : true,
show_nav_strategy: false,
show_nav_help: false,
show_nav_logs: false,
},
supervisor: {
enabled: supEnabled ? !!supEnabled.checked : true,
+1 -37
View File
@@ -49,17 +49,11 @@
<span id="sys-status" class="sys-pill" title="系统状态">SYNC</span>
<nav class="top-nav">
<a href="/funds" id="nav-funds">资金概况</a>
<a href="/plan" id="nav-plan">开仓计划</a>
<a href="/monitor" id="nav-monitor">监控区</a>
<a href="/strategy" id="nav-strategy">策略说明</a>
<a href="/help" id="nav-help">使用说明</a>
<a href="/market" id="nav-market">行情区</a>
<a href="/calculator" id="nav-calculator">计算器</a>
<a href="/archive" id="nav-archive">内照明心</a>
<a href="/quotes" id="nav-quotes">语录</a>
<a href="/dashboard" id="nav-dashboard">数据看板</a>
<a href="/ai" id="nav-ai">AI 教练</a>
<a href="/logs" id="nav-logs">系统日志</a>
<a href="/settings" id="nav-settings">系统设置</a>
</nav>
<button type="button" id="btn-logout" class="ghost" title="退出登录">退出</button>
@@ -1094,18 +1088,6 @@
<input type="checkbox" id="pref-show-nav-dashboard" checked />
顶栏显示「数据看板」
</label>
<label class="chk-label settings-display-chk">
<input type="checkbox" id="pref-show-nav-plan" checked />
顶栏显示「开仓计划」
</label>
<label class="chk-label settings-display-chk">
<input type="checkbox" id="pref-show-nav-archive" checked />
顶栏显示「内照明心」
</label>
<label class="chk-label settings-display-chk">
<input type="checkbox" id="pref-show-nav-quotes" checked />
顶栏显示「语录」
</label>
<label class="chk-label settings-display-chk">
<input type="checkbox" id="pref-show-nav-ai" checked />
顶栏显示「AI 教练」
@@ -1114,18 +1096,6 @@
<input type="checkbox" id="pref-show-nav-calculator" checked />
顶栏显示「计算器」
</label>
<label class="chk-label settings-display-chk">
<input type="checkbox" id="pref-show-nav-strategy" checked />
顶栏显示「策略说明」
</label>
<label class="chk-label settings-display-chk">
<input type="checkbox" id="pref-show-nav-help" checked />
顶栏显示「使用说明」
</label>
<label class="chk-label settings-display-chk">
<input type="checkbox" id="pref-show-nav-logs" checked />
顶栏显示「系统日志」
</label>
<p class="settings-display-hint">保存至 hub_settings.json,换浏览器同样生效.关闭导航后对应页面将不可从顶栏进入,直接访问 URL 会跳回监控区.</p>
</section>
@@ -1307,13 +1277,7 @@
<p class="hub-mobile-more-hint">次要功能 · 完整界面请用电脑/平板</p>
<nav class="hub-mobile-more-nav" aria-label="更多页面">
<a href="/funds" id="m-nav-funds">资金概况</a>
<a href="/plan" id="m-nav-plan">开仓计划</a>
<a href="/archive" id="m-nav-archive">内照明心</a>
<a href="/quotes" id="m-nav-quotes">语录</a>
<a href="/dashboard" id="m-nav-dashboard">数据看板</a>
<a href="/strategy" id="m-nav-strategy">策略说明</a>
<a href="/help" id="m-nav-help">使用说明</a>
<a href="/logs" id="m-nav-logs">系统日志</a>
<a href="/settings" id="m-nav-settings">系统设置</a>
</nav>
<button type="button" class="ghost hub-mobile-more-close" id="hub-mobile-more-close">关闭</button>
@@ -1382,6 +1346,6 @@
<script src="/assets/options_expiry_countdown.js?v=1"></script>
<script src="/assets/options_position_cards.js?v=1"></script>
<script src="/assets/backup.js?v=1"></script>
<script src="/assets/app.js?v=20260717-quotes-feed"></script>
<script src="/assets/app.js?v=20260717-nav-trim"></script>
</body>
</html>