diff --git a/src/components/chat/unlockProfile/UnlockProfile.tsx b/src/components/chat/unlockProfile/UnlockProfile.tsx index ef8d3dd221..e4969365ee 100644 --- a/src/components/chat/unlockProfile/UnlockProfile.tsx +++ b/src/components/chat/unlockProfile/UnlockProfile.tsx @@ -44,7 +44,6 @@ type UnlockProfileModalProps = { InnerComponentProps: { type: UNLOCK_PROFILE_TYPE | undefined; description?: string; - closeIcon?: boolean; }; onClose?: () => void; }; @@ -101,7 +100,7 @@ const UnlockProfile = ({ InnerComponentProps, onClose }: UnlockProfileModalProps return ( - {closeIcon && ( + {onClose && ( } diff --git a/src/components/chat/unlockProfile/UnlockProfileWrapper.tsx b/src/components/chat/unlockProfile/UnlockProfileWrapper.tsx index b94e61741e..fe33fdde4c 100644 --- a/src/components/chat/unlockProfile/UnlockProfileWrapper.tsx +++ b/src/components/chat/unlockProfile/UnlockProfileWrapper.tsx @@ -14,7 +14,6 @@ interface IntroContainerProps { showConnectModal?: boolean; description?: string; onClose?: () => void; - closeIcon?: boolean; } const DEFAULT_PROPS = { @@ -26,7 +25,6 @@ const UnlockProfileWrapper = ({ showConnectModal, description, onClose, - closeIcon, }: IntroContainerProps) => { const { isModalOpen: isProfileModalOpen, @@ -38,7 +36,7 @@ const UnlockProfileWrapper = ({ if (type === UNLOCK_PROFILE_TYPE.MODAL && showConnectModal) { showProfileModal(); } - }, [type]); + }, [type, showConnectModal]); if (type === UNLOCK_PROFILE_TYPE.MODAL) { return ( @@ -47,9 +45,7 @@ const UnlockProfileWrapper = ({ InnerComponentProps={{ type, description, - closeIcon, }} - closeIcon={closeIcon} modalRadius="24px" modalBorder={false} modalPosition={MODAL_POSITION.ON_PARENT} @@ -59,7 +55,7 @@ const UnlockProfileWrapper = ({ return ( diff --git a/src/modules/rewards/Rewards.tsx b/src/modules/rewards/Rewards.tsx index 39a0090fbc..b467ebe19b 100644 --- a/src/modules/rewards/Rewards.tsx +++ b/src/modules/rewards/Rewards.tsx @@ -49,18 +49,18 @@ const Rewards: FC = () => { const { activeTab, handleSetActiveTab } = useRewardsTabs(); - const { showConnectModal, setShowConnectModal, status, connectUserWallet } = useRewardsAuth(); + const { isAuthModalVisible, status, connectUserWallet, hideAuthModal } = useRewardsAuth(); useCreateRewardsUser(); const heading = activeTab === 'leaderboard' ? 'Push Reward Points' : 'Introducing Push Reward Points Program'; useEffect(() => { - if (isErrorPresent && showConnectModal && status === 'error' && errorExists && activeTab === 'dashboard') { + if (isErrorPresent && isAuthModalVisible && status === 'error' && errorExists && activeTab === 'dashboard') { setHasError(isErrorPresent); - setShowConnectModal(false); + hideAuthModal(); } - }, [isErrorPresent, showConnectModal, errorExists]); + }, [isErrorPresent, isAuthModalVisible, errorExists]); // retry unlock profile const handleUnlockProfile = () => { @@ -102,7 +102,7 @@ const Rewards: FC = () => { {activeTab === 'dashboard' && } - {userPushSDKInstance && userPushSDKInstance?.readmode() && showConnectModal && ( + {userPushSDKInstance && userPushSDKInstance?.readmode() && isAuthModalVisible && ( = () => { > hideAuthModal()} description="Unlock your profile to proceed." /> diff --git a/src/modules/rewards/components/ActivityVerificationButton.tsx b/src/modules/rewards/components/ActivityVerificationButton.tsx index 5e8829e57d..611f45319f 100644 --- a/src/modules/rewards/components/ActivityVerificationButton.tsx +++ b/src/modules/rewards/components/ActivityVerificationButton.tsx @@ -18,7 +18,6 @@ import { UserStoreType } from 'types'; // components import { Box, Button } from 'blocks'; import UnlockProfileWrapper, { UNLOCK_PROFILE_TYPE } from 'components/chat/unlockProfile/UnlockProfileWrapper'; -import { useRewardsAuth } from '../hooks/useRewardsAuth'; type ActivityVerificationButtonProps = { userId: string; @@ -38,8 +37,6 @@ export const ActivityVerificationButton = ({ const { isWalletConnected } = useAccount(); const { userPushSDKInstance } = useSelector((state: UserStoreType) => state.user); - // const { setShowConnectModal } = useRewardsAuth(); - const { handleTwitterVerification } = useVerifyTwitter({ activityTypeId, refetchActivity, @@ -70,42 +67,10 @@ export const ActivityVerificationButton = ({ } }, [activityType, userPushSDKInstance]); - const { isAuthenticated, authButton, showConnectModal, setShowConnectModal } = useAuthWithButton({ + const { isAuthenticated, authButton, isAuthModalVisible, hideAuthModal } = useAuthWithButton({ onSuccess: (userDetails) => activityData?.action(userDetails?.userId), }); - const handleCloseModal = () => { - setShowConnectModal(false); - }; - - console.log('Modal closed'); - console.log('isAuthenticated:', isAuthenticated); - console.log('isWalletConnected:', isWalletConnected); - console.log('showConnectModal:', showConnectModal); - - if (userPushSDKInstance && userPushSDKInstance?.readmode() && showConnectModal) { - return ( - - - - ); - } - if (isAuthenticated && isWalletConnected && !userPushSDKInstance?.readmode()) { return ( ), - [isWalletConnected, showConnectModal] + [isWalletConnected, isAuthModalVisible] ); return { authButton, isAuthenticated: isWalletConnectedAndProfileUnlocked, - showConnectModal: showConnectModal, - setShowConnectModal: setShowConnectModal, + isAuthModalVisible, + hideAuthModal, }; };