Add hub strategy calculator page with trend and roll risk-based sizing.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -33,6 +33,10 @@
|
||||
return displayPref("show_nav_ai", true);
|
||||
}
|
||||
|
||||
function showNavCalculatorPref() {
|
||||
return displayPref("show_nav_calculator", true);
|
||||
}
|
||||
|
||||
function syncNavVisibility(data) {
|
||||
const d = (data && data.display) || {};
|
||||
const navFunds = document.getElementById("nav-funds");
|
||||
@@ -40,11 +44,13 @@
|
||||
const navPlan = document.getElementById("nav-plan");
|
||||
const navArchive = document.getElementById("nav-archive");
|
||||
const navAi = document.getElementById("nav-ai");
|
||||
const navCalc = document.getElementById("nav-calculator");
|
||||
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);
|
||||
if (navCalc) navCalc.classList.toggle("nav-hidden", d.show_nav_calculator === false);
|
||||
}
|
||||
|
||||
function pageNavAllowed(page) {
|
||||
@@ -53,6 +59,7 @@
|
||||
if (page === "plan") return showNavPlanPref();
|
||||
if (page === "archive") return showNavArchivePref();
|
||||
if (page === "ai") return showNavAiPref();
|
||||
if (page === "calculator") return showNavCalculatorPref();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -64,12 +71,14 @@
|
||||
const planCb = document.getElementById("pref-show-nav-plan");
|
||||
const archiveCb = document.getElementById("pref-show-nav-archive");
|
||||
const aiCb = document.getElementById("pref-show-nav-ai");
|
||||
const calcCb = document.getElementById("pref-show-nav-calculator");
|
||||
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;
|
||||
if (calcCb) calcCb.checked = d.show_nav_calculator !== false;
|
||||
syncNavVisibility(data);
|
||||
}
|
||||
|
||||
@@ -1035,6 +1044,7 @@
|
||||
if (p.includes("dashboard")) return "dashboard";
|
||||
if (p.includes("funds")) return "funds";
|
||||
if (p.includes("plan")) return "plan";
|
||||
if (p.includes("calculator")) return "calculator";
|
||||
if (p.includes("market")) return "market";
|
||||
if (p.includes("/ai")) return "ai";
|
||||
return "monitor";
|
||||
@@ -1046,6 +1056,7 @@
|
||||
if (page === "dashboard") return "page-dashboard";
|
||||
if (page === "funds") return "page-funds";
|
||||
if (page === "plan") return "page-plan";
|
||||
if (page === "calculator") return "page-calculator";
|
||||
if (page === "market") return "page-market";
|
||||
if (page === "ai") return "page-ai";
|
||||
return "page-monitor";
|
||||
@@ -1091,6 +1102,9 @@
|
||||
} else if (window.hubPlanPage && window.hubPlanPage.destroy) {
|
||||
window.hubPlanPage.destroy();
|
||||
}
|
||||
if (page === "calculator" && window.hubCalculatorPage) {
|
||||
window.hubCalculatorPage.init();
|
||||
}
|
||||
if (page === "funds" && window.hubFundsPage) {
|
||||
window.hubFundsPage.init();
|
||||
} else if (window.hubFundsPage && window.hubFundsPage.destroy) {
|
||||
@@ -3770,6 +3784,7 @@
|
||||
const planCb = document.getElementById("pref-show-nav-plan");
|
||||
const archiveCb = document.getElementById("pref-show-nav-archive");
|
||||
const aiCb = document.getElementById("pref-show-nav-ai");
|
||||
const calcCb = document.getElementById("pref-show-nav-calculator");
|
||||
return {
|
||||
version: 1,
|
||||
display: {
|
||||
@@ -3779,6 +3794,7 @@
|
||||
show_nav_plan: planCb ? !!planCb.checked : true,
|
||||
show_nav_archive: archiveCb ? !!archiveCb.checked : true,
|
||||
show_nav_ai: aiCb ? !!aiCb.checked : true,
|
||||
show_nav_calculator: calcCb ? !!calcCb.checked : true,
|
||||
},
|
||||
exchanges: rows.map((card) => {
|
||||
const caps = [];
|
||||
|
||||
Reference in New Issue
Block a user