From 197c211fbcf6e6f339f0048277f0abe2813b6781 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Cie=C5=9Blak?= Date: Fri, 11 Aug 2023 14:16:53 +0200 Subject: [PATCH] fix(EditOwnerTokenView): Fee errors handling fixed Closes: #11823 --- .../panels/MintTokensSettingsPanel.qml | 2 +- .../Communities/views/EditOwnerTokenView.qml | 91 +++++++++++-------- 2 files changed, 56 insertions(+), 37 deletions(-) diff --git a/ui/app/AppLayouts/Communities/panels/MintTokensSettingsPanel.qml b/ui/app/AppLayouts/Communities/panels/MintTokensSettingsPanel.qml index d9d8ab4706..a78695d78b 100644 --- a/ui/app/AppLayouts/Communities/panels/MintTokensSettingsPanel.qml +++ b/ui/app/AppLayouts/Communities/panels/MintTokensSettingsPanel.qml @@ -247,7 +247,6 @@ StackView { ownerToken.accountAddress, Constants.TokenType.ERC721) - feeText: root.feeText feeErrorText: root.feeErrorText isFeeLoading: root.isFeeLoading @@ -259,6 +258,7 @@ StackView { editOwnerTokenView.communityName) totalFeeText: root.isFeeLoading ? "" : root.feeText + errorText: root.feeErrorText accountName: editOwnerTokenView.ownerToken.accountName model: QtObject { diff --git a/ui/app/AppLayouts/Communities/views/EditOwnerTokenView.qml b/ui/app/AppLayouts/Communities/views/EditOwnerTokenView.qml index 0c06a7ba0a..2e3f28be23 100644 --- a/ui/app/AppLayouts/Communities/views/EditOwnerTokenView.qml +++ b/ui/app/AppLayouts/Communities/views/EditOwnerTokenView.qml @@ -1,19 +1,18 @@ import QtQuick 2.15 import QtQuick.Layouts 1.14 +import StatusQ.Components 0.1 +import StatusQ.Controls 0.1 import StatusQ.Core 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.Popups 0.1 -import utils 1.0 - -import AppLayouts.Communities.panels 1.0 +import AppLayouts.Communities.controls 1.0 import AppLayouts.Communities.helpers 1.0 - +import AppLayouts.Communities.panels 1.0 import AppLayouts.Wallet.controls 1.0 +import utils 1.0 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.") } - // TO BE REMOVED: It will be removed with the new fees panel - StatusEmojiAndColorComboBox { - id: accountBox + ColumnLayout { + spacing: 11 - readonly property string address: { - root.accounts.count - return SQUtils.ModelUtils.get(root.accounts, currentIndex, "address") + AccountSelector { + id: accountBox + + 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 - readonly property int initIndex: { - root.accounts.count - return SQUtils.ModelUtils.indexOf(root.accounts, "name", initAccountName) - } + StatusBaseText { + Layout.fillWidth: true - Layout.fillWidth: true - Layout.topMargin: -Style.current.halfPadding + visible: !!root.feeErrorText + horizontalAlignment: Text.AlignRight - currentIndex: (initIndex !== -1) ? initIndex : 0 - model: root.accounts - type: StatusComboBox.Type.Secondary - size: StatusComboBox.Size.Small - implicitHeight: 44 - defaultAssetName: "filled-account" - - onAddressChanged: { - ownerToken.accountAddress = address - tMasterToken.accountAddress = address - - root.deployFeesRequested() - } - control.onDisplayTextChanged: { - ownerToken.accountName = control.displayText - tMasterToken.accountName = control.displayText + font.pixelSize: Theme.tertiaryTextFontSize + color: Theme.palette.dangerColor1 + text: root.feeErrorText + wrapMode: Text.Wrap } } @@ -240,6 +250,8 @@ StatusScrollView { Layout.fillWidth: true Layout.topMargin: 4 Layout.bottomMargin: Style.current.padding + + enabled: root.feeText && !root.feeErrorText text: qsTr("Mint") onClicked: root.mintClicked() @@ -313,8 +325,15 @@ StatusScrollView { tMasterToken.chainName = network.chainName tMasterToken.chainIcon = network.iconUrl - root.deployFeesRequested() + requestFeeDelayTimer.restart() } } } + + Timer { + id: requestFeeDelayTimer + + interval: 500 + onTriggered: root.deployFeesRequested() + } }