Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

disabled states (#1086)

Ameer Al Ashhab273f2db372c1
diff --git a/apps/web/app/(org)/login/form.tsx b/apps/web/app/(org)/login/form.tsx
index 1b67b7a3c..db2a2ab97 100644
--- a/apps/web/app/(org)/login/form.tsx
+++ b/apps/web/app/(org)/login/form.tsx
@@ -464,7 +464,7 @@ const NormalLogin = ({
type="button"
className="flex gap-2 justify-center items-center w-full text-sm"
onClick={handleGoogleSignIn}
- disabled={loading}
+ disabled={loading || emailSent}
>
<Image src="/google.svg" alt="Google" width={16} height={16} />
Login with Google
@@ -489,7 +489,7 @@ const NormalLogin = ({
className="w-full"
layout
onClick={() => setShowOrgInput(true)}
- disabled={loading}
+ disabled={loading || emailSent}
>
<LucideArrowUpRight size={20} />
Login with SAML SSO
diff --git a/apps/web/app/s/[videoId]/_components/AuthOverlay.tsx b/apps/web/app/s/[videoId]/_components/AuthOverlay.tsx
index ee0af8f8b..45efd2371 100644
--- a/apps/web/app/s/[videoId]/_components/AuthOverlay.tsx
+++ b/apps/web/app/s/[videoId]/_components/AuthOverlay.tsx
@@ -137,6 +137,14 @@ const StepOne = ({
emailId: string;
}) => {
const videoId = useParams().videoId;
+ const handleGoogleSignIn = () => {
+ trackEvent("auth_started", { method: "google", is_signup: true });
+ setLoading(true);
+ signIn("google", {
+ redirect: false,
+ callbackUrl: `${window.location.origin}/s/${videoId}`,
+ });
+ };
return (
<form
onSubmit={async (e) => {
@@ -178,7 +186,7 @@ const StepOne = ({
autoComplete="email"
required
value={email}
- disabled={emailSent}
+ disabled={emailSent || loading}
onChange={(e) => {
setEmail(e.target.value);
}}
@@ -205,15 +213,7 @@ const StepOne = ({
variant="gray"
type="button"
className="flex gap-2 justify-center items-center my-1 w-full text-sm"
- onClick={() => {
- trackEvent("auth_started", { method: "google", is_signup: true });
- setLoading(true);
- signIn("google", {
- redirect: false,
- callbackUrl: `${window.location.origin}/s/${videoId}`,
- });
- setLoading(false);
- }}
+ onClick={handleGoogleSignIn}
disabled={loading}
>
<Image src="/google.svg" alt="Google" width={16} height={16} />