From 075c366a685ce2a40938c7732382f2135cd6327f Mon Sep 17 00:00:00 2001 From: gsovereignty Date: Wed, 14 Aug 2024 12:32:56 +0800 Subject: [PATCH] problem: email error not detected after valid input --- src/components/NotifyMe.svelte | 38 ++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/src/components/NotifyMe.svelte b/src/components/NotifyMe.svelte index 9243b79..2e9d429 100644 --- a/src/components/NotifyMe.svelte +++ b/src/components/NotifyMe.svelte @@ -11,19 +11,17 @@ import Login from './Login.svelte'; import { NDKPrivateKeySigner, NDKUser } from '@nostr-dev-kit/ndk'; - let email: string; + let email: string = ''; + let fax: string = ''; $: emailInValid = true; - $: emailError = ''; + $: emailError = 'Email is invalid'; const emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/; - $: if (email) { - if (!emailRegex.test(email)) { - emailInValid = true; - emailError = 'Email is invalid'; - } else { - emailInValid = false; - emailError = ''; - } + $: { + emailError = emailRegex.test(email) ? '' : 'Email is invalid'; + } + $: { + emailInValid = emailRegex.test(email) ? false : true; } async function Subscribe() { @@ -84,14 +82,15 @@ variant="nostr" class="flex h-8 shrink-0 items-center justify-center rounded-sm" > - Nostrocket is totally not ready yet but whatever + u r so early Subscribe for Updates - Subscribe now and we'll ping you when there are new releases/features + Nostrocket is under active development, many things are broken. Subscribe now and we'll ping + you when there are new releases and new features.
{#if $currentUser} @@ -101,18 +100,27 @@ {/if} If you don't use nostr, you can subscribe to updates with an email address insteadIf you don't use nostr, that's SAD! Whatever, I guess we can fax you or email you or + something
- {#if emailError} + +
+ + +
+ {#if fax.length > 0} + {/if}
{emailError ? emailError : "I'm lame, please email me with updates"}