fix(wallet)_: Disable send button on router errors & visually indicate gas issues (#15950)

* Disable the send button when the router returns errors.
 * Display a red arrow on networks lacking sufficient gas for the transaction.

Closes #15700 #15701

Co-authored-by: belalshehab <belal@status.im>
This commit is contained in:
Anastasiya 2024-08-02 21:03:30 +03:00 committed by GitHub
parent cf5b712306
commit 4a6b622458
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

View File

@ -660,7 +660,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()
}

View File

@ -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,