diff --git a/packages/app/components/header/header.md.web.tsx b/packages/app/components/header/header.md.web.tsx index 9078ec06a..ff514c254 100644 --- a/packages/app/components/header/header.md.web.tsx +++ b/packages/app/components/header/header.md.web.tsx @@ -582,7 +582,7 @@ export const HeaderMd = withColorScheme(() => { > <> - {loginLoading ? "loading..." : "Email & Social"} + {loginLoading ? "loading..." : "Phone & Social"} diff --git a/packages/app/components/login/index.web.tsx b/packages/app/components/login/index.web.tsx index 51f771e58..cd7322ce4 100644 --- a/packages/app/components/login/index.web.tsx +++ b/packages/app/components/login/index.web.tsx @@ -6,10 +6,14 @@ import { usePrivy } from "@privy-io/react-auth"; import { Button } from "@showtime-xyz/universal.button"; import { useModalScreenContext } from "@showtime-xyz/universal.modal-screen"; +import { useRouter } from "@showtime-xyz/universal.router"; import { ScrollView } from "@showtime-xyz/universal.scroll-view"; import { Text } from "@showtime-xyz/universal.text"; import { View } from "@showtime-xyz/universal.view"; +import { usePreviousValue } from "app/hooks/use-previous-value"; +import { useUser } from "app/hooks/use-user"; + import { ConnectButton } from "../connect-button"; import { useLogin } from "./use-login"; @@ -27,6 +31,10 @@ export function Login() { //#endregion const modalScreenContext = useModalScreenContext(); + const user = useUser(); + const router = useRouter(); + const prevUser = usePreviousValue(user); + useEffect(() => { if (showSignMessage) { modalScreenContext?.setTitle("Sign in with your wallet to continue"); @@ -35,6 +43,13 @@ export function Login() { } }, [showSignMessage, modalScreenContext]); + useEffect(() => { + // pop back to the previous screen if the user is authenticated + if (user.isAuthenticated && !prevUser?.isAuthenticated) { + router.pop(); + } + }, [router, user, prevUser]); + return ( @@ -72,7 +87,7 @@ export function Login() { privy.login(); }} > - Email & Social + Phone & Social