feat(TransferOwnershipAlertPopup): Add information popups when owner token is not created yet

It opens information popups when community owner token is still not created:

- From Overview / Transfer ownership button
- From Overview / How to move control node button
- Added support into storybook

Closes #12173
This commit is contained in:
Noelia 2023-09-22 12:12:06 +02:00 committed by Noelia
parent 5bf905b91d
commit 57cfc425fc
6 changed files with 259 additions and 7 deletions

View File

@ -269,5 +269,9 @@
], ],
"UserProfileCard": [ "UserProfileCard": [
"https://www.figma.com/file/Mr3rqxxgKJ2zMQ06UAKiWL/💬-Chat⎜Desktop?type=design&node-id=21961-655678&mode=design&t=JiMnPfMaLPWlrFK3-0" "https://www.figma.com/file/Mr3rqxxgKJ2zMQ06UAKiWL/💬-Chat⎜Desktop?type=design&node-id=21961-655678&mode=design&t=JiMnPfMaLPWlrFK3-0"
],
"TransferOwnershipAlertPopup": [
"https://www.figma.com/file/qHfFm7C9LwtXpfdbxssCK3/Kuba%E2%8E%9CDesktop---Communities?type=design&node-id=37206%3A86828&mode=design&t=coHVo1E6fHrKNNhQ-1",
"https://www.figma.com/file/qHfFm7C9LwtXpfdbxssCK3/Kuba%E2%8E%9CDesktop---Communities?type=design&node-id=37206%3A86847&mode=design&t=coHVo1E6fHrKNNhQ-1"
] ]
} }

View File

@ -0,0 +1,136 @@
import QtQuick 2.14
import QtQuick.Controls 2.14
import QtQuick.Layouts 1.14
import Storybook 1.0
import Models 1.0
import AppLayouts.Communities.popups 1.0
import AppLayouts.Communities.helpers 1.0
SplitView {
Logs { id: logs }
SplitView {
orientation: Qt.Vertical
SplitView.fillWidth: true
Item {
SplitView.fillWidth: true
SplitView.fillHeight: true
PopupBackground {
anchors.fill: parent
}
Button {
anchors.centerIn: parent
text: "Reopen"
onClicked: dialog.open()
}
TransferOwnershipAlertPopup {
id: dialog
anchors.centerIn: parent
communityName: communityNameText.text
communityLogo: ModelsData.collectibles.doodles
onCancelClicked: logs.logEvent("TransferOwnershipAlertPopup::onCancelClicked")
onMintClicked: logs.logEvent("TransferOwnershipAlertPopup::onMintClicked")
}
}
LogsAndControlsPanel {
id: logsAndControlsPanel
SplitView.minimumHeight: 100
SplitView.preferredHeight: 150
logsView.logText: logs.logText
}
}
Pane {
SplitView.minimumWidth: 300
SplitView.preferredWidth: 300
Column {
spacing: 12
Label {
text: "Community Name"
font.bold: true
}
TextInput {
id: communityNameText
text: "Doodles"
}
Label {
text: "Community Logo"
font.bold: true
}
Column {
RadioButton {
id: doodleLogo
text: "Doodle"
checked: true
onCheckedChanged: dialog.communityLogo = ModelsData.collectibles.doodles
}
RadioButton {
id: manaLogo
text: "Mana"
onCheckedChanged: dialog.communityLogo = ModelsData.collectibles.mana
}
RadioButton {
id: superRareLogo
text: "Status"
onCheckedChanged: dialog.communityLogo = ModelsData.collectibles.custom
}
}
Label {
text: "Mode"
font.bold: true
}
Column {
RadioButton {
id: transferMode
text: "Transfer Ownership"
checked: true
onCheckedChanged: dialog.mode = TransferOwnershipAlertPopup.Mode.TransferOwnership
}
RadioButton {
id: moveNodeMode
text: "Move Control Node"
onCheckedChanged: dialog.mode = TransferOwnershipAlertPopup.Mode.MoveControlNode
}
}
}
}
}
// category: Popups

View File

@ -66,6 +66,7 @@ StackLayout {
signal airdropTokensClicked signal airdropTokensClicked
signal exportControlNodeClicked signal exportControlNodeClicked
signal importControlNodeClicked signal importControlNodeClicked
signal mintOwnerTokenClicked
clip: true clip: true
@ -111,15 +112,21 @@ StackLayout {
Layout.preferredHeight: 38 Layout.preferredHeight: 38
Layout.alignment: Qt.AlignTop Layout.alignment: Qt.AlignTop
objectName: "communityOverviewSettingsTransferOwnershipButton" objectName: "communityOverviewSettingsTransferOwnershipButton"
visible: root.isOwner && !!root.ownerToken && root.ownerToken.deployState === Constants.ContractTransactionStatus.Completed visible: root.isOwner
text: qsTr("Transfer ownership") text: qsTr("Transfer ownership")
size: StatusBaseButton.Size.Small size: StatusBaseButton.Size.Small
onClicked: Global.openTransferOwnershipPopup(root.name, onClicked: {
root.logoImageData, if(!!root.ownerToken && root.ownerToken.deployState === Constants.ContractTransactionStatus.Completed) {
root.ownerToken, Global.openTransferOwnershipPopup(root.name,
root.accounts, root.logoImageData,
root.sendModalPopup) root.ownerToken,
root.accounts,
root.sendModalPopup)
} else {
Global.openPopup(transferOwnershipAlertPopup, { mode: TransferOwnershipAlertPopup.Mode.TransferOwnership })
}
}
} }
StatusButton { StatusButton {
@ -174,7 +181,13 @@ StackLayout {
topPadding: 0 topPadding: 0
communityName: root.name communityName: root.name
isControlNode: root.isControlNode isControlNode: root.isControlNode
onExportControlNodeClicked: root.exportControlNodeClicked() onExportControlNodeClicked:{
if(!!root.ownerToken && root.ownerToken.deployState === Constants.ContractTransactionStatus.Completed) {
root.exportControlNodeClicked()
} else {
Global.openPopup(transferOwnershipAlertPopup, { mode: TransferOwnershipAlertPopup.Mode.MoveControlNode })
}
}
onImportControlNodeClicked: root.importControlNodeClicked() onImportControlNodeClicked: root.importControlNodeClicked()
//TODO update once the domain changes //TODO update once the domain changes
onLearnMoreClicked: Global.openLink(Constants.statusHelpLinkPrefix + "status-communities/about-the-control-node-in-status-communities") onLearnMoreClicked: Global.openLink(Constants.statusHelpLinkPrefix + "status-communities/about-the-control-node-in-status-communities")
@ -306,4 +319,15 @@ StackLayout {
} }
} }
} }
Component {
id: transferOwnershipAlertPopup
TransferOwnershipAlertPopup {
communityName: root.name
communityLogo: root.logoImageData
onMintClicked: root.mintOwnerTokenClicked()
}
}
} }

View File

@ -0,0 +1,80 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQml.Models 2.15
import StatusQ.Core 0.1
import StatusQ.Controls 0.1
import StatusQ.Popups.Dialog 0.1
import StatusQ.Components 0.1
import utils 1.0
StatusDialog {
id: root
property int mode: TransferOwnershipAlertPopup.Mode.TransferOwnership
// Community related props:
required property string communityName
required property string communityLogo
signal mintClicked
signal cancelClicked
enum Mode {
TransferOwnership,
MoveControlNode
}
QtObject {
id: d
readonly property string headerTitle: (root.mode === TransferOwnershipAlertPopup.Mode.TransferOwnership) ?
qsTr("Transfer ownership of %1").arg(root.communityName) :
qsTr("How to move the %1 control node to another device").arg(root.communityName)
readonly property string alertText: (root.mode === TransferOwnershipAlertPopup.Mode.TransferOwnership) ?
qsTr("<b>It looks like you havent minted the %1 Owner token yet.</b> Once you have minted this token, you can transfer ownership of %1 by sending the Owner token to the account of the person you want to be the new Community owner.").arg(root.communityName) :
qsTr("<b>It looks like you havent minted the %1 Owner token yet.</b> Once you have minted this token, you can make one of your other synced desktop devices the control node for the %1 Community.").arg(root.communityName)
}
width: 640 // by design
padding: Style.current.padding
contentItem: StatusBaseText {
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
text: d.alertText
lineHeight: 1.2
}
header: StatusDialogHeader {
headline.title: d.headerTitle
actions.closeButton.onClicked: root.close()
leftComponent: StatusSmartIdenticon {
asset.name: root.communityLogo
asset.isImage: !!asset.name
}
}
footer: StatusDialogFooter {
spacing: Style.current.padding
rightButtons: ObjectModel {
StatusFlatButton {
text: qsTr("Cancel")
onClicked: {
root.cancelClicked()
close()
}
}
StatusButton {
text: qsTr("Mint %1 Owner token").arg(root.communityName)
type: StatusBaseButton.Type.Normal
onClicked: {
root.mintClicked()
close()
}
}
}
}
}

View File

@ -20,3 +20,4 @@ SignTransactionsPopup 1.0 SignTransactionsPopup.qml
TokenMasterActionPopup 1.0 TokenMasterActionPopup.qml TokenMasterActionPopup 1.0 TokenMasterActionPopup.qml
TokenPermissionsPopup 1.0 TokenPermissionsPopup.qml TokenPermissionsPopup 1.0 TokenPermissionsPopup.qml
TransferOwnershipPopup 1.0 TransferOwnershipPopup.qml TransferOwnershipPopup 1.0 TransferOwnershipPopup.qml
TransferOwnershipAlertPopup 1.0 TransferOwnershipAlertPopup.qml

View File

@ -233,6 +233,12 @@ StatusSectionLayout {
Global.openImportControlNodePopup(root.community) Global.openImportControlNodePopup(root.community)
} }
onMintOwnerTokenClicked: {
root.goTo(Constants.CommunitySettingsSections.MintTokens)
mintPanel.openNewTokenForm(false/*Collectible owner token*/)
}
} }
MembersSettingsPanel { MembersSettingsPanel {
@ -322,6 +328,7 @@ StatusSectionLayout {
isOwnerTokenDeployed: tokensModelChangesTracker.isOwnerTokenDeployed isOwnerTokenDeployed: tokensModelChangesTracker.isOwnerTokenDeployed
isTMasterTokenDeployed: tokensModelChangesTracker.isTMasterTokenDeployed isTMasterTokenDeployed: tokensModelChangesTracker.isTMasterTokenDeployed
anyPrivilegedTokenFailed: tokensModelChangesTracker.isOwnerTokenFailed || tokensModelChangesTracker.isTMasterTokenFailed anyPrivilegedTokenFailed: tokensModelChangesTracker.isOwnerTokenFailed || tokensModelChangesTracker.isTMasterTokenFailed
ownerOrTMasterTokenItemsExist: tokensModelChangesTracker.ownerOrTMasterTokenItemsExist
// Models // Models
tokensModel: root.community.communityTokens tokensModel: root.community.communityTokens