@@ -3,10 +3,13 @@ import { Button, Dialog, DialogContent, Input, LogoBadge } from "@cap/ui";
3
3
import { faArrowLeft , faEnvelope } from "@fortawesome/free-solid-svg-icons" ;
4
4
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" ;
5
5
import { AnimatePresence } from "framer-motion" ;
6
+ import Image from "next/image" ;
6
7
import Link from "next/link" ;
8
+ import { useParams } from "next/navigation" ;
7
9
import { signIn } from "next-auth/react" ;
8
10
import { useId , useState } from "react" ;
9
11
import { toast } from "sonner" ;
12
+ import { trackEvent } from "@/app/utils/analytics" ;
10
13
import OtpForm from "./OtpForm" ;
11
14
12
15
interface AuthOverlayProps {
@@ -133,6 +136,7 @@ const StepOne = ({
133
136
setLastResendTime : ( time : number | null ) => void ;
134
137
emailId : string ;
135
138
} ) => {
139
+ const videoId = useParams ( ) . videoId ;
136
140
return (
137
141
< form
138
142
onSubmit = { async ( e ) => {
@@ -192,6 +196,29 @@ const StepOne = ({
192
196
: "Email sent to your inbox"
193
197
: "Continue with Email" }
194
198
</ 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 >
195
222
</ form >
196
223
) ;
197
224
} ;
0 commit comments