feat(OwnerToken): Create Get started panel and add it to Tokens and Airdrops welcome views

- Added start panel in tokens welcome page.
- Added start panel in airdrop welcome page.
- Updated e2e tests according to new requirements.

Closes #11284
This commit is contained in:
Noelia 2023-07-06 14:33:27 +02:00 committed by Noelia
parent dea020fdba
commit eb37f44a23
13 changed files with 182 additions and 27 deletions

View File

@ -61,6 +61,14 @@ SplitView {
}
}
MintedTokensModel {
id: mintedTokensModel
}
ListModel {
id: emptyModel
}
Button {
text: "Back"
onClicked: loader.item.navigateBack()
@ -82,6 +90,8 @@ SplitView {
anchors.fill: parent
anchors.topMargin: 50
isOwner: ownerChecked.checked
tokensModel: editorModelChecked.checked ? emptyModel : mintedTokensModel
assetsModel: AssetsModel {}
collectiblesModel: ListModel {}
@ -192,5 +202,21 @@ SplitView {
SplitView.preferredHeight: 150
logsView.logText: logs.logText
Column {
CheckBox {
id: ownerChecked
checked: true
text: "Is owner?"
}
CheckBox {
id: editorModelChecked
checked: true
text: "Empty model"
}
}
}
}

View File

@ -51,6 +51,9 @@ SplitView {
anchors.fill: parent
anchors.topMargin: 50
tokensModel: editorModelChecked.checked ? emptyModel : mintedTokensModel
isAdmin: adminChecked.checked
isOwner: ownerChecked.checked
communityName: communityNameText.text
layer1Networks: NetworksModel.layer1Networks
layer2Networks: NetworksModel.layer2Networks
testNetworks: NetworksModel.testNetworks
@ -74,11 +77,38 @@ SplitView {
id: logsAndControlsPanel
SplitView.minimumHeight: 100
SplitView.preferredHeight: 150
SplitView.preferredHeight: 200
logsView.logText: logs.logText
ColumnLayout {
Row {
Label {
text: "Community name: "
}
TextEdit {
id: communityNameText
text: "TEST COMMUNITY"
}
}
CheckBox {
id: ownerChecked
checked: true
text: "Is owner?"
}
CheckBox {
id: adminChecked
checked: true
text: "Is admin?"
}
CheckBox {
id: editorModelChecked
checked: true

View File

@ -92,6 +92,15 @@ class BaseElement:
@property
def is_enabled(self) -> bool:
return self.object.enabled
@property
def is_disabled(self) -> bool:
try:
if self.object.enabled:
return false
except LookupError as e:
errMessage = "not ready: Quick item is disabled"
return errMessage in e.args[0]
def wait_until_appears(self, timeout_msec: int = configs.squish.UI_LOAD_TIMEOUT_MSEC):
assert squish.waitFor(lambda: self.is_visible, timeout_msec), f'Object {self} is not visible'

View File

@ -560,8 +560,12 @@ class StatusCommunityScreen:
return False
def verify_action_button_enabled(self, option:str):
assert BaseElement(str(CommunityWelcomeScreenComponents.ADD_NEW_ITEM_BUTTON.value)).is_enabled
def verify_action_button_present(self, option:str, enabled: bool):
button = BaseElement(str(CommunityWelcomeScreenComponents.ADD_NEW_ITEM_BUTTON.value))
if enabled:
assert button.is_enabled
else:
assert button.is_disabled
button_title = get_obj(CommunityWelcomeScreenComponents.ADD_NEW_ITEM_BUTTON.value).text
verify_equals(option, str(button_title))

View File

@ -266,7 +266,19 @@ def step(context, option:str, list):
@Then("\"|any|\" button is present")
def step (context, action_button_name):
_statusCommunityScreen.verify_action_button_enabled(action_button_name)
_statusCommunityScreen.verify_action_button_present(action_button_name, True)
@Then("\"|any|\" button is disabled")
def step (context, action_button_name):
_statusCommunityScreen.verify_action_button_present(action_button_name, False)
@Then("the user is able to open Back up modal and copy private key")
def step(context):
_statusCommunityScreen.verify_community_private_key()
@Then("the user is able to click Airdrop Tokens button and navigate to Airdrops screen")
def step(context):
_statusCommunityScreen.open_airdrops_from_overview()
###########################################################################
### COMMON methods used in different steps given/when/then region:

View File

@ -20,4 +20,4 @@ Background:
| Reward individual members with custom tokens for their contribution |
| Incentivise joining, retention, moderation and desired behaviour |
| Require holding a token or NFT to obtain exclusive membership rights |
And "New Airdrop" button is present
And "New Airdrop" button is disabled

View File

@ -20,4 +20,4 @@ Background:
| Create remotely destructible soulbound tokens for admin permissions |
| Reward individual members with custom tokens for their contribution |
| Mint tokens for use with community and channel permissions |
And "Mint token" button is present
And "Mint token" button is disabled

View File

@ -12,7 +12,7 @@ Control {
property alias title: titleText.text
property alias subtitle: subtitleText.text
property list<StatusButton> buttons
property list<Item> buttons
contentItem: RowLayout {
spacing: 9

View File

@ -13,10 +13,12 @@ StackView {
// id, name, image, color, owner properties expected
required property var communityDetails
required property bool isOwner
// Token models:
required property var assetsModel
required property var collectiblesModel
required property var tokensModel // Community minted tokens model
required property var membersModel
@ -63,6 +65,7 @@ StackView {
objectName: "addNewItemButton"
text: qsTr("New Airdrop")
enabled: root.tokensModel.count > 0 // TODO: Replace to checker to ensure owner token is deployed
onClicked: root.push(newAirdropView, StackView.Immediate)
}
@ -77,6 +80,11 @@ StackView {
qsTr("Incentivise joining, retention, moderation and desired behaviour"),
qsTr("Require holding a token or NFT to obtain exclusive membership rights")
]
infoBoxVisible: root.isOwner && root.tokensModel.count === 0 // TODO: Replace to checker to ensure owner token is NOT deployed yet
infoBoxTitle: qsTr("Get started")
infoBoxText: qsTr("In order to Mint, Import and Airdrop community tokens, you first need to mint your Owner token which will give you permissions to access the token management features for your community.")
buttonText: qsTr("Mint Owner token")
onClicked: root.navigateToMintTokenSettings(false) // TEMP: Replace to mint owner token page
}
}

View File

@ -12,6 +12,8 @@ import AppLayouts.Communities.layouts 1.0
import AppLayouts.Communities.popups 1.0
import AppLayouts.Communities.views 1.0
import shared.controls 1.0
import utils 1.0
import SortFilterProxyModel 0.2
@ -19,7 +21,9 @@ StackView {
id: root
// General properties:
property string communityName
required property bool isOwner
required property bool isAdmin
required property string communityName
property int viewWidth: 560 // by design
// Models:
@ -80,20 +84,25 @@ StackView {
implicitWidth: 0
title: qsTr("Tokens")
buttons: StatusButton {
objectName: "addNewItemButton"
buttons: DisabledTooltipButton {
readonly property bool onlyAdmin: root.isAdmin && !root.isOwner
readonly property bool buttonEnabled: root.isOwner && root.tokensModel.count > 0 /*TODO: Replace last comparison to checker to ensure owner token is deployed*/
buttonType: DisabledTooltipButton.Normal
aliasedObjectName: "addNewItemButton"
text: qsTr("Mint token")
enabled: onlyAdmin || buttonEnabled
interactive: buttonEnabled
onClicked: root.push(newTokenViewComponent, StackView.Immediate)
tooltipText: qsTr("In order to mint, you must Hodl the TokenMaster token for %1").arg(root.communityName)
}
contentItem: MintedTokensView {
model: root.tokensModel
isOwner: root.isOwner
onItemClicked: {
root.push(tokenViewComponent, { tokenKey }, StackView.Immediate)
}
onItemClicked: root.push(tokenViewComponent, { tokenKey }, StackView.Immediate)
onMintOwnerTokenClicked: root.push(newTokenViewComponent, StackView.Immediate) // TEMP: It will navigate to new token owner flow. Now, to current minting flow.
}
}

View File

@ -301,6 +301,8 @@ StatusSectionLayout {
}
communityName: root.community.name
isOwner: root.isOwner
isAdmin: root.isAdmin
tokensModel: root.community.communityTokens
tokensModelWallet: root.rootStore.tokensModelWallet
layer1Networks: communityTokensStore.layer1Networks
@ -358,6 +360,9 @@ StatusSectionLayout {
readonly property bool sectionEnabled: root.isOwner
communityDetails: d.communityDetails
isOwner: root.isOwner
tokensModel: root.community.communityTokens
readonly property CommunityTokensStore communityTokensStore:
rootStore.communityTokensStore

View File

@ -15,6 +15,8 @@ import AppLayouts.Communities.panels 1.0
StatusScrollView {
id: root
required property bool isOwner
property int viewWidth: 560 // by design
property var model
@ -26,6 +28,8 @@ StatusScrollView {
string accountName,
string accountAddress)
signal mintOwnerTokenClicked
padding: 0
QtObject {
@ -77,17 +81,36 @@ StatusScrollView {
Component {
id: introComponent
IntroPanel {
width: root.viewWidth
ColumnLayout {
width: root.viewWidth
spacing: 20
image: Style.png("community/mint2_1")
title: qsTr("Community tokens")
subtitle: qsTr("You can mint custom tokens and import tokens for your community")
checkersModel: [
qsTr("Create remotely destructible soulbound tokens for admin permissions"),
qsTr("Reward individual members with custom tokens for their contribution"),
qsTr("Mint tokens for use with community and channel permissions")
]
IntroPanel {
Layout.fillWidth: true
image: Style.png("community/mint2_1")
title: qsTr("Community tokens")
subtitle: qsTr("You can mint custom tokens and import tokens for your community")
checkersModel: [
qsTr("Create remotely destructible soulbound tokens for admin permissions"),
qsTr("Reward individual members with custom tokens for their contribution"),
qsTr("Mint tokens for use with community and channel permissions")
]
}
StatusInfoBoxPanel {
Layout.fillWidth: true
Layout.bottomMargin: 20
visible: root.isOwner
title: qsTr("Get started")
text: qsTr("In order to Mint, Import and Airdrop community tokens, you first need to mint your Owner token which will give you permissions to access the token management features for your community.")
buttonText: qsTr("Mint Owner token")
horizontalPadding: 16
verticalPadding: 20
onClicked: root.mintOwnerTokenClicked()
}
}
}

View File

@ -1,6 +1,8 @@
import QtQuick 2.15
import QtQuick.Layouts 1.15
import StatusQ.Core 0.1
import StatusQ.Components 0.1
import AppLayouts.Communities.panels 1.0
@ -14,11 +16,38 @@ StatusScrollView {
property alias subtitle: introPanel.subtitle
property alias checkersModel: introPanel.checkersModel
padding: 0
property alias infoBoxVisible: infoBox.visible
property alias infoBoxTitle: infoBox.title
property alias infoBoxText: infoBox.text
property alias buttonText: infoBox.buttonText
IntroPanel {
id: introPanel
signal clicked
padding: 0
contentWidth: mainLayout.width
contentHeight: mainLayout.height
ColumnLayout {
id: mainLayout
width: root.viewWidth
spacing: 20
IntroPanel {
id: introPanel
Layout.fillWidth: true
}
StatusInfoBoxPanel {
id: infoBox
Layout.fillWidth: true
Layout.bottomMargin: 20
horizontalPadding: 16
verticalPadding: 20
onClicked: root.clicked()
}
}
}