Skip to content

Commit 3e075df

Browse files
Claimed Styles
1 parent be26547 commit 3e075df

File tree

1 file changed

+23
-33
lines changed

1 file changed

+23
-33
lines changed

packages/app/features/account/rewards/components/DistributionClaimButton.tsx

+23-33
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
import {
2-
Button as ButtonOg,
3-
Paragraph,
4-
Spinner,
5-
type ButtonProps,
6-
YStack,
7-
useToastController,
8-
} from '@my/ui'
1+
import { Button as ButtonOg, Spinner, type ButtonProps, YStack, useToastController } from '@my/ui'
92
import { baseMainnet, type sendMerkleDropAddress } from '@my/wagmi'
103
import { useQueryClient } from '@tanstack/react-query'
114
import { IconDollar } from 'app/components/icons'
@@ -197,24 +190,21 @@ export const DistributionClaimButton = ({ distribution }: DistributionsClaimButt
197190

198191
if (!isEligible) return null
199192

200-
// If the user is eligible but has already claimed, show the claim button disabled
201-
if (isClaimed) {
202-
return (
203-
<Paragraph size="$3" color="$color12" mx="auto">
204-
Claimed
205-
</Paragraph>
206-
)
207-
}
208193
// If the user is eligible and the tranche is active, show the claim button
209194
return (
210195
<YStack>
211196
<Button
212-
theme={canClaim ? 'green' : error || hasEnoughGas ? 'red_active' : undefined}
197+
theme={canClaim || isClaimed ? 'green' : error || !hasEnoughGas ? 'red_active' : 'alt1'}
213198
onPress={onSubmit}
214199
br={12}
215200
disabledStyle={{ opacity: 0.7, cursor: 'not-allowed', pointerEvents: 'none' }}
216201
disabled={
217-
!canClaim || isClaimPending || !!sentTxHash || !!feesPerGasError || !!usdcFeesError
202+
!canClaim ||
203+
isClaimPending ||
204+
!!sentTxHash ||
205+
!!feesPerGasError ||
206+
!!usdcFeesError ||
207+
isClaimed
218208
}
219209
gap={4}
220210
maw={194}
@@ -235,27 +225,27 @@ export const DistributionClaimButton = ({ distribution }: DistributionsClaimButt
235225
<Spinner size="small" color="$color12" />
236226
</ButtonOg.Icon>
237227
)
238-
case !isTrancheActive:
239-
return (
240-
<ButtonOg.Text opacity={0.5} disabled>
241-
Not yet claimable
242-
</ButtonOg.Text>
243-
)
244-
case !!isTrancheActiveError || !!isClaimedError || !!nonceError:
245-
return (
246-
<>
247-
<ButtonOg.Text opacity={0.5}>Error</ButtonOg.Text>
248-
</>
249-
)
250-
case !!feesPerGasError || !!usdcFeesError:
228+
case isClaimed:
251229
return (
252230
<>
253231
<ButtonOg.Icon>
254-
<IconDollar size={'$2.5'} />
232+
<IconDollar color="$black" size={'$1.5'} />
255233
</ButtonOg.Icon>
256-
<ButtonOg.Text>Claim Reward</ButtonOg.Text>
234+
<ButtonOg.Text>Claimed</ButtonOg.Text>
257235
</>
258236
)
237+
case !isTrancheActive:
238+
return (
239+
<ButtonOg.Text opacity={0.5} disabled>
240+
Not yet claimable
241+
</ButtonOg.Text>
242+
)
243+
case !!isTrancheActiveError ||
244+
!!isClaimedError ||
245+
!!nonceError ||
246+
!!feesPerGasError ||
247+
!!usdcFeesError:
248+
return <ButtonOg.Text opacity={0.5}>Error</ButtonOg.Text>
259249
case isClaimPending && !isClaimError:
260250
return (
261251
<>

0 commit comments

Comments
 (0)