From b3c73079ff2c59961bee03076aaf7a737b2d2083 Mon Sep 17 00:00:00 2001 From: Vasyl Ivanchuk Date: Tue, 21 Nov 2023 13:24:10 +0200 Subject: [PATCH 1/2] fix: token icon label --- .../app/src/components/TokenAmountPrice.vue | 8 +- .../app/src/components/TokenIconLabel.vue | 24 +----- .../app/src/components/balances/Table.vue | 1 + .../TokenAmountPriceTableCell.vue | 8 +- .../infoTable/TransferTableCell.vue | 1 + .../tests/components/TokenIconLabel.spec.ts | 76 +------------------ 6 files changed, 23 insertions(+), 95 deletions(-) diff --git a/packages/app/src/components/TokenAmountPrice.vue b/packages/app/src/components/TokenAmountPrice.vue index c5364906c7..e56dd2a591 100644 --- a/packages/app/src/components/TokenAmountPrice.vue +++ b/packages/app/src/components/TokenAmountPrice.vue @@ -3,7 +3,13 @@
diff --git a/packages/app/src/components/TokenIconLabel.vue b/packages/app/src/components/TokenIconLabel.vue index 56dc4adae5..39675f1fd0 100644 --- a/packages/app/src/components/TokenIconLabel.vue +++ b/packages/app/src/components/TokenIconLabel.vue @@ -11,7 +11,7 @@
@@ -35,8 +35,6 @@ import { useImage } from "@vueuse/core"; import AddressLink from "@/components/AddressLink.vue"; -import useTokenLibrary from "@/composables/useTokenLibrary"; - import type { Hash } from "@/types"; export type IconSize = "sm" | "md" | "lg" | "xl"; @@ -57,7 +55,7 @@ const props = defineProps({ default: "sm", }, iconUrl: { - type: String, + type: [String, null] as PropType, default: "", }, showLinkSymbol: { @@ -70,26 +68,10 @@ const props = defineProps({ }, }); -const { - isRequestPending: isTokensRequestPending, - isRequestFailed: isTokensRequestFailed, - getToken, - getTokens, -} = useTokenLibrary(); - -getTokens(); - const imgSource = computed(() => { - if (props.iconUrl) { - return props.iconUrl; - } - const tokenFromLibrary = getToken(props.address); - return tokenFromLibrary?.iconURL ? tokenFromLibrary.iconURL : "/images/currencies/customToken.svg"; + return props.iconUrl || "/images/currencies/customToken.svg"; }); const { isReady: isImageLoaded } = useImage({ src: imgSource.value }); -const isImageReady = computed( - () => (!isTokensRequestPending.value && !isTokensRequestFailed.value && isImageLoaded.value) || props.iconUrl -);