fix(EditOwnerTokenView): Fee errors handling fixed

Closes: #11823
This commit is contained in:
Michał Cieślak 2023-08-11 14:16:53 +02:00 committed by Michał
parent 2c50004275
commit 197c211fbc
2 changed files with 56 additions and 37 deletions

View File

@ -247,7 +247,6 @@ StackView {
ownerToken.accountAddress, ownerToken.accountAddress,
Constants.TokenType.ERC721) Constants.TokenType.ERC721)
feeText: root.feeText feeText: root.feeText
feeErrorText: root.feeErrorText feeErrorText: root.feeErrorText
isFeeLoading: root.isFeeLoading isFeeLoading: root.isFeeLoading
@ -259,6 +258,7 @@ StackView {
editOwnerTokenView.communityName) editOwnerTokenView.communityName)
totalFeeText: root.isFeeLoading ? totalFeeText: root.isFeeLoading ?
"" : root.feeText "" : root.feeText
errorText: root.feeErrorText
accountName: editOwnerTokenView.ownerToken.accountName accountName: editOwnerTokenView.ownerToken.accountName
model: QtObject { model: QtObject {

View File

@ -1,19 +1,18 @@
import QtQuick 2.15 import QtQuick 2.15
import QtQuick.Layouts 1.14 import QtQuick.Layouts 1.14
import StatusQ.Components 0.1
import StatusQ.Controls 0.1
import StatusQ.Core 0.1 import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1 import StatusQ.Core.Theme 0.1
import StatusQ.Controls 0.1
import StatusQ.Components 0.1
import StatusQ.Core.Utils 0.1 as SQUtils import StatusQ.Core.Utils 0.1 as SQUtils
import StatusQ.Popups 0.1 import StatusQ.Popups 0.1
import utils 1.0 import AppLayouts.Communities.controls 1.0
import AppLayouts.Communities.panels 1.0
import AppLayouts.Communities.helpers 1.0 import AppLayouts.Communities.helpers 1.0
import AppLayouts.Communities.panels 1.0
import AppLayouts.Wallet.controls 1.0 import AppLayouts.Wallet.controls 1.0
import utils 1.0
import SortFilterProxyModel 0.2 import SortFilterProxyModel 0.2
@ -150,40 +149,51 @@ StatusScrollView {
description: qsTr("This account will be where you receive your Owner token and will also be the account that pays the token minting gas fees.") description: qsTr("This account will be where you receive your Owner token and will also be the account that pays the token minting gas fees.")
} }
// TO BE REMOVED: It will be removed with the new fees panel ColumnLayout {
StatusEmojiAndColorComboBox { spacing: 11
id: accountBox
readonly property string address: { AccountSelector {
root.accounts.count id: accountBox
return SQUtils.ModelUtils.get(root.accounts, currentIndex, "address")
readonly property string address: {
root.accounts.count
return SQUtils.ModelUtils.get(root.accounts, currentIndex, "address")
}
readonly property string initAccountName: ownerToken.accountName
readonly property int initIndex: {
root.accounts.count
return SQUtils.ModelUtils.indexOf(root.accounts, "name", initAccountName)
}
Layout.fillWidth: true
Layout.topMargin: -Style.current.halfPadding
currentIndex: (initIndex !== -1) ? initIndex : 0
model: root.accounts
onAddressChanged: {
ownerToken.accountAddress = address
tMasterToken.accountAddress = address
requestFeeDelayTimer.restart()
}
control.onDisplayTextChanged: {
ownerToken.accountName = control.displayText
tMasterToken.accountName = control.displayText
}
} }
readonly property string initAccountName: ownerToken.accountName StatusBaseText {
readonly property int initIndex: { Layout.fillWidth: true
root.accounts.count
return SQUtils.ModelUtils.indexOf(root.accounts, "name", initAccountName)
}
Layout.fillWidth: true visible: !!root.feeErrorText
Layout.topMargin: -Style.current.halfPadding horizontalAlignment: Text.AlignRight
currentIndex: (initIndex !== -1) ? initIndex : 0 font.pixelSize: Theme.tertiaryTextFontSize
model: root.accounts color: Theme.palette.dangerColor1
type: StatusComboBox.Type.Secondary text: root.feeErrorText
size: StatusComboBox.Size.Small wrapMode: Text.Wrap
implicitHeight: 44
defaultAssetName: "filled-account"
onAddressChanged: {
ownerToken.accountAddress = address
tMasterToken.accountAddress = address
root.deployFeesRequested()
}
control.onDisplayTextChanged: {
ownerToken.accountName = control.displayText
tMasterToken.accountName = control.displayText
} }
} }
@ -240,6 +250,8 @@ StatusScrollView {
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 4 Layout.topMargin: 4
Layout.bottomMargin: Style.current.padding Layout.bottomMargin: Style.current.padding
enabled: root.feeText && !root.feeErrorText
text: qsTr("Mint") text: qsTr("Mint")
onClicked: root.mintClicked() onClicked: root.mintClicked()
@ -313,8 +325,15 @@ StatusScrollView {
tMasterToken.chainName = network.chainName tMasterToken.chainName = network.chainName
tMasterToken.chainIcon = network.iconUrl tMasterToken.chainIcon = network.iconUrl
root.deployFeesRequested() requestFeeDelayTimer.restart()
} }
} }
} }
Timer {
id: requestFeeDelayTimer
interval: 500
onTriggered: root.deployFeesRequested()
}
} }