diff --git a/server/shell.ts b/server/shell.ts index 761866c..c3e5a02 100644 --- a/server/shell.ts +++ b/server/shell.ts @@ -370,7 +370,19 @@ export function renderShell(opts: ShellOptions): string { }); if (infoClose) infoClose.addEventListener('click', hideInfoPanel); - // Reset when switching tabs + // Auto-show on first visit per rApp (checks localStorage, shows once then never again) + function autoShowIfFirstVisit(mid) { + if (!mid || mid === 'rspace') return; // skip canvas + try { + var key = 'rapp_info_seen_' + mid; + if (localStorage.getItem(key)) return; // already seen + if (!localStorage.getItem('encryptid_session')) return; // not logged in + localStorage.setItem(key, '1'); + setTimeout(function() { showInfoPanel(mid); }, 800); + } catch(e) {} + } + + // Reset when switching tabs — auto-show for newly visited rApps document.addEventListener('layer-view-mode', hideInfoPanel); const tb = document.querySelector('rstack-tab-bar'); if (tb) { @@ -378,20 +390,14 @@ export function renderShell(opts: ShellOptions): string { hideInfoPanel(); // Reset cached module so next open loads fresh content for new tab infoPanel.dataset.loadedModule = ''; + // Auto-show info panel if this is the user's first visit to this rApp + var switchedModuleId = e.detail && e.detail.moduleId; + if (switchedModuleId) autoShowIfFirstVisit(switchedModuleId); }); } - // Auto-show on first visit per rApp - const seenKey = 'rapp_info_seen_' + '${escapeAttr(moduleId)}'; - if (!localStorage.getItem(seenKey)) { - // Only auto-show for logged-in users (not on first-ever visit) - try { - if (localStorage.getItem('encryptid_session')) { - setTimeout(() => { showInfoPanel('${escapeAttr(moduleId)}'); }, 800); - localStorage.setItem(seenKey, '1'); - } - } catch(e) {} - } + // Auto-show on initial page load + autoShowIfFirstVisit('${escapeAttr(moduleId)}'); // Expose for tour integration window.__rspaceShowInfo = showInfoPanel;