fix(Minting): After minting completed 1 airdrop button is enabled and the other disabled

- Added `buttonEnabled` property to `StatusInfoBoxPanel` so it can be set from outside.
- Fixed airdrop button enable condition in minting flow. It is enabled when minting state is completed and if the token properties are infinite supply or there are still remaining tokens to be airdropped.
- Updated storybook accordingly.

Fixes #11496
This commit is contained in:
Noelia 2023-07-31 15:42:38 +02:00 committed by Noelia
parent cb07625a57
commit d832a306a4
6 changed files with 34 additions and 3 deletions

View File

@ -43,6 +43,7 @@ SplitView {
model: emptyCheckBox.checked ? emptyModel : tokenHoldersModel model: emptyCheckBox.checked ? emptyModel : tokenHoldersModel
showRemotelyDestructMenuItem: remotelyDestructCheckBox.checked showRemotelyDestructMenuItem: remotelyDestructCheckBox.checked
isAirdropEnabled: airdropCheckBox.checked
onViewProfileRequested: onViewProfileRequested:
logs.logEvent("onViewProfileRequested: " + address) logs.logEvent("onViewProfileRequested: " + address)
@ -79,6 +80,12 @@ SplitView {
checked: true checked: true
text: "Show \"Remotely Destruct\" menu item" text: "Show \"Remotely Destruct\" menu item"
} }
CheckBox {
id: airdropCheckBox
text: "Airdrop enabled"
checked: true
}
} }
} }
} }

View File

@ -27,6 +27,8 @@ SplitView {
title: "Get started" title: "Get started"
text: ModelsData.descriptions.ownerTokenInfo text: ModelsData.descriptions.ownerTokenInfo
buttonText: "Mint Owner token" buttonText: "Mint Owner token"
buttonVisible: btnVisible.checked
buttonEnabled: btnEnabled.checked
onClicked: logs.logEvent("StatusInfoBoxPanel::onClicked --> First Panel") onClicked: logs.logEvent("StatusInfoBoxPanel::onClicked --> First Panel")
} }
@ -39,6 +41,8 @@ SplitView {
iconType: ctrlIconType.currentIndex iconType: ctrlIconType.currentIndex
text: ModelsData.descriptions.airdropInfo text: ModelsData.descriptions.airdropInfo
buttonText: "Airdrop" buttonText: "Airdrop"
buttonVisible: btnVisible.checked
buttonEnabled: btnEnabled.checked
onClicked: logs.logEvent("StatusInfoBoxPanel::onClicked --> Second Panel") onClicked: logs.logEvent("StatusInfoBoxPanel::onClicked --> Second Panel")
} }
@ -86,6 +90,18 @@ SplitView {
] ]
} }
} }
CheckBox {
id: btnVisible
text: "Button visible"
checked: true
}
CheckBox {
id: btnEnabled
text: "Button enabled"
checked: true
}
} }
} }
} }

View File

@ -14,7 +14,8 @@ Control {
property string icon property string icon
property int iconType: StatusInfoBoxPanel.Type.Info property int iconType: StatusInfoBoxPanel.Type.Info
property alias buttonText: button.text property alias buttonText: button.text
property alias buttonVisible: button.visible property bool buttonVisible: true
property bool buttonEnabled: true
enum Type { enum Type {
Info, Info,
@ -105,7 +106,8 @@ Control {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
visible: true visible: root.buttonVisible
enabled: root.buttonEnabled
onClicked: root.clicked() onClicked: root.clicked()
} }

View File

@ -552,6 +552,7 @@ StackView {
id: footer id: footer
readonly property TokenObject token: view.token readonly property TokenObject token: view.token
readonly property bool isAssetView: view.isAssetView
readonly property bool deployStateCompleted: token.deployState === Constants.ContractTransactionStatus.Completed readonly property bool deployStateCompleted: token.deployState === Constants.ContractTransactionStatus.Completed
@ -574,7 +575,7 @@ StackView {
} }
airdropEnabled: deployStateCompleted && airdropEnabled: deployStateCompleted &&
(token.infiniteSupply || (token.infiniteSupply ||
token.remainingTokens !== 0) token.remainingTokens > 0)
remotelyDestructEnabled: deployStateCompleted && remotelyDestructEnabled: deployStateCompleted &&
!!view.tokenOwnersModel && !!view.tokenOwnersModel &&

View File

@ -20,6 +20,7 @@ Control {
property string tokenName property string tokenName
property bool showRemotelyDestructMenuItem: true property bool showRemotelyDestructMenuItem: true
property alias isAirdropEnabled: infoBoxPanel.buttonEnabled
readonly property alias sortBy: holdersList.sortBy readonly property alias sortBy: holdersList.sortBy
readonly property alias sorting: holdersList.sorting readonly property alias sorting: holdersList.sorting
@ -104,6 +105,8 @@ Control {
} }
StatusInfoBoxPanel { StatusInfoBoxPanel {
id: infoBoxPanel
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: Style.current.padding Layout.topMargin: Style.current.padding

View File

@ -222,6 +222,8 @@ StatusScrollView {
model: root.tokenOwnersModel model: root.tokenOwnersModel
tokenName: root.name tokenName: root.name
showRemotelyDestructMenuItem: !root.isAssetView && root.remotelyDestruct showRemotelyDestructMenuItem: !root.isAssetView && root.remotelyDestruct
isAirdropEnabled: root.deploymentCompleted &&
(token.infiniteSupply || token.remainingTokens > 0)
Layout.topMargin: Style.current.padding Layout.topMargin: Style.current.padding
Layout.fillWidth: true Layout.fillWidth: true