From 58c3d9c62fc551237625a5f8b3794fca796b1df3 Mon Sep 17 00:00:00 2001 From: Local Dev Date: Wed, 9 Sep 2026 00:37:05 +0200 Subject: [PATCH] fix(sirius-x): wallet dropdown routes to portal inline, no more overlay MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Nav wallet dropdown was calling window.siriusSignInWallet(action), which opens the shared modal on whatever page you were on β€” so from tld.html or docs/, a Create/Import/WC click drew the sign-in over the current page as a full-screen overlay. User: 'still opens as a separate console on top of the page, it should be within the page'. Now the click handler: - if we are already on portal.html AND siriusRenderSignInInline is loaded, paint the tabbed sign-in inside portal's #signin-inline directly and scroll to it - otherwise navigate to portal.html?mode=, where the bootstrap already renders the tabbed sign-in inline as the page's own content Same tabs, same forms β€” the four options (πŸ”“ Unlock / πŸ†• Create / πŸ“₯ Import / πŸ”— WizardConnect) β€” but they now live inside the page, not on top of it. Unlock falls back to Import when there's no saved wallet in that browser. --- js/profile-menu.js | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/js/profile-menu.js b/js/profile-menu.js index 339ada6..ca252c1 100644 --- a/js/profile-menu.js +++ b/js/profile-menu.js @@ -162,17 +162,25 @@ } if (["new", "import", "wc", "unlock"].includes(action)) { close(); - const savedLabel = btn.querySelector(".wallet-label")?.textContent; - const walletLabel = btn.querySelector(".wallet-label"); - if (walletLabel) walletLabel.textContent = "loading…"; - const ready = await ensureFlow(); - if (walletLabel && savedLabel) walletLabel.textContent = savedLabel; - if (ready) { - window.siriusSignInWallet(action); - } else { - // Fallback: navigate to portal.html?mode=X if the module can't load. - location.href = PORTAL_URL + "?mode=" + action; + // Always route to the portal β€” it renders the tabbed sign-in INLINE + // as page content (?mode=X picks the starting tab). Prevents the + // "modal opens on top of the page" symptom the launcher used to have. + // Only stay on-page if we're already on portal.html. + const onPortal = /\/portal\.html(?:$|[?#])/.test(location.pathname + location.search); + if (onPortal && typeof window.siriusRenderSignInInline === "function") { + const hasSaved = (() => { try { return !!localStorage.getItem("bns.wallet.v1"); } catch { return false; } })(); + const mode = (action === "unlock" && !hasSaved) ? "import" : action; + const mount = document.getElementById("signin-inline"); + if (mount) { + window.siriusRenderSignInInline(mount, mode); + document.getElementById("signin")?.scrollIntoView({ behavior: "smooth", block: "start" }); + return; + } } + // Not on portal (or the inline mount is missing) β€” take the user + // there. portal.html?mode=X renders the tabbed sign-in as its main + // content, no modal. + location.href = PORTAL_URL + "?mode=" + action; } });