@@ -3,10 +3,13 @@ import { Button, Dialog, DialogContent, Input, LogoBadge } from "@cap/ui";
33import { faArrowLeft , faEnvelope } from "@fortawesome/free-solid-svg-icons" ;
44import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" ;
55import { AnimatePresence } from "framer-motion" ;
6+ import Image from "next/image" ;
67import Link from "next/link" ;
8+ import { useParams } from "next/navigation" ;
79import { signIn } from "next-auth/react" ;
810import { useId , useState } from "react" ;
911import { toast } from "sonner" ;
12+ import { trackEvent } from "@/app/utils/analytics" ;
1013import OtpForm from "./OtpForm" ;
1114
1215interface AuthOverlayProps {
@@ -133,6 +136,7 @@ const StepOne = ({
133136 setLastResendTime : ( time : number | null ) => void ;
134137 emailId : string ;
135138} ) => {
139+ const videoId = useParams ( ) . videoId ;
136140 return (
137141 < form
138142 onSubmit = { async ( e ) => {
@@ -192,6 +196,29 @@ const StepOne = ({
192196 : "Email sent to your inbox"
193197 : "Continue with Email" }
194198 </ Button >
199+ < div className = "flex gap-4 items-center" >
200+ < span className = "flex-1 h-px bg-gray-5" />
201+ < p className = "text-sm text-center text-gray-10" > OR</ p >
202+ < span className = "flex-1 h-px bg-gray-5" />
203+ </ div >
204+ < Button
205+ variant = "gray"
206+ type = "button"
207+ className = "flex gap-2 justify-center items-center my-1 w-full text-sm"
208+ onClick = { ( ) => {
209+ trackEvent ( "auth_started" , { method : "google" , is_signup : true } ) ;
210+ setLoading ( true ) ;
211+ signIn ( "google" , {
212+ redirect : false ,
213+ callbackUrl : `${ window . location . origin } /s/${ videoId } ` ,
214+ } ) ;
215+ setLoading ( false ) ;
216+ } }
217+ disabled = { loading }
218+ >
219+ < Image src = "/google.svg" alt = "Google" width = { 16 } height = { 16 } />
220+ Login with Google
221+ </ Button >
195222 </ form >
196223 ) ;
197224} ;
0 commit comments