From df517370592907b0de690481ea9c67cdc6636d90 Mon Sep 17 00:00:00 2001 From: thefirefox <57635195+wtfthefirefox@users.noreply.github.com> Date: Tue, 5 Sep 2023 23:40:46 +0300 Subject: [PATCH] fixed issue with some empty fields from server (#32) --- .../withdraw-desc-card/withdraw-desc-card.tsx | 49 +++++++++++-------- ui-dashboard/src/types/index.ts | 12 ++--- 2 files changed, 34 insertions(+), 27 deletions(-) diff --git a/ui-dashboard/src/components/withdraw-desc-card/withdraw-desc-card.tsx b/ui-dashboard/src/components/withdraw-desc-card/withdraw-desc-card.tsx index 8fa945c..fad3212 100644 --- a/ui-dashboard/src/components/withdraw-desc-card/withdraw-desc-card.tsx +++ b/ui-dashboard/src/components/withdraw-desc-card/withdraw-desc-card.tsx @@ -105,18 +105,23 @@ const WithdrawalDescCard: React.FC = ({data, openNotificationFunc, addres Transaction ID}> - {renderStrippedStr(data.additionalInfo.withdrawal.transactionHash, 24, -12)}{" "} - - copyToClipboard( - data?.additionalInfo?.withdrawal?.transactionHash - ? data.additionalInfo.withdrawal.transactionHash - : "", - openNotificationFunc - ) - } - /> + {data.additionalInfo.withdrawal.transactionHash != null + ? renderStrippedStr(data.additionalInfo.withdrawal.transactionHash, 24, -12) + : "Transaction hash is not created yet"} + {data.additionalInfo.withdrawal.transactionHash != null ? " " : null} + {data.additionalInfo.withdrawal.transactionHash != null ? ( + + copyToClipboard( + data?.additionalInfo?.withdrawal?.transactionHash + ? data.additionalInfo.withdrawal.transactionHash + : "", + openNotificationFunc + ) + } + /> + ) : null} {data.additionalInfo?.payment?.customerEmail ? ( <> @@ -135,15 +140,17 @@ const WithdrawalDescCard: React.FC = ({data, openNotificationFunc, addres ) : null} - - - View on blockchain explorer - - + {data.additionalInfo.withdrawal.explorerLink != null ? ( + + + View on blockchain explorer + + + ) : null} )} diff --git a/ui-dashboard/src/types/index.ts b/ui-dashboard/src/types/index.ts index f70c892..c5d1531 100644 --- a/ui-dashboard/src/types/index.ts +++ b/ui-dashboard/src/types/index.ts @@ -137,9 +137,9 @@ interface AdditionalPaymentInfo { interface AdditionalWithdrawalInfo { addressId: string; balanceId: string; - explorerLink: string; + explorerLink: string | null; serviceFee: string; - transactionHash: string; + transactionHash: string | null; } interface AdditionalInfo { @@ -150,15 +150,15 @@ interface AdditionalInfo { interface Payment { additionalInfo?: AdditionalInfo; id: string; - orderId: string; + orderId?: string; type: PaymentType; status: PaymentStatus; createdAt: string; currency: CurrencyWithFiat; price: string; - redirectUrl: string; - paymentUrl: string; - description: string; + redirectUrl?: string; + paymentUrl?: string; + description?: string; isTest: boolean; }