From 955c8f658089ddb65f17465703a65f642b813fa8 Mon Sep 17 00:00:00 2001 From: belalshehab Date: Sat, 27 Jul 2024 19:21:14 +0300 Subject: [PATCH] fix(wallet)_: Disable send button on router errors & visually indicate gas issues * Disable the send button when the router returns errors. * Display a red arrow on networks lacking sufficient gas for the transaction. Closes #15700 #15701 --- ui/imports/shared/popups/send/SendModal.qml | 2 +- ui/imports/shared/popups/send/views/NetworkCardsComponent.qml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ui/imports/shared/popups/send/SendModal.qml b/ui/imports/shared/popups/send/SendModal.qml index cc550ce9de..f2433bf06f 100644 --- a/ui/imports/shared/popups/send/SendModal.qml +++ b/ui/imports/shared/popups/send/SendModal.qml @@ -656,7 +656,7 @@ StatusDialog { maxFiatFees: popup.isLoading ? "..." : d.currencyStore.formatCurrencyAmount(d.totalFeesInFiat, d.currencyStore.currentCurrency) totalTimeEstimate: popup.isLoading? "..." : d.totalTimeEstimate pending: d.isPendingTx || popup.isLoading - visible: recipientInputLoader.ready && (amountToSend.ready || d.isCollectiblesTransfer) && !d.errorMode + visible: recipientInputLoader.ready && (amountToSend.ready || d.isCollectiblesTransfer) && !d.errorMode && !d.routerError onNextButtonClicked: popup.sendTransaction() } diff --git a/ui/imports/shared/popups/send/views/NetworkCardsComponent.qml b/ui/imports/shared/popups/send/views/NetworkCardsComponent.qml index d534b14f77..10de5d3fe4 100644 --- a/ui/imports/shared/popups/send/views/NetworkCardsComponent.qml +++ b/ui/imports/shared/popups/send/views/NetworkCardsComponent.qml @@ -95,6 +95,7 @@ Item { onTokenBalanceChanged: maxAdvancedValue = model.tokenBalance.amount property var toNetworks: model.toNetworks property int routeOnNetwork: 0 + readonly property bool hasGas: model.hasGas onToNetworksChanged: d.draw() primaryText: model.chainName @@ -236,7 +237,7 @@ Item { fromN.routeOnNetwork += 1 toN.routeOnNetwork += 1 toN.bentLine = toN.objectName !== fromN.objectName - let routeColor = root.errorMode ? Theme.palette.dangerColor1 : toN.preferred ? '#627EEA' : Theme.palette.pinColor1 + let routeColor = root.errorMode || !fromN.hasGas ? Theme.palette.dangerColor1 : toN.preferred ? '#627EEA' : Theme.palette.pinColor1 StatusQUtils.Utils.drawArrow(ctx, fromN.x + fromN.width, fromN.y + fromN.cardIconPosition + yOffsetFrom, toNetworksLayout.x + toN.x,