feat: buy flow wording adjusted

This commit is contained in:
Anastasiya Semenkevich 2024-11-25 18:42:43 +03:00 committed by Anastasiya
parent c99697134b
commit 9b73badd22
8 changed files with 16 additions and 15 deletions

View File

@ -49,7 +49,7 @@ SplitView {
TextField {
Layout.fillWidth: true
id: ctrlText
text: "Insufficient funds to pay gas fees"
text: "Not enough ETH to pay gas fees"
}
}
RowLayout {
@ -58,7 +58,7 @@ SplitView {
TextField {
Layout.fillWidth: true
id: ctrlButtonText
text: "Buy ETH"
text: "Add ETH"
}
}
RowLayout {

View File

@ -193,7 +193,7 @@ Item {
verify(!!selectParamsPanel)
// title should not change
verify(controlUnderTest.stackTitle, qsTr("Buy assets for %1").arg(!!controlUnderTest.selectedAccountEntry.item ? controlUnderTest.selectedAccountEntry.item.name: ""))
verify(controlUnderTest.stackTitle, qsTr("Ways to buy assets %1").arg(!!controlUnderTest.selectedAccountEntry.item ? controlUnderTest.selectedAccountEntry.item.name: ""))
compare(controlUnderTest.rightButtons.length, 2)
verify(controlUnderTest.rightButtons[0].visible)
@ -310,7 +310,7 @@ Item {
// Launch modal
launchPopup()
verify(controlUnderTest.stackTitle, qsTr("Buy assets for %1").arg(!!controlUnderTest.selectedAccountEntry.item ? controlUnderTest.selectedAccountEntry.item.name: ""))
verify(controlUnderTest.stackTitle, qsTr("Ways to buy assets for %1").arg(!!controlUnderTest.selectedAccountEntry.item ? controlUnderTest.selectedAccountEntry.item.name: ""))
// // find tab bar
// const tabBar = findChild(controlUnderTest, "tabBar")

View File

@ -12,7 +12,7 @@ Item {
id: componentUnderTest
ErrorTag {
anchors.centerIn: parent
text: "Insufficient funds to pay gas fees"
text: "Not enough ETH to pay gas fees"
}
}
@ -49,7 +49,7 @@ Item {
verify(!!controlUnderTest)
waitForRendering(controlUnderTest)
const origWidth = controlUnderTest.width
controlUnderTest.buttonText = "Buy crypto"
controlUnderTest.buttonText = "Add assets"
controlUnderTest.buttonVisible = true
waitForRendering(controlUnderTest)
const widthWithButton = controlUnderTest.width
@ -61,7 +61,7 @@ Item {
function test_buttonClick() {
verify(!!controlUnderTest)
controlUnderTest.buttonText = "Buy crypto"
controlUnderTest.buttonText = "Add assets"
controlUnderTest.buttonVisible = true
const button = findChild(controlUnderTest, "rightComponentButton")
verify(!!button)

View File

@ -684,7 +684,7 @@ Item {
compare(root.swapAdaptor.swapOutputData.approvalNeeded, false)
compare(root.swapAdaptor.swapOutputData.hasError, true)
verify(errorTag.visible)
verify(errorTag.text, qsTr("Insufficient funds to pay gas fees"))
verify(errorTag.text, qsTr("Not enough ETH to pay gas fees"))
verify(!signButton.interactive)
compare(signButton.text, qsTr("Swap"))
@ -1314,7 +1314,7 @@ Item {
let errortext = amountEnteredGreaterThanMaxBalance ? qsTr("Insufficient funds for swap"): qsTr("An error has occured, please try again")
compare(errorTag.visible, amountEnteredGreaterThanMaxBalance)
compare(errorTag.text, root.swapAdaptor.errorMessage)
compare(errorTag.buttonText, root.swapAdaptor.isTokenBalanceInsufficient ? qsTr("Buy crypto") : qsTr("Buy ETH"))
compare(errorTag.buttonText, root.swapAdaptor.isTokenBalanceInsufficient ? qsTr("Add assets") : qsTr("Add ETH"))
compare(errorTag.buttonVisible, amountEnteredGreaterThanMaxBalance)
}

View File

@ -367,7 +367,6 @@ Item {
onLaunchBuyCryptoModal: {
d.buyFormData.selectedWalletAddress = d.getSelectedOrFirstNonWatchedAddress()
d.buyFormData.selectedNetworkChainId = StatusQUtils.ModelUtils.getByKey(RootStore.filteredFlatModel, "layer", 1, "chainId")
d.buyFormData.selectedTokenKey = Constants.ethToken
if(!!walletStore.currentViewedHoldingTokensKey && walletStore.currentViewedHoldingType === Constants.TokenType.ERC20) {
d.buyFormData.selectedTokenKey = walletStore.currentViewedHoldingTokensKey
}

View File

@ -88,7 +88,7 @@ StatusStackModal {
readonly property ModelEntry selectedTokenEntry: ModelEntry {
sourceModel: root.plainTokensBySymbolModel
key: "key"
value: root.buyCryptoInputParamsForm.selectedTokenKey
value: root.buyCryptoInputParamsForm.selectedTokenKey || Constants.ethToken
}
readonly property ModelEntry selectedProviderEntry: ModelEntry {
@ -140,7 +140,7 @@ StatusStackModal {
width: 560
height: 515
padding: Theme.xlPadding
stackTitle: qsTr("Buy assets for %1").arg(!!d.selectedAccountEntry.item ? d.selectedAccountEntry.item.name: "")
stackTitle: !!root.buyCryptoInputParamsForm.selectedTokenKey ? qsTr("Ways to buy %1 for %2").arg(d.selectedTokenEntry.item.name).arg(!!d.selectedAccountEntry.item ? d.selectedAccountEntry.item.name: ""): qsTr("Ways to buy assets for %1").arg(!!d.selectedAccountEntry.item ? d.selectedAccountEntry.item.name: "")
rightButtons: [d.buyButton, finishButton]
finishButton: StatusButton {
text: qsTr("Done")

View File

@ -310,13 +310,15 @@ StatusDialog {
Layout.alignment: Qt.AlignHCenter
Layout.topMargin: Theme.smallPadding
text: root.swapAdaptor.errorMessage
buttonText: root.swapAdaptor.isTokenBalanceInsufficient ? qsTr("Buy crypto") : qsTr("Buy ETH")
buttonText: root.swapAdaptor.isTokenBalanceInsufficient ? qsTr("Add assets") : qsTr("Add ETH")
buttonVisible: visible && (root.swapAdaptor.isTokenBalanceInsufficient || root.swapAdaptor.isEthBalanceInsufficient)
onButtonClicked: {
// value dont update correctly if not done from here
d.buyFormData.selectedWalletAddress = root.swapInputParamsForm.selectedAccountAddress
d.buyFormData.selectedNetworkChainId = root.swapInputParamsForm.selectedNetworkChainId
d.buyFormData.selectedTokenKey =root.swapInputParamsForm.fromTokensKey
d.buyFormData.selectedTokenKey = root.swapAdaptor.isTokenBalanceInsufficient ?
root.swapInputParamsForm.fromTokensKey :
Constants.ethToken
Global.openBuyCryptoModalRequested(d.buyFormData)
}
}

View File

@ -178,7 +178,7 @@ QObject {
if (isBalanceInsufficientForSwap) {
return qsTr("Insufficient funds for swap")
} else if (isBalanceInsufficientForFees) {
return qsTr("Insufficient funds to pay gas fees")
return qsTr("Not enough ETH to pay gas fees")
} else if (root.swapOutputData.hasError) {
// TOOD #15874: Unify with WalletUtils router error code handling
switch (root.swapOutputData.errCode) {