From 6d185443b2cdad3e57e03d0df9016e8fdf88498f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Riquelme=20Guzm=C3=A1n?= Date: Fri, 5 Jul 2024 12:04:18 -0400 Subject: [PATCH] fix: render issue on detail view for transfers with execution property as null --- src/pages/DetailView/DetailView.tsx | 36 ++++++++++++++++------------- src/utils/Helpers.tsx | 4 ++-- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/src/pages/DetailView/DetailView.tsx b/src/pages/DetailView/DetailView.tsx index dc7a10f..7176272 100644 --- a/src/pages/DetailView/DetailView.tsx +++ b/src/pages/DetailView/DetailView.tsx @@ -113,7 +113,7 @@ export default function DetailView() { Source transaction hash: @@ -139,26 +139,30 @@ export default function DetailView() { Destination transaction hash: {transfer?.execution && transfer?.execution?.txHash} - { - void navigator.clipboard?.writeText(transfer?.execution?.txHash!) - dispatcher({ - type: "set_clipboard_message_t2", - payload: "Copied to clipboard!", - }) - }} - > - - - - + {transfer?.execution ? ( + { + void navigator.clipboard?.writeText(transfer?.execution?.txHash!) + dispatcher({ + type: "set_clipboard_message_t2", + payload: "Copied to clipboard!", + }) + }} + > + + + + + ) : ( + Pending proposal execution + )}
diff --git a/src/utils/Helpers.tsx b/src/utils/Helpers.tsx index 1310836..1871285 100644 --- a/src/utils/Helpers.tsx +++ b/src/utils/Helpers.tsx @@ -306,12 +306,12 @@ export const renderFormatedConvertedAmount = (type: ResourceTypes, usdValue: num return "" } -export const txHashLinks = (type: DomainTypes, txHash: string, domainExplorerUrl: string): string => { +export const txHashLinks = (type: DomainTypes, domainExplorerUrl: string, txHash?: string): string => { switch (type) { case DomainTypes.EVM: return `${domainExplorerUrl}/tx/${txHash}` case DomainTypes.SUBSTRATE: - return `${domainExplorerUrl}/${txHash.split("-")[0]}` + return `${domainExplorerUrl}/${txHash?.split("-")[0] || ""}` default: return "" }