diff --git a/server/landing-proxy.ts b/server/landing-proxy.ts index 4bbc8c7..e8f403d 100644 --- a/server/landing-proxy.ts +++ b/server/landing-proxy.ts @@ -55,19 +55,12 @@ function renderShellHeader(moduleId: string, modules: ModuleInfo[]): string { `; diff --git a/server/landing.ts b/server/landing.ts index 4a74c49..c22ee17 100644 --- a/server/landing.ts +++ b/server/landing.ts @@ -221,11 +221,13 @@ export function renderMainLanding(modules: ModuleInfo[]): string { import '/shell.js'; document.querySelector('rstack-app-switcher')?.setModules(${moduleListJSON}); - // Logged-in users: swap CTA to "Go to My Space" + // Logged-in users: hide header demo btn, swap hero CTA to "Go to My Space" try { var raw = localStorage.getItem('encryptid_session'); if (raw) { var session = JSON.parse(raw); + var hdrBtn = document.querySelector('.rstack-header__demo-btn'); + if (hdrBtn) hdrBtn.setAttribute('data-hide', ''); if (session?.claims?.username) { var username = session.claims.username.toLowerCase(); var primary = document.getElementById('ml-primary'); diff --git a/server/shell.ts b/server/shell.ts index 14bb991..9d48db8 100644 --- a/server/shell.ts +++ b/server/shell.ts @@ -102,15 +102,22 @@ export function renderShell(opts: ShellOptions): string { // Provide module list to app switcher document.querySelector('rstack-app-switcher')?.setModules(${moduleListJSON}); - // ── Bare-domain "Try Demo" button visibility ── - // On rspace.online (bare domain), the server internally rewrites to demo space, - // but we still want the "Try Demo" button visible since it links to the explicit demo subdomain. + // ── "Try Demo" button visibility ── + // Hidden when logged in. When logged out, shown everywhere except demo.rspace.online + // (bare rspace.online rewrites to demo internally but still shows the button). (function() { - var host = window.location.host.split(':')[0]; - if (host === 'rspace.online' || host === 'www.rspace.online') { - var btn = document.querySelector('.rstack-header__demo-btn'); - if (btn) btn.removeAttribute('data-hide'); + var btn = document.querySelector('.rstack-header__demo-btn'); + if (!btn) return; + function update() { + var loggedIn = false; + try { loggedIn = !!localStorage.getItem('encryptid_session'); } catch(e) {} + if (loggedIn) { btn.setAttribute('data-hide', ''); return; } + var host = window.location.host.split(':')[0]; + if (host === 'demo.rspace.online') { btn.setAttribute('data-hide', ''); } + else { btn.removeAttribute('data-hide'); } } + update(); + document.addEventListener('auth-change', update); })(); // ── Welcome overlay (first visit to demo) ── @@ -689,6 +696,17 @@ export function renderModuleLanding(opts: ModuleLandingOptions): string {