feat(OwnerToken): Admin view of Airdrops home - pre-Owner token minting

- New `Get started` panel for admins in `Airdrops` section added.
- Added support in `storybook`.

Closes #11472
This commit is contained in:
Noelia 2023-07-13 17:51:53 +02:00 committed by Noelia
parent c973605831
commit f3af979edf
4 changed files with 33 additions and 7 deletions

View File

@ -91,6 +91,8 @@ SplitView {
anchors.fill: parent
anchors.topMargin: 50
isOwner: ownerChecked.checked
isTokenMasterOwner: masterTokenOwnerChecked.checked
isAdmin: adminChecked.checked
tokensModel: editorModelChecked.checked ? emptyModel : mintedTokensModel
assetsModel: AssetsModel {}
collectiblesModel: ListModel {}
@ -199,7 +201,7 @@ SplitView {
id: logsAndControlsPanel
SplitView.minimumHeight: 100
SplitView.preferredHeight: 150
SplitView.preferredHeight: 250
logsView.logText: logs.logText
@ -208,14 +210,28 @@ SplitView {
id: ownerChecked
checked: true
text: "Is owner?"
text: "Is Owner? [Owner will be able to create an OWNER and TOKEN MASTER token]"
}
CheckBox {
id: masterTokenOwnerChecked
checked: true
text: "Is TMaster token owner? [TMaster token owner will be able to mint / airdrop tokens once the TMaster is already created]"
}
CheckBox {
id: adminChecked
checked: true
text: "Is admin? [Admis will be able to see token views, but NOT manage them, like creating new artwork or asset]"
}
CheckBox {
id: editorModelChecked
checked: true
text: "Empty model"
text: "No tokens minted yet"
}
}
}

View File

@ -14,6 +14,8 @@ StackView {
// id, name, image, color, owner properties expected
required property var communityDetails
required property bool isOwner
required property bool isTokenMasterOwner
required property bool isAdmin
// Token models:
required property var assetsModel
@ -53,6 +55,8 @@ StackView {
QtObject {
id: d
readonly property bool isAdminOnly: root.isAdmin && !root.isOwner && !root.isTokenMasterOwner
signal selectToken(string key, int amount, int type)
signal addAddresses(var addresses)
}
@ -62,10 +66,11 @@ StackView {
title: qsTr("Airdrops")
buttons: StatusButton {
objectName: "addNewItemButton"
text: qsTr("New Airdrop")
enabled: root.tokensModel.count > 0 // TODO: Replace to checker to ensure owner token is deployed
enabled: !d.isAdminOnly && root.tokensModel.count > 0 // TODO: Replace to checker to ensure owner token is deployed
onClicked: root.push(newAirdropView, StackView.Immediate)
}
@ -80,11 +85,13 @@ 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
infoBoxVisible: d.isAdminOnly || ((root.isOwner || root.isTokenMasterOwner) && 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.")
infoBoxText: d.isAdminOnly ? qsTr("Token airdropping can only be performed by admins that hodl the Communitys TokenMaster token. If you would like this permission, contact the Community founder (they will need to mint the Community Owner token before they can airdrop this to you)."):
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
buttonVisible: root.isOwner
onClicked: root.navigateToMintTokenSettings(false)
}
}

View File

@ -364,6 +364,8 @@ StatusSectionLayout {
communityDetails: d.communityDetails
isOwner: root.isOwner
isTokenMasterOwner: false // TODO: Backend
isAdmin: root.isAdmin
tokensModel: root.community.communityTokens
readonly property CommunityTokensStore communityTokensStore:

View File

@ -20,6 +20,7 @@ StatusScrollView {
property alias infoBoxTitle: infoBox.title
property alias infoBoxText: infoBox.text
property alias buttonText: infoBox.buttonText
property alias buttonVisible: infoBox.buttonVisible
signal clicked