diff --git a/ui/app/AppLayouts/Chat/popups/ChatCommandModal.qml b/ui/app/AppLayouts/Chat/popups/ChatCommandModal.qml index ff81468ff1..5b3339a38c 100644 --- a/ui/app/AppLayouts/Chat/popups/ChatCommandModal.qml +++ b/ui/app/AppLayouts/Chat/popups/ChatCommandModal.qml @@ -4,146 +4,151 @@ import QtQuick.Layouts 1.13 import QtQuick.Dialogs 1.3 import utils 1.0 -import "../../../../shared" + +import StatusQ.Core 0.1 +import StatusQ.Core.Theme 0.1 +import StatusQ.Popups 0.1 +import StatusQ.Controls 0.1 as StatusQControls + import "../../../../shared/panels" import "../../../../shared/controls" -import "../../../../shared/popups" import "../../../../shared/views" -import "../../../../shared/status" -// TODO: replace with StatusModal -ModalPopup { + +StatusModal { property string commandTitle: "Send" property string finalButtonLabel: "Request address" property var sendChatCommand: function () {} property bool isRequested: false id: root - title: root.commandTitle + anchors.centerIn: parent + header.title: root.commandTitle height: 504 property alias selectRecipient: selectRecipient - TransactionStackView { - id: stack - anchors.fill: parent - anchors.leftMargin: Style.current.padding - anchors.rightMargin: Style.current.padding - onGroupActivated: { - root.title = group.headerText - btnNext.text = group.footerText - } - TransactionFormGroup { - id: group1 - headerText: root.commandTitle - //% "Continue" - footerText: qsTrId("continue") + contentItem: Item { + width: root.width + height: childrenRect.height + TransactionStackView { + id: stack + anchors.top: parent.top + anchors.topMargin: 16 + anchors.leftMargin: Style.current.padding + anchors.rightMargin: Style.current.padding - AccountSelector { - id: selectFromAccount - accounts: walletModel.accountsView.accounts - selectedAccount: { - const currAcc = walletModel.accountsView.currentAccount - if (currAcc.walletType !== Constants.watchWalletType) { - return currAcc + onGroupActivated: { + root.header.title = group.headerText + btnNext.text = group.footerText + } + TransactionFormGroup { + id: group1 + headerText: root.commandTitle + //% "Continue" + footerText: qsTrId("continue") + + StatusQControls.StatusAccountSelector { + id: selectFromAccount + accounts: walletModel.accountsView.accounts + selectedAccount: { + const currAcc = walletModel.accountsView.currentAccount + if (currAcc.walletType !== Constants.watchWalletType) { + return currAcc + } + return null + } + currency: walletModel.balanceView.defaultCurrency + width: stack.width + label: { + return root.isRequested ? + //% "Receive on account" + qsTrId("receive-on-account") : + //% "From account" + qsTrId("from-account") } - return null } - currency: walletModel.balanceView.defaultCurrency - width: stack.width - label: { - return root.isRequested ? - //% "Receive on account" - qsTrId("receive-on-account") : - //% "From account" - qsTrId("from-account") + SeparatorWithIcon { + id: separator + anchors.top: selectFromAccount.bottom + anchors.topMargin: 19 + icon.rotation: root.isRequested ? -90 : 90 + } + + StatusBaseText { + id: addressRequiredInfo + anchors.right: selectRecipient.right + anchors.bottom: selectRecipient.top + anchors.bottomMargin: -Style.current.padding + //% "Address request required" + text: qsTrId("address-request-required") + color: Theme.palette.dangerColor1 + visible: addressRequiredValidator.isWarn + } + + RecipientSelector { + id: selectRecipient + accounts: walletModel.accountsView.accounts + contacts: profileModel.contacts.addedContacts + label: root.isRequested ? + //% "From" + qsTrId("from") : + //% "To" + qsTrId("to") + anchors.top: separator.bottom + anchors.topMargin: 10 + width: stack.width + onSelectedRecipientChanged: { + addressRequiredValidator.address = root.isRequested ? selectFromAccount.selectedAccount.address : selectRecipient.selectedRecipient.address + } } } - SeparatorWithIcon { - id: separator - anchors.top: selectFromAccount.bottom - anchors.topMargin: 19 - icon.rotation: root.isRequested ? -90 : 90 - } - - StyledText { - id: addressRequiredInfo - anchors.right: selectRecipient.right - anchors.bottom: selectRecipient.top - anchors.bottomMargin: -Style.current.padding - //% "Address request required" - text: qsTrId("address-request-required") - color: Style.current.danger - visible: addressRequiredValidator.isWarn - } - - RecipientSelector { - id: selectRecipient - accounts: walletModel.accountsView.accounts - contacts: profileModel.contacts.addedContacts - label: root.isRequested ? - //% "From" - qsTrId("from") : - //% "To" - qsTrId("to") - anchors.top: separator.bottom - anchors.topMargin: 10 - width: stack.width - onSelectedRecipientChanged: { - addressRequiredValidator.address = root.isRequested ? selectFromAccount.selectedAccount.address : selectRecipient.selectedRecipient.address - } - } - } - TransactionFormGroup { - id: group2 - headerText: root.commandTitle - //% "Preview" - footerText: qsTrId("preview") - - AssetAndAmountInput { - id: txtAmount - selectedAccount: selectFromAccount.selectedAccount - defaultCurrency: walletModel.balanceView.defaultCurrency - getFiatValue: walletModel.balanceView.getFiatValue - getCryptoValue: walletModel.balanceView.getCryptoValue - validateBalance: !root.isRequested - width: stack.width - } - } - TransactionFormGroup { - id: group3 - headerText: root.isRequested ? + TransactionFormGroup { + id: group2 + headerText: root.commandTitle //% "Preview" - qsTrId("preview") : - //% "Transaction preview" - qsTrId("transaction-preview") - footerText: root.finalButtonLabel + footerText: qsTrId("preview") - TransactionPreview { - id: pvwTransaction - width: stack.width - fromAccount: root.isRequested ? selectRecipient.selectedRecipient : selectFromAccount.selectedAccount - toAccount: root.isRequested ? selectFromAccount.selectedAccount : selectRecipient.selectedRecipient - asset: txtAmount.selectedAsset - amount: { "value": txtAmount.selectedAmount, "fiatValue": txtAmount.selectedFiatAmount } - toWarn: addressRequiredValidator.isWarn - currency: walletModel.balanceView.defaultCurrency + AssetAndAmountInput { + id: txtAmount + selectedAccount: selectFromAccount.selectedAccount + defaultCurrency: walletModel.balanceView.defaultCurrency + getFiatValue: walletModel.balanceView.getFiatValue + getCryptoValue: walletModel.balanceView.getCryptoValue + validateBalance: !root.isRequested + width: stack.width + } } + TransactionFormGroup { + id: group3 + headerText: root.isRequested ? + //% "Preview" + qsTrId("preview") : + //% "Transaction preview" + qsTrId("transaction-preview") + footerText: root.finalButtonLabel - AddressRequiredValidator { - id: addressRequiredValidator - anchors.bottom: parent.bottom - anchors.bottomMargin: Style.current.padding + TransactionPreview { + id: pvwTransaction + width: stack.width + fromAccount: root.isRequested ? selectRecipient.selectedRecipient : selectFromAccount.selectedAccount + toAccount: root.isRequested ? selectFromAccount.selectedAccount : selectRecipient.selectedRecipient + asset: txtAmount.selectedAsset + amount: { "value": txtAmount.selectedAmount, "fiatValue": txtAmount.selectedFiatAmount } + toWarn: addressRequiredValidator.isWarn + currency: walletModel.balanceView.defaultCurrency + } + + AddressRequiredValidator { + id: addressRequiredValidator + anchors.bottom: parent.bottom + anchors.bottomMargin: Style.current.padding + } } } } - footer: Item { - width: parent.width - height: btnNext.height - - StatusRoundButton { - id: btnBack - anchors.left: parent.left + leftButtons: [ + StatusQControls.StatusRoundButton { visible: !stack.isFirstGroup icon.name: "arrow-right" icon.width: 20 @@ -153,9 +158,11 @@ ModalPopup { stack.back() } } - StatusButton { + ] + + rightButtons: [ + StatusQControls.StatusButton { id: btnNext - anchors.right: parent.right //% "Next" text: qsTrId("next") enabled: stack.currentGroup.isValid && !stack.currentGroup.isPending @@ -172,7 +179,7 @@ ModalPopup { } } } - } + ] } /*##^## diff --git a/ui/app/AppLayouts/Chat/views/ChatColumnView.qml b/ui/app/AppLayouts/Chat/views/ChatColumnView.qml index 1a8adb5124..ed2872b515 100644 --- a/ui/app/AppLayouts/Chat/views/ChatColumnView.qml +++ b/ui/app/AppLayouts/Chat/views/ChatColumnView.qml @@ -452,7 +452,7 @@ Item { isRequested: false //% "Send" commandTitle: qsTrId("command-button-send") - title: commandTitle + header.title: commandTitle //% "Request Address" finalButtonLabel: qsTrId("request-address") selectRecipient.selectedRecipient: { @@ -480,7 +480,7 @@ Item { isRequested: true //% "Request" commandTitle: qsTrId("wallet-request") - title: commandTitle + header.title: commandTitle //% "Request" finalButtonLabel: qsTrId("wallet-request") selectRecipient.selectedRecipient: {