diff --git a/src/custom/pages/Claim/ClaimNav.tsx b/src/custom/pages/Claim/ClaimNav.tsx index da1d85797..261495303 100644 --- a/src/custom/pages/Claim/ClaimNav.tsx +++ b/src/custom/pages/Claim/ClaimNav.tsx @@ -1,4 +1,3 @@ -import { useMemo } from 'react' import { ButtonSecondary } from 'components/Button' import { shortenAddress } from 'utils' import { TopNav, ClaimAccount, ClaimAccountButtons } from './styled' @@ -13,8 +12,10 @@ export default function ClaimNav({ account, handleChangeAccount }: ClaimNavProps const { activeClaimAccount, activeClaimAccountENS, claimStatus, investFlowStep } = useClaimState() const { setActiveClaimAccount } = useClaimDispatchers() - const isAttempting = useMemo(() => claimStatus === ClaimStatus.ATTEMPTING, [claimStatus]) + const isDefaultStatus = claimStatus === ClaimStatus.DEFAULT + const isConfirmed = claimStatus === ClaimStatus.CONFIRMED const hasActiveAccount = activeClaimAccount !== '' + const allowToChangeAccount = investFlowStep < 2 && (isDefaultStatus || isConfirmed) return ( @@ -28,20 +29,15 @@ export default function ClaimNav({ account, handleChangeAccount }: ClaimNavProps )} - {!!account && (account !== activeClaimAccount || activeClaimAccount === '') && ( - setActiveClaimAccount(account)}> - Switch to connected account - - )} - - {/* Hide account changing action on: - * last investment step - * attempted claim in progress - */} - {hasActiveAccount && (investFlowStep < 2 || !isAttempting) && ( - - Change account - + {allowToChangeAccount && hasActiveAccount ? ( + Change account + ) : ( + !!account && + allowToChangeAccount && ( + setActiveClaimAccount(account)}> + Switch to connected account + + ) )}