Skip to content

Create referral page#189

Open
AndresImach wants to merge 43 commits intostagingfrom
create-airdrop-checker-page
Open

Create referral page#189
AndresImach wants to merge 43 commits intostagingfrom
create-airdrop-checker-page

Conversation

@AndresImach
Copy link
Copy Markdown
Collaborator

No description provided.

@vercel
Copy link
Copy Markdown

vercel bot commented Jan 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
overlay-interface ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 2, 2024 1:29pm

@AndresImach AndresImach changed the title Create airdrop checker page Create referral page Jan 19, 2024
value: value,
}

console.log('tx: ', tx)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
console.log('tx: ', tx)

call: {address, calldata, value},
} = bestCallOption

console.log('bestCallOption: ', bestCallOption)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
console.log('bestCallOption: ', bestCallOption)

Comment on lines +192 to +194
// let the wallet try if we can't estimate the gas
...('gasEstimate' in bestCallOption ? {gasLimit: calculateGasMargin(bestCallOption.gasEstimate)} : {}),
...(value && !isZero(value) ? {value} : {}),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we estimating the gas ourselves? Isn't this done automatically by ethers?
Note: we seem to be doing that everywhere, not just here.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

value: value,
}

console.log('tx: ', tx)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
console.log('tx: ', tx)

value: value,
}

console.log('tx: ', tx)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
console.log('tx: ', tx)

Comment on lines +171 to +173
<a href="/" style={{color: colors(false).dark.blue2}}>
Markets
</a>{' '}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this link should be using the React router instead of an <a> tag; using this is causing a full refresh of the page.

<Box className={classes.lightBox}>
<TEXT.BoldStandardBody>Rebates. Fee discounts.</TEXT.BoldStandardBody>
<TEXT.StandardBody>
Need mor info?{' '}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Need mor info?{' '}
Need more info?{' '}

Comment on lines +169 to +171
<a href="/" style={{color: colors(false).dark.blue2}}>
Overlay Referral Program &rarr;{' '}
</a>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not redirecting to the Referral page. Also, it's using <a> instead of React router, so it causes a full refresh of the page.

Comment on lines +173 to +193
<OutlinedInput
error={validAddress}
className={classes.referralInput}
placeholder="Enter referral link"
onChange={e => setReferralLink(e.target.value)}
value={referralLink}
/>
{/* <Box
sx={{
marginTop: 20,
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
}}
> */}
{!account && <ConnectWalletButton onClick={toggleWalletModal}>Connect wallet</ConnectWalletButton>}
{account && (
<TriggerActionButton onClick={() => handleReferralCodeButton()} className={classes.referralButton}>
Submit link
</TriggerActionButton>
)}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. The button says "submit link", but the input is expecting an address.
  2. I don't see any error or loading state in the UI, just in the console.
    image

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. The card says my rewards pending are 0, when they are not (see console).
  2. The tx fails (that's ok, I'm using an incorrect proof), but I don't have any feedback in the UI, just in the console.
  3. Even when the tx goes through, I don't get any success message in the UI, just the tx receipt in the console.

image

After claiming, I now see a negative "rewards pending" in the card, but in the console it shows that my [pending] rewards are 0 (which is correct).

image

Also, I suggest removing all the console.log used for debugging, only keep the ones that are displayed when there's an error.

Comment on lines -134 to -139
setReferralCodeState({
showConfirm: false,
attemptingTransaction: false,
transactionErrorMessage: undefined,
transactionHash: hash,
})
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this shouldn't have been deleted, it was the setReferralCodeState above this one the one that was redundant.

</TEXT.Supplemental>
</Tooltip>
<div>
<Tooltip title={tooltip || 'hola'} placement="top">
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

title={tooltip || 'hola'} looks suspicious

value={referralLink}
/>
{transactionErrorMessage != undefined && !transactionErrorMessage.toString().includes('Transaction rejected') && (
<TEXT.Supplemental color={colors(false).dark.red}>Invalid wallet address</TEXT.Supplemental>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the error message "Invalid wallet address" is a bit misleading. Would be nice to manage the error better, for instance saying that "the account is neither an affiliate nor an ambassador", or that the user has already specified a referrer before, which are the two types of error that can occur.

Btw, have you added any loading state when the transaction is being processed? Just disabling the "Submit Address" button would be enough.

Copy link
Copy Markdown

@EperezOk EperezOk Mar 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you add any success or error messages to the claiming rewards flow? I can't see any in the code, and I believe the error messages are very important.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants