diff --git a/src/interface/web/app/components/loginPrompt/loginPrompt.tsx b/src/interface/web/app/components/loginPrompt/loginPrompt.tsx index ebf9707e..e6c09ffb 100644 --- a/src/interface/web/app/components/loginPrompt/loginPrompt.tsx +++ b/src/interface/web/app/components/loginPrompt/loginPrompt.tsx @@ -1,13 +1,3 @@ -import { - AlertDialog, - AlertDialogAction, - AlertDialogCancel, - AlertDialogContent, - AlertDialogDescription, - AlertDialogFooter, - AlertDialogHeader, - AlertDialogTitle, -} from "@/components/ui/alert-dialog"; import { Button } from "@/components/ui/button"; import { Dialog, @@ -21,10 +11,8 @@ import { Input } from "@/components/ui/input"; import { ArrowLeft, ArrowsClockwise, - GoogleCardboardLogo, GoogleLogo, LineVertical, - PaperPlane, PaperPlaneTilt, PencilSimple, Spinner, @@ -39,6 +27,7 @@ import { GoogleSignIn } from "./GoogleSignIn"; export interface LoginPromptProps { loginRedirectMessage: string; onOpenChange: (open: boolean) => void; + isMobileWidth?: boolean; } const fetcher = (url: string) => fetch(url).then((res) => res.json()); @@ -168,146 +157,209 @@ export default function LoginPrompt(props: LoginPromptProps) { */} {useEmailSignIn && ( -
- - - - {checkEmail ? "Check your email" : "Sign in with Email"} - - - - {checkEmail - ? recheckEmail - ? "A new link has been sent. Click on the link in your email to sign-in" - : "Click on the link in your email to sign-in" - : "You will receive a sign-in link on the email address you provide below"} - - setEmail(e.target.value)} - /> - - {checkEmail && ( - - - - - - )} -
+ )} {!useEmailSignIn && ( -
-
- {tips.map((tip, index) => ( - {tip.alt} - ))} - - -
- - - Sign In for free to start using Khoj: Your AI-powered second - brain - - -
- - {/*
*/} - - - -
- - By logging in, you agree to our{" "} - - Terms of Service. - - -
+ )}
); } + +function EmailSignInContext({ + email, + setEmail, + checkEmail, + setCheckEmail, + setUseEmailSignIn, + recheckEmail, + handleMagicLinkSignIn, +}: { + email: string; + setEmail: (email: string) => void; + checkEmail: boolean; + setCheckEmail: (checkEmail: boolean) => void; + setUseEmailSignIn: (useEmailSignIn: boolean) => void; + recheckEmail: boolean; + setRecheckEmail: (recheckEmail: boolean) => void; + handleMagicLinkSignIn: () => void; +}) { + return ( +
+ +
+
Sign in with Email
+
+
+ {checkEmail + ? recheckEmail + ? "A new link has been sent. Click on the link in your email to sign-in" + : "Click on the link in your email to sign-in" + : "You will receive a sign-in link on the email address you provide below"} +
+ setEmail(e.target.value)} + /> + + {checkEmail && ( +
+ + + +
+ )} +
+ ); +} + +function MainSignInContext({ + tips, + currentTip, + nextSlide, + prevSlide, + handleGoogleScriptLoad, + handleGoogleSignIn, + isLoading, + data, + setUseEmailSignIn, +}: { + tips: { src: string; alt: string }[]; + currentTip: number; + nextSlide: () => void; + prevSlide: () => void; + handleGoogleScriptLoad: () => void; + handleGoogleSignIn: () => void; + isLoading: boolean; + data: CredentialsData | undefined; + setUseEmailSignIn: (useEmailSignIn: boolean) => void; +}) { + return ( +
+
+ {tips.map((tip, index) => ( + {tip.alt} + ))} + + +
+
+
+ Sign In for free to start using Khoj: Your AI-powered second brain +
+
+
+ + {/*
*/} + + + +
+
+ By logging in, you agree to our{" "} + Terms of Service. +
+
+ ); +}