From 8dc2a8941a153075b0aa5c30c7733ca035f5cf6a Mon Sep 17 00:00:00 2001 From: Marty Bostick Date: Wed, 29 Jul 2026 15:50:34 +0000 Subject: [PATCH] =?UTF-8?q?Add=20localStorage=20persistence=20for=20ROI=20?= =?UTF-8?q?dashboard=20=E2=80=94=20keyed=20by=20referral=20username,=20aut?= =?UTF-8?q?o-saves=20and=20auto-restores?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/index.html b/index.html index 5d170bf..f1a6df5 100644 --- a/index.html +++ b/index.html @@ -2125,6 +2125,7 @@ function updateROI() { document.getElementById('roiBarPhase').style.width = '0%'; document.querySelectorAll('.roi-ladder-step').forEach(el => el.classList.remove('active', 'passed')); document.getElementById('roiMilestones').innerHTML = '
Enter your numbers above to see your progress 🚀
'; + saveROIData(deposits, earned, phase, cyclesDone); return; } @@ -2220,6 +2221,30 @@ function updateROI() { `).join(''); + + // Save to localStorage + saveROIData(deposits, earned, phase, cyclesDone); +} + +// ─── localStorage persistence ────────────────────────── +function getROIStorageKey() { + const ref = getRefFromURL() || 'cryptoteambuild'; + return 'cbp_roi_' + ref; +} + +function saveROIData(deposits, earned, phase, cyclesDone) { + const key = getROIStorageKey(); + const data = { deposits, earned, phase, cyclesDone }; + try { localStorage.setItem(key, JSON.stringify(data)); } catch(e) {} +} + +function loadROIData() { + const key = getROIStorageKey(); + try { + const raw = localStorage.getItem(key); + if (raw) return JSON.parse(raw); + } catch(e) {} + return null; } // Wire up ROI inputs @@ -2229,6 +2254,15 @@ function updateROI() { el.addEventListener('change', updateROI); }); +// Load saved data on page load +const saved = loadROIData(); +if (saved) { + document.getElementById('roiDeposits').value = saved.deposits || ''; + document.getElementById('roiTotalEarned').value = saved.earned || ''; + if (saved.phase) document.getElementById('roiPhase').value = saved.phase; + document.getElementById('roiCyclesDone').value = saved.cyclesDone !== undefined ? saved.cyclesDone : ''; +} + // Initial render on page load (delayed to ensure DOM is ready) setTimeout(updateROI, 150);