Skip to content

Commit

Permalink
fix: onClick borked in non-read only DeFi opportunities (#7733)
Browse files Browse the repository at this point in the history
  • Loading branch information
gomesalexandre authored Sep 11, 2024
1 parent f1c56e3 commit 1ad475e
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export const OpportunityRow: React.FC<

const handleClick = useCallback(
(action: DefiAction) => {
if (asset?.isPool) {
if (asset?.isPool && opportunity.isReadOnly) {
return history.push(`/trade/${assetId}`)
}
if (opportunity.isReadOnly) {
Expand All @@ -96,7 +96,7 @@ export const OpportunityRow: React.FC<
}
onClick(opportunity, action)
},
[asset?.isPool, assetId, history, onClick, opportunity],
[asset, assetId, history, onClick, opportunity],
)

const handleClaimClick = useCallback(() => handleClick(DefiAction.Claim), [handleClick])
Expand Down Expand Up @@ -140,7 +140,7 @@ export const OpportunityRow: React.FC<
<NestedAsset
key={rewardAssetId}
isClaimableRewards={isClaimableRewards}
isExternal={opportunity.isReadOnly}
isExternal={opportunity.isReadOnly && !asset?.isPool}
assetId={rewardAssetId}
balances={rewardBalance}
onClick={handleClaimClick}
Expand Down Expand Up @@ -174,6 +174,7 @@ export const OpportunityRow: React.FC<
underlyingAssetBalances,
isClaimableRewards,
opportunity.isReadOnly,
asset?.isPool,
handleClaimClick,
translate,
assetId,
Expand Down Expand Up @@ -218,7 +219,7 @@ export const OpportunityRow: React.FC<
icons={icons}
subText={assetCellSubText}
justifyContent='flex-start'
isExternal={opportunity.isReadOnly}
isExternal={opportunity.isReadOnly && !asset?.isPool}
opportunityName={opportunity.opportunityName}
/>
<Amount.Crypto
Expand Down

0 comments on commit 1ad475e

Please sign in to comment.