Skip to content

Commit

Permalink
tokens logo handling when wallet not connected in rewards
Browse files Browse the repository at this point in the history
  • Loading branch information
vnaysngh-mudrex committed May 20, 2024
1 parent 61b8e69 commit 69eb644
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
10 changes: 10 additions & 0 deletions src/components/Logo/AssetLogo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,22 @@ const StyledEthereumLogo = styled.img<{ size: number }>`

const CurrencyLogo = ({ currency, symbol, size }: { currency: any; symbol: any; size: any }) => {
const currencyLogo: any = currency
console.log(currencyLogo, 'currencyLogo')
if (currencyLogo && (currencyLogo.name === 'ETHER' || currencyLogo.name === 'ETH' || symbol === 'ETH')) {
return <StyledEthereumLogo src={EthereumLogo} alt={`${symbol ?? 'token'} logo`} size={size} loading="lazy" />
} else if (currencyLogo && currencyLogo.logoURI) {
return (
<StyledEthereumLogo src={currencyLogo.logoURI} alt={`${symbol ?? 'token'} logo`} size={size} loading="lazy" />
)
} else if (currencyLogo && !currencyLogo.logoURI) {
return (
<StyledEthereumLogo
src={`https://static.jediswap.xyz/tokens-list/assets/${currencyLogo.symbol}.png`}
alt={`${symbol ?? 'token'} logo`}
size={size}
loading="lazy"
/>
)
}

return (
Expand Down
19 changes: 10 additions & 9 deletions src/pages/Rewards/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -625,12 +625,14 @@ export default function Rewards() {
)
const buttonText =
(totalRewardsClaimed && 'Claimed') || (unclaimed_rewards && 'Claim STRK') || (attemptingTxn && 'Claiming...')

console.log(Object.keys(allTokens).length, Boolean(Object.keys(allTokens).length), 'dfkndkfd')
const PairListItem = ({ pool }: { pool: any }) => {
const token0 =
pool.token0.symbol === 'ETH' ? pool.token0 : allTokens[validateAndParseAddress(pool.token0.tokenAddress)]
const token1 =
pool.token1.symbol === 'ETH' ? pool.token1 : allTokens[validateAndParseAddress(pool.token1.tokenAddress)]
const token0 = Object.keys(allTokens).length
? allTokens[validateAndParseAddress(pool.token0.tokenAddress)]
: pool.token0
const token1 = Object.keys(allTokens).length
? allTokens[validateAndParseAddress(pool.token1.tokenAddress)]
: pool.token1

return (
<Column style={{ padding: 10, flexBasis: '32%', flexGrow: 0 }}>
Expand Down Expand Up @@ -724,7 +726,7 @@ export default function Rewards() {
STRK ALLOCATED
</>
</HeaderText>
<AmountText>{allocations?.toSignificant() ?? 0}</AmountText>
<AmountText>{address && allocations ? allocations?.toSignificant() : 0}</AmountText>
</Column>
<Column>
<HeaderText>
Expand All @@ -733,7 +735,7 @@ export default function Rewards() {
STRK CLAIMED
</>
</HeaderText>
<AmountText>{formattedClaimRewards?.toSignificant() ?? 0}</AmountText>
{address && formattedClaimRewards ? formattedClaimRewards?.toSignificant() : 0}
</Column>
<Column>
<HeaderText>
Expand All @@ -743,8 +745,7 @@ export default function Rewards() {
</>
</HeaderText>
<ClaimWrapper>
<AmountText>{unclaimed_rewards.toSignificant(5) ?? 0}</AmountText>

<AmountText>{address && unclaimed_rewards ? unclaimed_rewards.toSignificant(5) : 0}</AmountText>
{!address ? (
<ClaimButtonGradient
onClick={toggleWalletDrawer}
Expand Down

0 comments on commit 69eb644

Please sign in to comment.