From b21b269063a0fb8acd77cc41926e55adec0dbb23 Mon Sep 17 00:00:00 2001 From: "Felix C. Morency" <1102868+fmorency@users.noreply.github.com> Date: Tue, 7 Jan 2025 14:57:24 -0500 Subject: [PATCH 1/4] fix: send form denom icon display --- components/bank/forms/ibcSendForm.tsx | 24 ++++++++++++-------- components/bank/forms/sendForm.tsx | 14 +++++++++--- components/factory/components/DenomImage.tsx | 18 +++++++++++---- utils/identicon.tsx | 12 ++++++++-- 4 files changed, 49 insertions(+), 19 deletions(-) diff --git a/components/bank/forms/ibcSendForm.tsx b/components/bank/forms/ibcSendForm.tsx index 9e71ef7..a3dbe2a 100644 --- a/components/bank/forms/ibcSendForm.tsx +++ b/components/bank/forms/ibcSendForm.tsx @@ -1,13 +1,7 @@ import React, { useState, useMemo } from 'react'; import { useFeeEstimation, useTx } from '@/hooks'; import { ibc } from '@liftedinit/manifestjs'; -import { - getIbcInfo, - parseNumberToBigInt, - shiftDigits, - truncateString, - formatTokenDisplayName, -} from '@/utils'; +import { getIbcInfo, parseNumberToBigInt, shiftDigits, truncateString } from '@/utils'; import { PiCaretDownBold } from 'react-icons/pi'; import { MdContacts } from 'react-icons/md'; import { CombinedBalanceInfo } from '@/utils/types'; @@ -291,7 +285,10 @@ export default function IbcSendForm({ className="btn btn-sm h-full px-3 bg-[#FFFFFF] dark:bg-[#FFFFFF0F] border-none hover:bg-transparent" > {values.selectedToken?.metadata ? ( - + ) : null} {(() => { @@ -330,12 +327,19 @@ export default function IbcSendForm({ filteredBalances?.map(token => (
  • setFieldValue('selectedToken', token)} + onClick={() => { + setFieldValue('selectedToken', token); + if (document.activeElement) { + document.activeElement.blur(); + } + }} className="hover:bg-[#E0E0FF33] dark:hover:bg-[#FFFFFF0F] cursor-pointer rounded-lg" aria-label={token.metadata?.display ?? token.denom} > - {token.metadata ? : null} + {token.metadata ? ( + + ) : null} {(() => { const tokenDisplayName = diff --git a/components/bank/forms/sendForm.tsx b/components/bank/forms/sendForm.tsx index b1155dc..320ff03 100644 --- a/components/bank/forms/sendForm.tsx +++ b/components/bank/forms/sendForm.tsx @@ -211,7 +211,10 @@ export default function SendForm({ className="btn btn-sm h-full px-3 bg-[#FFFFFF] dark:bg-[#FFFFFF0F] border-none hover:bg-transparent" > {values.selectedToken?.metadata ? ( - + ) : null} {(() => { @@ -252,12 +255,17 @@ export default function SendForm({ filteredBalances?.map(token => (
  • setFieldValue('selectedToken', token)} + onClick={() => { + setFieldValue('selectedToken', token); + if (document.activeElement) { + document.activeElement.blur(); + } + }} className="hover:bg-[#E0E0FF33] dark:hover:bg-[#FFFFFF0F] cursor-pointer rounded-lg" aria-label={token.metadata?.display} > - + {token.metadata?.display.startsWith('factory') ? token.metadata?.display.split('/').pop()?.toUpperCase() diff --git a/components/factory/components/DenomImage.tsx b/components/factory/components/DenomImage.tsx index 13f9b39..45f38fe 100644 --- a/components/factory/components/DenomImage.tsx +++ b/components/factory/components/DenomImage.tsx @@ -64,7 +64,13 @@ export const isUrlSupported = (url: string) => { } }; -export const DenomImage = ({ denom }: { denom: any }) => { +export const DenomImage = ({ + denom, + withBackground = true, +}: { + denom: any; + withBackground: boolean; +}) => { const [imageError, setImageError] = useState(false); const [isLoading, setIsLoading] = useState(true); const [isSupported, setIsSupported] = useState(false); @@ -94,7 +100,9 @@ export const DenomImage = ({ denom }: { denom: any }) => { // Check for MFX token first if (denom?.base?.includes('umfx')) { return ( -
    +
    { // Then check for other conditions if (!denom?.uri || !isSupported || imageError) { - return ; + return ; } // For all other cases, use the denom.uri return ( -
    +
    { +const ProfileAvatar = ({ + walletAddress, + size, + withBackground = false, +}: { + walletAddress: string; + size?: number; + withBackground?: boolean; +}) => { const [avatarSrc, setAvatarSrc] = useState(''); const colors: [number, number, number, number][] = [ @@ -38,7 +46,7 @@ const ProfileAvatar = ({ walletAddress, size }: { walletAddress: string; size?: Profile Avatar ); From fd6c9130a7c3a3ab1d8ae0169662d84428efd4f7 Mon Sep 17 00:00:00 2001 From: "Felix C. Morency" <1102868+fmorency@users.noreply.github.com> Date: Tue, 7 Jan 2025 15:00:58 -0500 Subject: [PATCH 2/4] fix: optional param --- components/factory/components/DenomImage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/factory/components/DenomImage.tsx b/components/factory/components/DenomImage.tsx index 45f38fe..bd1af22 100644 --- a/components/factory/components/DenomImage.tsx +++ b/components/factory/components/DenomImage.tsx @@ -69,7 +69,7 @@ export const DenomImage = ({ withBackground = true, }: { denom: any; - withBackground: boolean; + withBackground?: boolean; }) => { const [imageError, setImageError] = useState(false); const [isLoading, setIsLoading] = useState(true); From 3ebfea471883e34b3eebabc88bebe41df74c644e Mon Sep 17 00:00:00 2001 From: "Felix C. Morency" <1102868+fmorency@users.noreply.github.com> Date: Tue, 7 Jan 2025 15:01:17 -0500 Subject: [PATCH 3/4] fix: type check --- components/bank/forms/ibcSendForm.tsx | 2 +- components/bank/forms/sendForm.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/bank/forms/ibcSendForm.tsx b/components/bank/forms/ibcSendForm.tsx index a3dbe2a..213ee33 100644 --- a/components/bank/forms/ibcSendForm.tsx +++ b/components/bank/forms/ibcSendForm.tsx @@ -329,7 +329,7 @@ export default function IbcSendForm({ key={token.coreDenom} onClick={() => { setFieldValue('selectedToken', token); - if (document.activeElement) { + if (document.activeElement instanceof HTMLElement) { document.activeElement.blur(); } }} diff --git a/components/bank/forms/sendForm.tsx b/components/bank/forms/sendForm.tsx index 320ff03..8602062 100644 --- a/components/bank/forms/sendForm.tsx +++ b/components/bank/forms/sendForm.tsx @@ -257,7 +257,7 @@ export default function SendForm({ key={token.coreDenom} onClick={() => { setFieldValue('selectedToken', token); - if (document.activeElement) { + if (document.activeElement instanceof HTMLElement) { document.activeElement.blur(); } }} From 8b04293207febfc7a3cf18553ad01cacb701c961 Mon Sep 17 00:00:00 2001 From: "Felix C. Morency" <1102868+fmorency@users.noreply.github.com> Date: Tue, 7 Jan 2025 15:09:49 -0500 Subject: [PATCH 4/4] fix: default value --- utils/identicon.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/identicon.tsx b/utils/identicon.tsx index fae67d3..5d69348 100644 --- a/utils/identicon.tsx +++ b/utils/identicon.tsx @@ -6,7 +6,7 @@ import CryptoJS from 'crypto-js'; const ProfileAvatar = ({ walletAddress, size, - withBackground = false, + withBackground = true, }: { walletAddress: string; size?: number;