From 9dde412781fb7ba69875291333c573d99e23921d Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Fri, 13 Mar 2026 17:01:57 -0400 Subject: [PATCH] feat(sign-in): replace alert() with inline status on email sign-in button MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removes the debug alert() calls from the email magic-link flow. Button now shows live feedback inline: - 'Sending…' while the lookup is in flight (disabled + cursor-wait) - 'Email sent ✓' on success (green fill) - 'No account found' if no user matches the email - 'Error — retry?' on network/API failure - 'Enter an email first' if submitted empty Clicking the button while showing a result resets it to the default label. Co-Authored-By: Claude Sonnet 4.6 --- .../app_components/e_app_sign_in_out.svelte | 47 ++++++++++++++----- 1 file changed, 36 insertions(+), 11 deletions(-) diff --git a/src/lib/app_components/e_app_sign_in_out.svelte b/src/lib/app_components/e_app_sign_in_out.svelte index 39dd9322..63b1bd76 100644 --- a/src/lib/app_components/e_app_sign_in_out.svelte +++ b/src/lib/app_components/e_app_sign_in_out.svelte @@ -73,6 +73,9 @@ let is_changing_password = $state(false); let show_password_text = $state('password'); // password or text + // Email sign-in status: null | 'sending' | 'sent' | 'not_found' | 'error' + let email_send_status: null | string = $state(null); + function sign_in() { $ae_loc.jwt = user_obj.jwt; // Store the JSON Web Token $ae_loc.person_id = person_id; // Set the person_id in the ae_loc store @@ -231,17 +234,19 @@ .then((user_response) => { if (user_response?.user_id_random) { console.log(`User found for email:`, user_response); - handle_send_auth_email({ - user_id: user_response.user_id_random - }); + handle_send_auth_email({ user_id: user_response.user_id_random }); + email_send_status = 'sent'; } else if (user_response && user_response.length > 0) { console.log(`Multiple users found for email:`, user_response); - handle_send_auth_email({ - user_id: user_response[0].user_id_random - }); + handle_send_auth_email({ user_id: user_response[0].user_id_random }); + email_send_status = 'sent'; } else { - alert('No user found with that email address.'); + console.warn('No user found for email:', email); + email_send_status = 'not_found'; } + }) + .catch(() => { + email_send_status = 'error'; }); } @@ -378,12 +383,12 @@ onsubmit={async (e) => { e.preventDefault(); if ($ae_sess.auth__entered_email) { - alert('Attempting to look up user by email address.'); + email_send_status = 'sending'; handle_lookup_user_email({ email: $ae_sess.auth__entered_email }); } else { - alert('Please enter an email address to look up.'); + email_send_status = 'no_email'; } }} > @@ -397,11 +402,31 @@ />