diff --git a/embed_templates/embed_shell.html b/embed_templates/embed_shell.html index c7f700a..8fe8a50 100644 --- a/embed_templates/embed_shell.html +++ b/embed_templates/embed_shell.html @@ -6,7 +6,7 @@ - + @@ -115,6 +115,6 @@ {% include 'embed_boot_scripts.html' %} - + diff --git a/manual_trading_hub/static/app.js b/manual_trading_hub/static/app.js index 205cc46..d0c737b 100644 --- a/manual_trading_hub/static/app.js +++ b/manual_trading_hub/static/app.js @@ -3368,6 +3368,7 @@ const d = ev.data; if (!d || typeof d !== "object") return; if (d.type === "instance-frame-navigating") { + if (d.embedShellTab) return; setInstanceFrameNavLoading(true); } else if (d.type === "instance-frame-ready") { setInstanceFrameNavLoading(false); diff --git a/static/instance_embed.js b/static/instance_embed.js index d890cd2..e8215e1 100644 --- a/static/instance_embed.js +++ b/static/instance_embed.js @@ -33,16 +33,9 @@ return ""; } - function notifyParentNavStart() { - try { - window.parent.postMessage({ type: "instance-frame-navigating" }, "*"); - } catch (_) {} - } - - function notifyParentReady() { - try { - window.parent.postMessage({ type: "instance-frame-ready" }, "*"); - } catch (_) {} + function setRootLoading(on) { + const root = document.getElementById("embed-page-root"); + if (root) root.classList.toggle("is-embed-tab-loading", !!on); } function setNavActive(tab) { @@ -99,7 +92,7 @@ if (!tab || loadingTab) return; const token = ++navToken; loadingTab = true; - notifyParentNavStart(); + setRootLoading(true); try { const qs = listWindowQueryString(); const url = "/api/embed/page/" + encodeURIComponent(tab) + (qs ? "?" + qs : ""); @@ -122,7 +115,7 @@ } finally { if (token === navToken) { loadingTab = false; - notifyParentReady(); + setRootLoading(false); } } } @@ -214,7 +207,9 @@ patchHardNavigations(); bindNav(); runPageInit(getTab()); - notifyParentReady(); + try { + window.parent.postMessage({ type: "instance-frame-ready" }, "*"); + } catch (_) {} } global.InstanceEmbed = { diff --git a/static/instance_page.css b/static/instance_page.css index 0a1bdfc..211f0a1 100644 --- a/static/instance_page.css +++ b/static/instance_page.css @@ -218,3 +218,5 @@ .stats-period-block:last-child{border-bottom:none;margin-bottom:0;padding-bottom:0} .stats-period-block h3{font-size:1rem;color:#dbe4ff;margin-bottom:4px} .stats-period-block .sub{font-size:.78rem;color:#8892b0;margin-bottom:10px;line-height:1.4} +#embed-page-root{transition:opacity .12s ease} +#embed-page-root.is-embed-tab-loading{opacity:.55;pointer-events:none}