Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Add connect wallet button #2328

Merged
merged 6 commits into from
Jan 28, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/custom/pages/Claim/ClaimAddress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ import { ClaimCommonTypes } from './types'
import useENS from 'hooks/useENS'
import { useClaimDispatchers, useClaimState } from 'state/claim/hooks'
import { ClaimStatus } from 'state/claim/actions'
import { UnsupportedChainIdError, useWeb3React } from '@web3-react/core'

export type ClaimAddressProps = Pick<ClaimCommonTypes, 'account'> & {
toggleWalletModal: () => void
}

export default function ClaimAddress({ account, toggleWalletModal }: ClaimAddressProps) {
const { error } = useWeb3React()
const { activeClaimAccount, claimStatus, inputAddress } = useClaimState()
const { setInputAddress } = useClaimDispatchers()

Expand Down Expand Up @@ -41,7 +43,11 @@ export default function ClaimAddress({ account, toggleWalletModal }: ClaimAddres
<i>Note: It is possible to claim for an account, using any wallet/account.</i>
{!account && (
<ButtonSecondary onClick={toggleWalletModal}>
<Trans>or connect a wallet</Trans>
{error instanceof UnsupportedChainIdError ? (
<Trans>or connect a wallet in a supported network</Trans>
) : (
<Trans>or connect a wallet</Trans>
nenadV91 marked this conversation as resolved.
Show resolved Hide resolved
)}
</ButtonSecondary>
)}
</p>
Expand Down
5 changes: 2 additions & 3 deletions src/custom/pages/Claim/FooterNavButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,15 @@ export default function FooterNavButtons({

let buttonContent: ReactNode = null
// Disconnected, show wallet connect
if (!account) {
if (!account && activeClaimAccount) {
buttonContent = (
<ButtonPrimary onClick={toggleWalletModal}>
<Trans>Connect a wallet</Trans>
</ButtonPrimary>
)
}

// User has no set active claim account and/or has claims, show claim account search
if ((!activeClaimAccount || !hasClaims) && claimStatus === ClaimStatus.DEFAULT) {
else if (!hasClaims && claimStatus === ClaimStatus.DEFAULT) {
buttonContent = (
<>
<ButtonPrimary disabled={!isInputAddressValid} type="text" onClick={handleCheckClaim}>
Expand Down