From 828d7d9b9afc8fdf55ccda040b5d8ddf93ec9b0a Mon Sep 17 00:00:00 2001 From: pac7 <47831526-pac7@users.noreply.replit.com> Date: Sun, 21 Sep 2025 14:18:34 +0000 Subject: [PATCH] Fix modal not opening when users try to sign in or join Update Alpine.js components to correctly handle global events for showing the authentication modal, resolving the issue where tapping sign in or join buttons did not open the modal. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 495199c6-aa06-48cd-8c40-9cccf398cfcf Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/d6d61dac-164d-45dd-929f-7dcdfd771b64/495199c6-aa06-48cd-8c40-9cccf398cfcf/4DtGbtV --- backend/static/js/alpine-components.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/backend/static/js/alpine-components.js b/backend/static/js/alpine-components.js index 0c238994..fcd3eb0b 100644 --- a/backend/static/js/alpine-components.js +++ b/backend/static/js/alpine-components.js @@ -375,6 +375,13 @@ Alpine.data('authModal', (defaultMode = 'login') => ({ this.resetForms(); } }); + + // Listen for global auth modal events + document.addEventListener('show-auth-modal', (event) => { + const mode = event.detail?.mode || 'login'; + this.show(mode); + console.log('Auth modal opened via event:', mode); + }); }, async fetchSocialProviders() { @@ -618,6 +625,21 @@ Alpine.store('toast', { }); console.log('All Alpine.js components registered successfully'); + + // Expose global authModal instance for mobile buttons + if (typeof window !== 'undefined') { + window.authModal = { + show: (mode = 'login') => { + // Dispatch custom event to trigger auth modal + const event = new CustomEvent('show-auth-modal', { + detail: { mode: mode } + }); + document.dispatchEvent(event); + console.log('Auth modal event dispatched:', mode); + } + }; + console.log('Global authModal exposed on window'); + } } // Try multiple registration approaches