From 9ad2518f67af7df33538e6fa193e1201735a0bcd Mon Sep 17 00:00:00 2001 From: thecodrr Date: Mon, 4 Jan 2021 11:56:39 +0500 Subject: [PATCH] fix: improve email verification dialog ux --- .../dialogs/email-verification-dialog.js | 54 ++++++++++++------- apps/web/yarn.lock | 14 ++++- 2 files changed, 49 insertions(+), 19 deletions(-) diff --git a/apps/web/src/components/dialogs/email-verification-dialog.js b/apps/web/src/components/dialogs/email-verification-dialog.js index 295a244cc..02f3060a4 100644 --- a/apps/web/src/components/dialogs/email-verification-dialog.js +++ b/apps/web/src/components/dialogs/email-verification-dialog.js @@ -8,6 +8,8 @@ import { useState } from "react"; function EmailVerificationDialog(props) { const user = useUserStore((store) => store.user); const [error, setError] = useState(); + const [isSending, setIsSending] = useState(false); + const [canSendAgain, setCanSendAgain] = useState(true); if (!user) { props.onCancel(); return; @@ -18,7 +20,12 @@ function EmailVerificationDialog(props) { title={"Verify your email"} description={"Please check your inbox for the confirmation email."} onClose={props.onCancel} - negativeButton={{ text: "Done", onClick: props.onCancel }} + positiveButton={{ + text: "Done", + onClick: props.onCancel, + loading: isSending, + disabled: isSending, + }} > {user.email}. - - {error && ( - - {error} - + {canSendAgain && ( + )} + + {isSending + ? "Sending confirmation email. Please wait..." + : !canSendAgain && !isSending + ? "Confirmation email sent. You can resend the email after 1 minute in case you didn't receive it." + : !!error + ? error + : ""} + ); diff --git a/apps/web/yarn.lock b/apps/web/yarn.lock index 68fcd257e..9475e8193 100644 --- a/apps/web/yarn.lock +++ b/apps/web/yarn.lock @@ -8973,9 +8973,21 @@ normalize-url@^3.0.0, normalize-url@^3.0.1: resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-3.3.0.tgz#b2e1c4dc4f7c6d57743df733a4f5978d18650559" integrity sha512-U+JJi7duF1o+u2pynbp2zXDW2/PADgC30f0GsHZtRh+HOcXHnw137TrNlyxxRvWW5fjKd3bcLHPxofWuCjaeZg== +notes-core@../notes-core: + version "5.2.1" + dependencies: + fast-sort "^2.0.1" + fuzzysearch "^1.0.3" + jshashes "^1.0.8" + no-internet "^1.5.2" + qclone "^1.0.4" + quill-delta-to-html "^0.12.0" + quill-delta-to-markdown "https://github.com/streetwriters/quill-delta-to-markdown" + transfun "^1.0.2" + "notes-core@git+ssh://git@github.com:streetwriters/notesnook-core.git": version "5.2.1" - resolved "git+ssh://git@github.com:streetwriters/notesnook-core.git#f7c739694e8e5c899bc866bdf53df5cd4884637f" + resolved "git+ssh://git@github.com:streetwriters/notesnook-core.git#5f4b4365dc3d24ccf15ea0272dc67fdfd79c4af9" dependencies: fast-sort "^2.0.1" fuzzysearch "^1.0.3"