feat(SendModal): add a spinner when resolving an ENS name
- update the SB page with the toggle too Fixes #16355
This commit is contained in:
parent
6a2b3faeb0
commit
894a5f19c9
|
@ -96,6 +96,7 @@ SplitView {
|
||||||
property bool areTestNetworksEnabled: true
|
property bool areTestNetworksEnabled: true
|
||||||
|
|
||||||
function setRouteDisabledChains(chainId, disabled) {}
|
function setRouteDisabledChains(chainId, disabled) {}
|
||||||
|
function stopUpdatesForSuggestedRoute() {}
|
||||||
|
|
||||||
walletAssetStore: root.walletAssetStore
|
walletAssetStore: root.walletAssetStore
|
||||||
tokensStore.showCommunityAssetsInSend: showCommunityAssetsCheckBox.checked
|
tokensStore.showCommunityAssetsInSend: showCommunityAssetsCheckBox.checked
|
||||||
|
|
|
@ -29,6 +29,7 @@ SplitView {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
interactive: ctrlInteractive.checked
|
interactive: ctrlInteractive.checked
|
||||||
checkMarkVisible: ctrlCheckmark.checked
|
checkMarkVisible: ctrlCheckmark.checked
|
||||||
|
loading: ctrlLoading.checked
|
||||||
Component.onCompleted: forceActiveFocus()
|
Component.onCompleted: forceActiveFocus()
|
||||||
|
|
||||||
onClearClicked: logs.logEvent("SendRecipientInput::clearClicked", [], arguments)
|
onClearClicked: logs.logEvent("SendRecipientInput::clearClicked", [], arguments)
|
||||||
|
@ -62,6 +63,11 @@ SplitView {
|
||||||
text: "Checkmark visible"
|
text: "Checkmark visible"
|
||||||
checked: false
|
checked: false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Switch {
|
||||||
|
id: ctrlLoading
|
||||||
|
text: "Loading"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,5 +179,15 @@ Item {
|
||||||
verify(!!checkmarkIcon)
|
verify(!!checkmarkIcon)
|
||||||
verify(checkmarkIcon.visible)
|
verify(checkmarkIcon.visible)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function test_loading() {
|
||||||
|
verify(!!controlUnderTest)
|
||||||
|
compare(controlUnderTest.loading, false)
|
||||||
|
controlUnderTest.loading = true
|
||||||
|
controlUnderTest.text = "replicator.eth" // loadingIndicator visible only with some text
|
||||||
|
const loadingIndicator = findChild(controlUnderTest, "loadingIndicator")
|
||||||
|
verify(!!loadingIndicator)
|
||||||
|
verify(loadingIndicator.visible)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,13 +75,18 @@ QtObject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function splitAndFormatAddressPrefix(textAddrss, updateInStore) {
|
function splitAndFormatAddressPrefix(textAddress, updateInStore) {
|
||||||
return textAddrss
|
return {
|
||||||
|
formattedText: textAddress,
|
||||||
|
address: textAddress
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function resolveENS(value: string) {
|
function resolveENS(value: string) {
|
||||||
if (!!value && value.endsWith(".eth"))
|
if (!!value && value.endsWith(".eth"))
|
||||||
root.mainModuleInst.resolvedENS("", "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc4", "") // return some valid address
|
root.mainModuleInst.resolvedENS("", "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc4", "") // return some valid address
|
||||||
|
else
|
||||||
|
root.mainModuleInst.resolvedENS("", "", "") // invalid
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAsset(assetsList, symbol) {
|
function getAsset(assetsList, symbol) {
|
||||||
|
|
|
@ -667,7 +667,7 @@ StatusDialog {
|
||||||
store: popup.store
|
store: popup.store
|
||||||
interactive: popup.interactive
|
interactive: popup.interactive
|
||||||
selectedRecipient: popup.preSelectedRecipient
|
selectedRecipient: popup.preSelectedRecipient
|
||||||
ensAddressOrEmpty: recipientInputLoader.resolvedENSAddress
|
ensAddressOrEmpty: recipientInputLoader.ready ? recipientInputLoader.resolvedENSAddress : ""
|
||||||
amountToSend: amountToSend.asNumber
|
amountToSend: amountToSend.asNumber
|
||||||
minSendCryptoDecimals: amountToSend.minSendCryptoDecimals
|
minSendCryptoDecimals: amountToSend.minSendCryptoDecimals
|
||||||
minReceiveCryptoDecimals: amountToSend.minReceiveCryptoDecimals
|
minReceiveCryptoDecimals: amountToSend.minReceiveCryptoDecimals
|
||||||
|
|
|
@ -4,6 +4,7 @@ import QtQuick.Layouts 1.15
|
||||||
|
|
||||||
import StatusQ 0.1
|
import StatusQ 0.1
|
||||||
import StatusQ.Controls 0.1
|
import StatusQ.Controls 0.1
|
||||||
|
import StatusQ.Components 0.1
|
||||||
import StatusQ.Core 0.1
|
import StatusQ.Core 0.1
|
||||||
import StatusQ.Core.Theme 0.1
|
import StatusQ.Core.Theme 0.1
|
||||||
|
|
||||||
|
@ -12,6 +13,7 @@ StatusInput {
|
||||||
|
|
||||||
property bool interactive: true
|
property bool interactive: true
|
||||||
property bool checkMarkVisible
|
property bool checkMarkVisible
|
||||||
|
property bool loading
|
||||||
|
|
||||||
signal clearClicked()
|
signal clearClicked()
|
||||||
signal validateInputRequested()
|
signal validateInputRequested()
|
||||||
|
@ -19,7 +21,7 @@ StatusInput {
|
||||||
placeholderText: qsTr("Enter an ENS name or address")
|
placeholderText: qsTr("Enter an ENS name or address")
|
||||||
input.background.color: Theme.palette.indirectColor1
|
input.background.color: Theme.palette.indirectColor1
|
||||||
input.background.border.width: 0
|
input.background.border.width: 0
|
||||||
input.implicitHeight: 56
|
input.implicitHeight: 64
|
||||||
rightPadding: 12
|
rightPadding: 12
|
||||||
input.clearable: false // custom button below
|
input.clearable: false // custom button below
|
||||||
input.edit.readOnly: !root.interactive
|
input.edit.readOnly: !root.interactive
|
||||||
|
@ -27,6 +29,12 @@ StatusInput {
|
||||||
input.edit.textFormat: TextEdit.RichText
|
input.edit.textFormat: TextEdit.RichText
|
||||||
|
|
||||||
input.rightComponent: RowLayout {
|
input.rightComponent: RowLayout {
|
||||||
|
StatusLoadingIndicator {
|
||||||
|
objectName: "loadingIndicator"
|
||||||
|
Layout.preferredWidth: 16
|
||||||
|
Layout.preferredHeight: 16
|
||||||
|
visible: root.input.edit.length !== 0 && root.loading
|
||||||
|
}
|
||||||
StatusButton {
|
StatusButton {
|
||||||
objectName: "pasteButton"
|
objectName: "pasteButton"
|
||||||
font.weight: Font.Normal
|
font.weight: Font.Normal
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import QtQuick 2.13
|
import QtQuick 2.15
|
||||||
import QtQuick.Layouts 1.13
|
import QtQuick.Layouts 1.15
|
||||||
|
|
||||||
import StatusQ.Controls 0.1
|
import StatusQ.Controls 0.1
|
||||||
import StatusQ.Core 0.1
|
import StatusQ.Core 0.1
|
||||||
|
@ -15,7 +15,6 @@ import shared.popups.send.panels 1.0
|
||||||
import shared.popups.send 1.0
|
import shared.popups.send 1.0
|
||||||
|
|
||||||
import utils 1.0
|
import utils 1.0
|
||||||
import shared.stores.send 1.0
|
|
||||||
|
|
||||||
import "../controls"
|
import "../controls"
|
||||||
|
|
||||||
|
@ -30,7 +29,7 @@ Loader {
|
||||||
property var selectedRecipient: null
|
property var selectedRecipient: null
|
||||||
property int selectedRecipientType: Helpers.RecipientAddressObjectType.Address
|
property int selectedRecipientType: Helpers.RecipientAddressObjectType.Address
|
||||||
|
|
||||||
readonly property bool ready: (d.isAddressValid || !!resolvedENSAddress) && !d.isPending
|
readonly property bool ready: d.isAddressValid && !d.isPending
|
||||||
property string addressText
|
property string addressText
|
||||||
property string resolvedENSAddress
|
property string resolvedENSAddress
|
||||||
|
|
||||||
|
@ -87,7 +86,7 @@ Loader {
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
id: d
|
id: d
|
||||||
property bool isAddressValid: Utils.isValidAddress(root.addressText)
|
readonly property bool isAddressValid: Utils.isValidAddress(root.addressText)
|
||||||
readonly property var resolveENS: Backpressure.debounce(root, 1500, function (ensName) {
|
readonly property var resolveENS: Backpressure.debounce(root, 1500, function (ensName) {
|
||||||
store.resolveENS(ensName)
|
store.resolveENS(ensName)
|
||||||
})
|
})
|
||||||
|
@ -105,7 +104,7 @@ Loader {
|
||||||
|
|
||||||
function evaluateAndSetPreferredChains() {
|
function evaluateAndSetPreferredChains() {
|
||||||
let address = !!root.item.input && !!root.store.plainText(root.item.input.text) ? root.store.plainText(root.item.input.text): ""
|
let address = !!root.item.input && !!root.store.plainText(root.item.input.text) ? root.store.plainText(root.item.input.text): ""
|
||||||
let result = store.splitAndFormatAddressPrefix(address, !root.isBridgeTx && !isCollectiblesTransfer)
|
let result = root.store.splitAndFormatAddressPrefix(address, !root.isBridgeTx && !root.isCollectiblesTransfer)
|
||||||
if(!!result.address) {
|
if(!!result.address) {
|
||||||
root.addressText = result.address
|
root.addressText = result.address
|
||||||
if(!!root.item.input) {
|
if(!!root.item.input) {
|
||||||
|
@ -198,6 +197,7 @@ Loader {
|
||||||
|
|
||||||
interactive: root.interactive
|
interactive: root.interactive
|
||||||
checkMarkVisible: root.ready
|
checkMarkVisible: root.ready
|
||||||
|
loading: d.isPending || d.waitTimer.running
|
||||||
onClearClicked: d.clearValues()
|
onClearClicked: d.clearValues()
|
||||||
onValidateInputRequested: validateInput()
|
onValidateInputRequested: validateInput()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue