Skip to content

Commit

Permalink
fix(apps/tron): use cloudinary for logo fetching
Browse files Browse the repository at this point in the history
  • Loading branch information
LufyCZ committed Sep 30, 2024
1 parent 8c21606 commit 88cf5f2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
3 changes: 2 additions & 1 deletion apps/web/src/app/(non-evm)/tron/_common/ui/General/Icon.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { cloudinaryLogoFetchLoader } from '@sushiswap/ui'
import Image from 'next/image'
import { hashStringToColor } from '~tron/_common/lib/utils/formatters'
import { IToken } from '~tron/_common/types/token-type'
Expand All @@ -17,7 +18,7 @@ export const Icon = ({ currency, height = 40, width = 40 }: IconProps) => {
className="relative flex shrink-0 overflow-hidden rounded-full"
>
<Image
loader={({ src }) => src}
loader={cloudinaryLogoFetchLoader}
src={currency.logoURI}
alt={currency.symbol}
height={height}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,16 @@ const TokenButton = ({
isSelected: boolean
addOrRemoveToken?: (type: 'add' | 'remove', currency: IToken[]) => void
}) => {
const isOnDefaultList = useMemo(() => {
if (!token) {
return true
}

return DEFAULT_TOKEN_LIST.some((t) => t.address === token.address)
}, [token])

if (!token) return null
const isOnDefaultList = useMemo(
() => DEFAULT_TOKEN_LIST.some((t) => t.address === token.address),
[token],
)

const isNew = !hasToken?.(token)
const isCustomAdded = hasToken?.(token)

Expand Down

0 comments on commit 88cf5f2

Please sign in to comment.