fix(sirius-x): wallet dropdown routes to portal inline, no more overlay

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=<action>, 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.
This commit is contained in:
Local Dev 2026-09-09 00:37:05 +02:00
parent 0dc79c6c13
commit 58c3d9c62f

View file

@ -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;
}
});