refactor(ChatCommandModal): use StatusModal instead of ModalPopup

This commit is contained in:
Pascal Precht 2021-10-18 12:55:07 +02:00 committed by Iuri Matias
parent 0739f78388
commit 85065b8d33
2 changed files with 126 additions and 119 deletions

View File

@ -4,32 +4,41 @@ import QtQuick.Layouts 1.13
import QtQuick.Dialogs 1.3 import QtQuick.Dialogs 1.3
import utils 1.0 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/panels"
import "../../../../shared/controls" import "../../../../shared/controls"
import "../../../../shared/popups"
import "../../../../shared/views" import "../../../../shared/views"
import "../../../../shared/status"
// TODO: replace with StatusModal StatusModal {
ModalPopup {
property string commandTitle: "Send" property string commandTitle: "Send"
property string finalButtonLabel: "Request address" property string finalButtonLabel: "Request address"
property var sendChatCommand: function () {} property var sendChatCommand: function () {}
property bool isRequested: false property bool isRequested: false
id: root id: root
title: root.commandTitle anchors.centerIn: parent
header.title: root.commandTitle
height: 504 height: 504
property alias selectRecipient: selectRecipient property alias selectRecipient: selectRecipient
contentItem: Item {
width: root.width
height: childrenRect.height
TransactionStackView { TransactionStackView {
id: stack id: stack
anchors.fill: parent anchors.top: parent.top
anchors.topMargin: 16
anchors.leftMargin: Style.current.padding anchors.leftMargin: Style.current.padding
anchors.rightMargin: Style.current.padding anchors.rightMargin: Style.current.padding
onGroupActivated: { onGroupActivated: {
root.title = group.headerText root.header.title = group.headerText
btnNext.text = group.footerText btnNext.text = group.footerText
} }
TransactionFormGroup { TransactionFormGroup {
@ -38,7 +47,7 @@ ModalPopup {
//% "Continue" //% "Continue"
footerText: qsTrId("continue") footerText: qsTrId("continue")
AccountSelector { StatusQControls.StatusAccountSelector {
id: selectFromAccount id: selectFromAccount
accounts: walletModel.accountsView.accounts accounts: walletModel.accountsView.accounts
selectedAccount: { selectedAccount: {
@ -65,14 +74,14 @@ ModalPopup {
icon.rotation: root.isRequested ? -90 : 90 icon.rotation: root.isRequested ? -90 : 90
} }
StyledText { StatusBaseText {
id: addressRequiredInfo id: addressRequiredInfo
anchors.right: selectRecipient.right anchors.right: selectRecipient.right
anchors.bottom: selectRecipient.top anchors.bottom: selectRecipient.top
anchors.bottomMargin: -Style.current.padding anchors.bottomMargin: -Style.current.padding
//% "Address request required" //% "Address request required"
text: qsTrId("address-request-required") text: qsTrId("address-request-required")
color: Style.current.danger color: Theme.palette.dangerColor1
visible: addressRequiredValidator.isWarn visible: addressRequiredValidator.isWarn
} }
@ -136,14 +145,10 @@ ModalPopup {
} }
} }
} }
}
footer: Item { leftButtons: [
width: parent.width StatusQControls.StatusRoundButton {
height: btnNext.height
StatusRoundButton {
id: btnBack
anchors.left: parent.left
visible: !stack.isFirstGroup visible: !stack.isFirstGroup
icon.name: "arrow-right" icon.name: "arrow-right"
icon.width: 20 icon.width: 20
@ -153,9 +158,11 @@ ModalPopup {
stack.back() stack.back()
} }
} }
StatusButton { ]
rightButtons: [
StatusQControls.StatusButton {
id: btnNext id: btnNext
anchors.right: parent.right
//% "Next" //% "Next"
text: qsTrId("next") text: qsTrId("next")
enabled: stack.currentGroup.isValid && !stack.currentGroup.isPending enabled: stack.currentGroup.isValid && !stack.currentGroup.isPending
@ -172,7 +179,7 @@ ModalPopup {
} }
} }
} }
} ]
} }
/*##^## /*##^##

View File

@ -452,7 +452,7 @@ Item {
isRequested: false isRequested: false
//% "Send" //% "Send"
commandTitle: qsTrId("command-button-send") commandTitle: qsTrId("command-button-send")
title: commandTitle header.title: commandTitle
//% "Request Address" //% "Request Address"
finalButtonLabel: qsTrId("request-address") finalButtonLabel: qsTrId("request-address")
selectRecipient.selectedRecipient: { selectRecipient.selectedRecipient: {
@ -480,7 +480,7 @@ Item {
isRequested: true isRequested: true
//% "Request" //% "Request"
commandTitle: qsTrId("wallet-request") commandTitle: qsTrId("wallet-request")
title: commandTitle header.title: commandTitle
//% "Request" //% "Request"
finalButtonLabel: qsTrId("wallet-request") finalButtonLabel: qsTrId("wallet-request")
selectRecipient.selectedRecipient: { selectRecipient.selectedRecipient: {