interactive intro to open social at-me.zzstoatzz.io

fix: auto-open guestbook sign modal after OAuth login

Save a 'guestbook' intent in sessionStorage before the OAuth redirect,
then consume it after init to automatically open the sign modal instead
of making the user click again.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

+16 -2
+7 -1
src/view/main.js
··· 17 17 import { checkGuestbookState } from './guestbook-state.js'; 18 18 import { initGuestbookUI, updateAuthUI } from './guestbook-ui.js'; 19 19 import { initFirehoseUI } from './firehose.js'; 20 - import { initOAuth, handleOAuthCallback, tryResumeSession } from './oauth.js'; 20 + import { initOAuth, handleOAuthCallback, tryResumeSession, consumeReturnIntent } from './oauth.js'; 21 21 import { initOnboarding } from './onboarding.js'; 22 22 23 23 // ============================================================================ ··· 146 146 147 147 // Check guestbook state 148 148 await checkGuestbookState(); 149 + 150 + // If we just came back from OAuth login for the guestbook, open the sign modal 151 + const intent = consumeReturnIntent(); 152 + if (intent === 'guestbook') { 153 + document.getElementById('signGuestbookBtn')?.click(); 154 + } 149 155 150 156 } catch (error) { 151 157 console.error('Initialization error:', error);
+9 -1
src/view/oauth.js
··· 95 95 scope: import.meta.env.VITE_OAUTH_SCOPE, 96 96 }); 97 97 98 - // Save current URL so we can restore it after the OAuth callback 98 + // Save current URL and intent so we can restore after the OAuth callback 99 99 sessionStorage.setItem('oauth_return_url', window.location.href); 100 + sessionStorage.setItem('oauth_return_intent', 'guestbook'); 100 101 101 102 // Small delay to ensure storage is persisted 102 103 await new Promise(resolve => setTimeout(resolve, 200)); ··· 133 134 agent = null; 134 135 currentDid = null; 135 136 localStorage.removeItem('oauth_did'); 137 + } 138 + 139 + // Check and consume the post-login intent (e.g. 'guestbook') 140 + export function consumeReturnIntent() { 141 + const intent = sessionStorage.getItem('oauth_return_intent'); 142 + sessionStorage.removeItem('oauth_return_intent'); 143 + return intent; 136 144 } 137 145 138 146 // Get current auth status