diff --git a/apps/scoutgame/components/common/WarpcastLogin/FarcasterModal.tsx b/apps/scoutgame/components/common/WarpcastLogin/FarcasterModal.tsx index eaf4e921fe..8eecfbabc1 100644 --- a/apps/scoutgame/components/common/WarpcastLogin/FarcasterModal.tsx +++ b/apps/scoutgame/components/common/WarpcastLogin/FarcasterModal.tsx @@ -6,7 +6,7 @@ import { Paper } from '@mui/material'; import Box from '@mui/material/Box'; import Link from '@mui/material/Link'; import type { ModalProps } from '@mui/material/Modal'; -import Modal from '@mui/material/Modal'; +import Dialog from '@mui/material/Modal'; import Typography from '@mui/material/Typography'; const sx = { @@ -21,9 +21,9 @@ const sx = { borderRadius: 3 }; -export function FarcasterLoginModal({ url, ...props }: Omit & { url?: string }) { +export function FarcasterLoginModal({ url, open, onClose }: Omit & { url?: string }) { return ( - + Sign in with Farcaster @@ -39,6 +39,6 @@ export function FarcasterLoginModal({ url, ...props }: Omit - + ); } diff --git a/apps/scoutgame/components/common/WarpcastLogin/WarpcastLoginButton.tsx b/apps/scoutgame/components/common/WarpcastLogin/WarpcastLoginButton.tsx index ef07d2ad3c..f81ae4ec92 100644 --- a/apps/scoutgame/components/common/WarpcastLogin/WarpcastLoginButton.tsx +++ b/apps/scoutgame/components/common/WarpcastLogin/WarpcastLoginButton.tsx @@ -6,10 +6,10 @@ import { useProfile } from '@farcaster/auth-kit'; import type { StatusAPIResponse, AuthClientError } from '@farcaster/auth-kit'; import type { ButtonProps } from '@mui/material'; import { Box, Button, Typography } from '@mui/material'; -import { usePopupState } from 'material-ui-popup-state/hooks'; +import { usePopupState, bindPopover } from 'material-ui-popup-state/hooks'; import { useRouter, useSearchParams } from 'next/navigation'; import { useAction } from 'next-safe-action/hooks'; -import { useCallback } from 'react'; +import { useCallback, useState } from 'react'; import { LoadingComponent } from 'components/common/Loading/LoadingComponent'; import { useFarcasterConnection } from 'hooks/useFarcasterConnection'; @@ -73,7 +73,11 @@ export function WarpcastLoginButton({ children, ...props }: ButtonProps) { popupState.open(); }, []); - const { signIn, url } = useFarcasterConnection({ + const { + signIn, + url, + error: connectionError + } = useFarcasterConnection({ onSuccess: onSuccessCallback, onError: onErrorCallback, onClick @@ -87,16 +91,19 @@ export function WarpcastLoginButton({ children, ...props }: ButtonProps) { ); } - const errorMessage = result?.serverError?.message?.includes('private beta') - ? 'Scout Game is in private beta' - : 'There was an error while logging in'; + const errorMessage = + (connectionError && connectionError.message) || + (hasErrored && + (result?.serverError?.message?.includes('private beta') + ? 'Scout Game is in private beta' + : 'There was an error while logging in')); return ( - {hasErrored && ( + {errorMessage && ( {errorMessage} )} - popupState.close()} url={url} /> + ); }