Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Commit

Permalink
fix (#2530)
Browse files Browse the repository at this point in the history
  • Loading branch information
intergalacticspacehighway authored Nov 16, 2023
1 parent d696cf2 commit fa0ea97
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/app/components/header/header.md.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ export const HeaderMd = withColorScheme(() => {
>
<>
<Text tw="text-base font-bold text-white dark:text-black">
{loginLoading ? "loading..." : "Email & Social"}
{loginLoading ? "loading..." : "Phone & Social"}
</Text>
</>
</Button>
Expand Down
17 changes: 16 additions & 1 deletion packages/app/components/login/index.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -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");
Expand All @@ -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 (
<PortalProvider>
<ScrollView style={styles.container}>
Expand Down Expand Up @@ -72,7 +87,7 @@ export function Login() {
privy.login();
}}
>
Email & Social
Phone & Social
</Button>
<ConnectButton handleSubmitWallet={handleSubmitWallet} />
</View>
Expand Down

0 comments on commit fa0ea97

Please sign in to comment.