From d832a306a4ea5a1a72bdcf1ef9e865f1593185ec Mon Sep 17 00:00:00 2001 From: Noelia Date: Mon, 31 Jul 2023 15:42:38 +0200 Subject: [PATCH] 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 --- .../pages/SortableTokenHoldersPanelPage.qml | 7 +++++++ storybook/pages/StatusInfoBoxPanelPage.qml | 16 ++++++++++++++++ .../StatusQ/Components/StatusInfoBoxPanel.qml | 6 ++++-- .../panels/MintTokensSettingsPanel.qml | 3 ++- .../panels/SortableTokenHoldersPanel.qml | 3 +++ .../Communities/views/CommunityTokenView.qml | 2 ++ 6 files changed, 34 insertions(+), 3 deletions(-) diff --git a/storybook/pages/SortableTokenHoldersPanelPage.qml b/storybook/pages/SortableTokenHoldersPanelPage.qml index 1233f32975..9d8378f22d 100644 --- a/storybook/pages/SortableTokenHoldersPanelPage.qml +++ b/storybook/pages/SortableTokenHoldersPanelPage.qml @@ -43,6 +43,7 @@ SplitView { model: emptyCheckBox.checked ? emptyModel : tokenHoldersModel showRemotelyDestructMenuItem: remotelyDestructCheckBox.checked + isAirdropEnabled: airdropCheckBox.checked onViewProfileRequested: logs.logEvent("onViewProfileRequested: " + address) @@ -79,6 +80,12 @@ SplitView { checked: true text: "Show \"Remotely Destruct\" menu item" } + CheckBox { + id: airdropCheckBox + + text: "Airdrop enabled" + checked: true + } } } } diff --git a/storybook/pages/StatusInfoBoxPanelPage.qml b/storybook/pages/StatusInfoBoxPanelPage.qml index 9366e41e47..8177d20210 100644 --- a/storybook/pages/StatusInfoBoxPanelPage.qml +++ b/storybook/pages/StatusInfoBoxPanelPage.qml @@ -27,6 +27,8 @@ SplitView { title: "Get started" text: ModelsData.descriptions.ownerTokenInfo buttonText: "Mint Owner token" + buttonVisible: btnVisible.checked + buttonEnabled: btnEnabled.checked onClicked: logs.logEvent("StatusInfoBoxPanel::onClicked --> First Panel") } @@ -39,6 +41,8 @@ SplitView { iconType: ctrlIconType.currentIndex text: ModelsData.descriptions.airdropInfo buttonText: "Airdrop" + buttonVisible: btnVisible.checked + buttonEnabled: btnEnabled.checked 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 + } } } } diff --git a/ui/StatusQ/src/StatusQ/Components/StatusInfoBoxPanel.qml b/ui/StatusQ/src/StatusQ/Components/StatusInfoBoxPanel.qml index 7bb3cdfd9e..8c7c791bd0 100644 --- a/ui/StatusQ/src/StatusQ/Components/StatusInfoBoxPanel.qml +++ b/ui/StatusQ/src/StatusQ/Components/StatusInfoBoxPanel.qml @@ -14,7 +14,8 @@ Control { property string icon property int iconType: StatusInfoBoxPanel.Type.Info property alias buttonText: button.text - property alias buttonVisible: button.visible + property bool buttonVisible: true + property bool buttonEnabled: true enum Type { Info, @@ -105,7 +106,8 @@ Control { Layout.alignment: Qt.AlignHCenter - visible: true + visible: root.buttonVisible + enabled: root.buttonEnabled onClicked: root.clicked() } diff --git a/ui/app/AppLayouts/Communities/panels/MintTokensSettingsPanel.qml b/ui/app/AppLayouts/Communities/panels/MintTokensSettingsPanel.qml index 6d51b43345..d0f3fa4340 100644 --- a/ui/app/AppLayouts/Communities/panels/MintTokensSettingsPanel.qml +++ b/ui/app/AppLayouts/Communities/panels/MintTokensSettingsPanel.qml @@ -552,6 +552,7 @@ StackView { id: footer readonly property TokenObject token: view.token + readonly property bool isAssetView: view.isAssetView readonly property bool deployStateCompleted: token.deployState === Constants.ContractTransactionStatus.Completed @@ -574,7 +575,7 @@ StackView { } airdropEnabled: deployStateCompleted && (token.infiniteSupply || - token.remainingTokens !== 0) + token.remainingTokens > 0) remotelyDestructEnabled: deployStateCompleted && !!view.tokenOwnersModel && diff --git a/ui/app/AppLayouts/Communities/panels/SortableTokenHoldersPanel.qml b/ui/app/AppLayouts/Communities/panels/SortableTokenHoldersPanel.qml index 051ba5a7c0..40fc6bb05c 100644 --- a/ui/app/AppLayouts/Communities/panels/SortableTokenHoldersPanel.qml +++ b/ui/app/AppLayouts/Communities/panels/SortableTokenHoldersPanel.qml @@ -20,6 +20,7 @@ Control { property string tokenName property bool showRemotelyDestructMenuItem: true + property alias isAirdropEnabled: infoBoxPanel.buttonEnabled readonly property alias sortBy: holdersList.sortBy readonly property alias sorting: holdersList.sorting @@ -104,6 +105,8 @@ Control { } StatusInfoBoxPanel { + id: infoBoxPanel + Layout.fillWidth: true Layout.topMargin: Style.current.padding diff --git a/ui/app/AppLayouts/Communities/views/CommunityTokenView.qml b/ui/app/AppLayouts/Communities/views/CommunityTokenView.qml index 4dd25b993a..73217980b4 100644 --- a/ui/app/AppLayouts/Communities/views/CommunityTokenView.qml +++ b/ui/app/AppLayouts/Communities/views/CommunityTokenView.qml @@ -222,6 +222,8 @@ StatusScrollView { model: root.tokenOwnersModel tokenName: root.name showRemotelyDestructMenuItem: !root.isAssetView && root.remotelyDestruct + isAirdropEnabled: root.deploymentCompleted && + (token.infiniteSupply || token.remainingTokens > 0) Layout.topMargin: Style.current.padding Layout.fillWidth: true