Skip to content

Commit

Permalink
Update CustomAirdrop.jsx
Browse files Browse the repository at this point in the history
Fix custom airdrop page if user hasn't fetched tickets for the blockchain
  • Loading branch information
grctest committed Jul 20, 2023
1 parent 5e8fe4a commit 0c80659
Showing 1 changed file with 30 additions and 25 deletions.
55 changes: 30 additions & 25 deletions src/pages/CustomAirdrop.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ export default function CustomAirdrop(properties) {
useEffect(() => {
if (
(!account || !account.length)
|| (!validTicketHolders || !validTicketHolders.length)
|| (!fileUsers || !fileUsers.length)
) {
console.log("no account or no valid ticket holders");
Expand All @@ -220,7 +219,7 @@ export default function CustomAirdrop(properties) {
reasons.push("self");
}

if (ticketHolder && ticketHolder !== 'both') {
if (validTicketHolders && validTicketHolders.length && ticketHolder && ticketHolder !== 'both') {
const ticketCheck = validTicketHolders.includes(user.id);
if (ticketHolder === 'onlyHolders' && !ticketCheck) {
// Filter out non-ticket holders
Expand Down Expand Up @@ -633,29 +632,35 @@ export default function CustomAirdrop(properties) {
/>
</Group>
</Radio.Group>
<Radio.Group
value={ticketHolder}
onChange={setTicketHolder}
name="ticketHolder"
label={t("customAirdrop:grid.right.options.ticketHolder.title")}
style={{ marginTop: '10px' }}
withAsterisk
>
<Group mt="xs">
<Radio
value="onlyHolders"
label={t("customAirdrop:grid.right.options.ticketHolder.onlyHolders")}
/>
<Radio
value="noHolders"
label={t("customAirdrop:grid.right.options.ticketHolder.noHolders")}
/>
<Radio
value="both"
label={t("customAirdrop:grid.right.options.ticketHolder.both")}
/>
</Group>
</Radio.Group>
{
envLeaderboard && envLeaderboard.length
? (
<Radio.Group
value={ticketHolder}
onChange={setTicketHolder}
name="ticketHolder"
label={t("customAirdrop:grid.right.options.ticketHolder.title")}
style={{ marginTop: '10px' }}
withAsterisk
>
<Group mt="xs">
<Radio
value="onlyHolders"
label={t("customAirdrop:grid.right.options.ticketHolder.onlyHolders")}
/>
<Radio
value="noHolders"
label={t("customAirdrop:grid.right.options.ticketHolder.noHolders")}
/>
<Radio
value="both"
label={t("customAirdrop:grid.right.options.ticketHolder.both")}
/>
</Group>
</Radio.Group>
)
: null
}
<Radio.Group
value={airdropTarget}
onChange={setAirdropTarget}
Expand Down

0 comments on commit 0c80659

Please sign in to comment.