feat(TokensPermissionsPoupup): Created new popup

- Created new dialog.
- Created storybook page for that.
- Model properties renames.

Closes #9433
This commit is contained in:
Noelia 2023-02-14 17:33:23 +01:00 committed by Alexandra Betouni
parent a4bce9e130
commit fe5abb60da
10 changed files with 188 additions and 63 deletions

View File

@ -93,6 +93,10 @@ ListModel {
title: "CommunityIntroDialog"
section: "Popups"
}
ListElement {
title: "CommunityTokenPermissionsPopup"
section: "Popups"
}
ListElement {
title: "MembersSelector"
section: "Components"

View File

@ -0,0 +1,56 @@
import QtQuick 2.14
import QtQuick.Controls 2.14
import QtQuick.Layouts 1.14
import Storybook 1.0
import Models 1.0
import AppLayouts.Chat.popups.community 1.0
SplitView {
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()
}
CommunityTokenPermissionsPopup {
id: dialog
anchors.centerIn: parent
channelName: editor.channelName
viewOnlyHoldingsModel: editor.viewOnlyHoldingsModel
viewAndPostHoldingsModel: editor.viewAndPostHoldingsModel
moderateHoldingsModel: editor.moderateHoldingsModel
}
}
}
Pane {
SplitView.minimumWidth: 300
SplitView.preferredWidth: 300
JoinCommunityPermissionsEditor {
id: editor
isOnlyChannelPanelEditor: true
channelName: "#vip"
joinCommunity: false
}
}
}

View File

@ -9,20 +9,22 @@ import utils 1.0
ColumnLayout {
id: root
property bool isOnlyChannelPanelEditor: false
property string channelName: "#vip"
property bool joinCommunity: true // Otherwise, enter channel
property bool requirementsMet: true
property bool isInvitationPending: false
property bool isJoinRequestRejected: false
property bool requiresRequest: false
property var communityHoldings: PermissionsModel.shortPermissionsModel
property var viewOnlyHoldings: PermissionsModel.shortPermissionsModel
property var viewAndPostHoldings: PermissionsModel.shortPermissionsModel
property var moderateHoldings: PermissionsModel.shortPermissionsModel
property var communityHoldingsModel: PermissionsModel.shortPermissionsModel
property var viewOnlyHoldingsModel: PermissionsModel.shortPermissionsModel
property var viewAndPostHoldingsModel: PermissionsModel.shortPermissionsModel
property var moderateHoldingsModel: PermissionsModel.shortPermissionsModel
spacing: 16
ColumnLayout {
visible: !isOnlyChannelPanelEditor
Label {
Layout.fillWidth: true
text: "View type:"
@ -33,6 +35,7 @@ ColumnLayout {
text: "Join community"
onCheckedChanged: if(checked) d.joinCommunity = true
}
RadioButton {
text: "Enter channel"
onCheckedChanged: if(checked) d.joinCommunity = false
@ -40,6 +43,7 @@ ColumnLayout {
}
ColumnLayout {
visible: !isOnlyChannelPanelEditor
Label {
Layout.fillWidth: true
text: "Requirements met:"
@ -52,6 +56,7 @@ ColumnLayout {
}
ColumnLayout {
visible: !isOnlyChannelPanelEditor
Label {
Layout.fillWidth: true
text: "Request pending:"
@ -64,6 +69,7 @@ ColumnLayout {
}
ColumnLayout {
visible: !isOnlyChannelPanelEditor
Label {
Layout.fillWidth: true
text: "Request rejected:"
@ -76,7 +82,7 @@ ColumnLayout {
}
ColumnLayout {
visible: root.joinCommunity
visible: !isOnlyChannelPanelEditor && root.joinCommunity
Label {
Layout.fillWidth: true
text: "Requires request:"
@ -98,12 +104,12 @@ ColumnLayout {
RadioButton {
checked: true
text: "Short model"
onCheckedChanged: if(checked) root.communityHoldings = PermissionsModel.shortPermissionsModel
onCheckedChanged: if(checked) root.communityHoldingsModel = PermissionsModel.shortPermissionsModel
}
RadioButton {
text: "Long model"
onCheckedChanged: if(checked) root.communityHoldings = PermissionsModel.longPermissionsModel
onCheckedChanged: if(checked) root.communityHoldingsModel = PermissionsModel.longPermissionsModel
}
}
@ -134,17 +140,17 @@ ColumnLayout {
RadioButton {
checked: true
text: "Short model"
onCheckedChanged: if(checked) root.viewOnlyHoldings = PermissionsModel.shortPermissionsModel
onCheckedChanged: if(checked) root.viewOnlyHoldingsModel = PermissionsModel.shortPermissionsModel
}
RadioButton {
text: "Long model"
onCheckedChanged: if(checked) root.viewOnlyHoldings = PermissionsModel.longPermissionsModel
onCheckedChanged: if(checked) root.viewOnlyHoldingsModel = PermissionsModel.longPermissionsModel
}
RadioButton {
text: "None"
onCheckedChanged: if(checked) root.viewOnlyHoldings = undefined
onCheckedChanged: if(checked) root.viewOnlyHoldingsModel = undefined
}
}
@ -159,17 +165,17 @@ ColumnLayout {
RadioButton {
checked: true
text: "Short model"
onCheckedChanged: if(checked) root.viewAndPostHoldings = PermissionsModel.shortPermissionsModel
onCheckedChanged: if(checked) root.viewAndPostHoldingsModel = PermissionsModel.shortPermissionsModel
}
RadioButton {
text: "Long model"
onCheckedChanged: if(checked) root.viewAndPostHoldings = PermissionsModel.longPermissionsModel
onCheckedChanged: if(checked) root.viewAndPostHoldingsModel = PermissionsModel.longPermissionsModel
}
RadioButton {
text: "None"
onCheckedChanged: if(checked) root.viewAndPostHoldings = undefined
onCheckedChanged: if(checked) root.viewAndPostHoldingsModel = undefined
}
}
@ -184,17 +190,17 @@ ColumnLayout {
RadioButton {
checked: true
text: "Short model"
onCheckedChanged: if(checked) root.moderateHoldings = PermissionsModel.shortPermissionsModel
onCheckedChanged: if(checked) root.moderateHoldingsModel = PermissionsModel.shortPermissionsModel
}
RadioButton {
text: "Long model"
onCheckedChanged: if(checked) root.moderateHoldings = PermissionsModel.longPermissionsModel
onCheckedChanged: if(checked) root.moderateHoldingsModel = PermissionsModel.longPermissionsModel
}
RadioButton {
text: "None"
onCheckedChanged: if(checked) root.moderateHoldings = undefined
onCheckedChanged: if(checked) root.moderateHoldingsModel = undefined
}
}
}

View File

@ -41,10 +41,10 @@ Nemo enim 😋 ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit,
property bool isInvitationPending: true
property bool isJoinRequestRejected: false
property bool requiresRequest: false
property var communityHoldings: PermissionsModel.shortPermissionsModel
property var viewOnlyHoldings: PermissionsModel.shortPermissionsModel
property var viewAndPostHoldings: PermissionsModel.shortPermissionsModel
property var moderateHoldings: PermissionsModel.shortPermissionsModel
property var communityHoldingsModel: PermissionsModel.shortPermissionsModel
property var viewOnlyHoldingsModel: PermissionsModel.shortPermissionsModel
property var viewAndPostHoldingsModel: PermissionsModel.shortPermissionsModel
property var moderateHoldingsModel: PermissionsModel.shortPermissionsModel
// Blur background:
property int membersCount: 184
@ -128,10 +128,10 @@ Nemo enim 😋 ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit,
requirementsMet: d.requirementsMet
isJoinRequestRejected: d.isJoinRequestRejected
requiresRequest: d.requiresRequest
communityHoldings: d.communityHoldings
viewOnlyHoldings: d.viewOnlyHoldings
viewAndPostHoldings: d.viewAndPostHoldings
moderateHoldings: d.moderateHoldings
communityHoldingsModel: d.communityHoldingsModel
viewOnlyHoldingsModel: d.viewOnlyHoldingsModel
viewAndPostHoldingsModel: d.viewAndPostHoldingsModel
moderateHoldingsModel: d.moderateHoldingsModel
onInfoButtonClicked: logs.logEvent("JoinCommunityView::onInfoButtonClicked()")
onAdHocChatButtonClicked: {
@ -269,10 +269,10 @@ Nemo enim 😋 ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit,
onIsInvitationPendingChanged: d.isInvitationPending = isInvitationPending
onIsJoinRequestRejectedChanged: d.isJoinRequestRejected = isJoinRequestRejected
onRequiresRequestChanged: d.requiresRequest = requiresRequest
onCommunityHoldingsChanged: d.communityHoldings = communityHoldings
onViewOnlyHoldingsChanged: d.viewOnlyHoldings = viewOnlyHoldings
onViewAndPostHoldingsChanged: d.viewAndPostHoldings = viewAndPostHoldings
onModerateHoldingsChanged: d.moderateHoldings = moderateHoldings
onCommunityHoldingsModelChanged: d.communityHoldingsModel = communityHoldingsModel
onViewOnlyHoldingsModelChanged: d.viewOnlyHoldingsModel = viewOnlyHoldingsModel
onViewAndPostHoldingsModelChanged: d.viewAndPostHoldingsModel = viewAndPostHoldingsModel
onModerateHoldingsModelChanged: d.moderateHoldingsModel = moderateHoldingsModel
}
}
}

View File

@ -25,10 +25,10 @@ SplitView {
property bool isInvitationPending: false
property bool isJoinRequestRejected: false
property bool requiresRequest: false
property var communityHoldings: PermissionsModel.shortPermissionsModel
property var viewOnlyHoldings: PermissionsModel.shortPermissionsModel
property var viewAndPostHoldings: PermissionsModel.shortPermissionsModel
property var moderateHoldings: PermissionsModel.shortPermissionsModel
property var communityHoldingsModel: PermissionsModel.shortPermissionsModel
property var viewOnlyHoldingsModel: PermissionsModel.shortPermissionsModel
property var viewAndPostHoldingsModel: PermissionsModel.shortPermissionsModel
property var moderateHoldingsModel: PermissionsModel.shortPermissionsModel
}
Logs { id: logs }
@ -74,11 +74,11 @@ SplitView {
isJoinRequestRejected: d.isJoinRequestRejected
requiresRequest: d.requiresRequest
communityName: d.name
communityHoldings: d.communityHoldings
communityHoldingsModel: d.communityHoldingsModel
channelName: d.channelName
viewOnlyHoldings: d.viewOnlyHoldings
viewAndPostHoldings: d.viewAndPostHoldings
moderateHoldings: d.moderateHoldings
viewOnlyHoldingsModel: d.viewOnlyHoldingsModel
viewAndPostHoldingsModel: d.viewAndPostHoldingsModel
moderateHoldingsModel: d.moderateHoldingsModel
onRevealAddressClicked: logs.logEvent("JoinPermissionsOverlayPanel::onRevealAddressClicked()")
onInvitationPendingClicked: logs.logEvent("JoinPermissionsOverlayPanel::onInvitationPendingClicked()")
@ -157,10 +157,10 @@ SplitView {
onIsInvitationPendingChanged: d.isInvitationPending = isInvitationPending
onIsJoinRequestRejectedChanged: d.isJoinRequestRejected = isJoinRequestRejected
onRequiresRequestChanged: d.requiresRequest = requiresRequest
onCommunityHoldingsChanged: d.communityHoldings = communityHoldings
onViewOnlyHoldingsChanged: d.viewOnlyHoldings = viewOnlyHoldings
onViewAndPostHoldingsChanged: d.viewAndPostHoldings = viewAndPostHoldings
onModerateHoldingsChanged: d.moderateHoldings = moderateHoldings
onCommunityHoldingsModelChanged: d.communityHoldingsModel = communityHoldingsModel
onViewOnlyHoldingsModelChanged: d.viewOnlyHoldingsModel = viewOnlyHoldingsModel
onViewAndPostHoldingsModelChanged: d.viewAndPostHoldingsModel = viewAndPostHoldingsModel
onModerateHoldingsModelChanged: d.moderateHoldingsModel = moderateHoldingsModel
}
}
}

View File

@ -22,11 +22,12 @@ Control {
property bool isInvitationPending: false
property bool isJoinRequestRejected: false
property string communityName
property var communityHoldings
property var communityHoldingsModel
property string channelName
property var viewOnlyHoldings
property var viewAndPostHoldings
property var moderateHoldings
property var viewOnlyHoldingsModel
property var viewAndPostHoldingsModel
property var moderateHoldingsModel
property bool showOnlyPanels: false
signal revealAddressClicked
signal invitationPendingClicked
@ -65,38 +66,38 @@ Control {
HoldingsListPanel {
Layout.fillWidth: true
spacing: root.spacing
visible: root.joinCommunity && root.communityHoldings
visible: root.joinCommunity && root.communityHoldingsModel
introText: qsTr("To join <b>%1</b> you need to prove that you hold").arg(root.communityName)
model: root.communityHoldings
model: root.communityHoldingsModel
}
HoldingsListPanel {
Layout.fillWidth: true
spacing: root.spacing
visible: !root.joinCommunity && !!root.viewOnlyHoldings
visible: !root.joinCommunity && !!root.viewOnlyHoldingsModel
introText: qsTr("To only view the <b>%1</b> channel you need to hold").arg(root.channelName)
model: root.viewOnlyHoldings
model: root.viewOnlyHoldingsModel
}
HoldingsListPanel {
Layout.fillWidth: true
spacing: root.spacing
visible: !root.joinCommunity && !!root.viewAndPostHoldings
visible: !root.joinCommunity && !!root.viewAndPostHoldingsModel
introText: qsTr("To view and post in the <b>%1</b> channel you need to hold").arg(root.channelName)
model: root.viewAndPostHoldings
model: root.viewAndPostHoldingsModel
}
HoldingsListPanel {
Layout.fillWidth: true
spacing: root.spacing
visible: !root.joinCommunity && !!root.moderateHoldings
visible: !root.joinCommunity && !!root.moderateHoldingsModel
introText: qsTr("To moderate in the <b>%1</b> channel you need to hold").arg(root.channelName)
model: root.moderateHoldings
model: root.moderateHoldingsModel
}
StatusButton {
Layout.alignment: Qt.AlignHCenter
visible: !root.isJoinRequestRejected
visible: !root.showOnlyPanels && !root.isJoinRequestRejected
text: root.isInvitationPending ? d.getInvitationPendingText() : d.getRevealAddressText()
font.pixelSize: 13
enabled: root.requirementsMet
@ -105,7 +106,7 @@ Control {
StatusBaseText {
Layout.alignment: Qt.AlignHCenter
visible: root.isJoinRequestRejected || !root.requirementsMet
visible: !root.showOnlyPanels && (root.isJoinRequestRejected || !root.requirementsMet)
text: root.isJoinRequestRejected ? d.memberchipRequestRejectedText :
(root.joinCommunity ? d.communityRequirementsNotMetText : d.channelRequirementsNotMetText)
color: Theme.palette.dangerColor1

View File

@ -0,0 +1,57 @@
import QtQuick 2.14
import QtQuick.Controls 2.14
import StatusQ.Core 0.1
import StatusQ.Popups.Dialog 0.1
import AppLayouts.Chat.panels.communities 1.0
StatusDialog {
id: root
property string channelName
property alias viewOnlyHoldingsModel: overlayPanel.viewOnlyHoldingsModel
property alias viewAndPostHoldingsModel: overlayPanel.viewAndPostHoldingsModel
property alias moderateHoldingsModel: overlayPanel.moderateHoldingsModel
QtObject {
id: d
readonly property int maxWidth: 640
readonly property int minWidth: 300
readonly property int maxHeight: 480
function getVerticalPadding() {
return root.topPadding + root.bottomPadding
}
function getHorizontalPadding() {
return root.leftPadding + root.rightPadding
}
function getMaxMinWidth() {
return Math.max(overlayPanel.implicitWidth, d.minWidth)
}
}
title: qsTr("Token permissions for %1 channel").arg(root.channelName)
footer.visible: false
implicitWidth: Math.min(d.getMaxMinWidth(), d.maxWidth) + d.getHorizontalPadding()
implicitHeight: Math.min(overlayPanel.implicitHeight + d.getVerticalPadding() + root.header.height, d.maxHeight)
contentItem: StatusScrollView {
ScrollBar.vertical.policy: ScrollBar.AsNeeded
ScrollBar.horizontal.policy: ScrollBar.AsNeeded
contentHeight: overlayPanel.implicitHeight
contentWidth: overlayPanel.implicitWidth
padding: 0
JoinPermissionsOverlayPanel {
id: overlayPanel
anchors.centerIn: parent
joinCommunity: false
channelName: root.channelName
showOnlyPanels: true
}
}
}

View File

@ -1 +1,2 @@
CreateChannelPopup 1.0 CreateChannelPopup.qml
CommunityTokenPermissionsPopup 1.0 CommunityTokenPermissionsPopup.qml

View File

@ -209,7 +209,7 @@ QtObject {
//MINTING
property var mintTokensModel: mintingModuleInst.tokensModel
property var mintTokensModel: !!mintingModuleInst ? mintingModuleInst.tokensModel : null
function mintCollectible(address, name, symbol, description, supply,
infiniteSupply, transferable, selfDestruct, network)

View File

@ -36,10 +36,10 @@ StatusSectionLayout {
property bool requirementsMet: true
property bool isJoinRequestRejected: false
property bool requiresRequest: false
property var communityHoldings
property var viewOnlyHoldings
property var viewAndPostHoldings
property var moderateHoldings
property var communityHoldingsModel
property var viewOnlyHoldingsModel
property var viewAndPostHoldingsModel
property var moderateHoldingsModel
// Blur view properties:
property int membersCount
@ -269,11 +269,11 @@ StatusSectionLayout {
isJoinRequestRejected: root.isJoinRequestRejected
requiresRequest: root.requiresRequest
communityName: root.name
communityHoldings: root.communityHoldings
communityHoldingsModel: root.communityHoldingsModel
channelName: root.channelName
viewOnlyHoldings: root.viewOnlyHoldings
viewAndPostHoldings: root.viewAndPostHoldings
moderateHoldings: root.moderateHoldings
viewOnlyHoldingsModel: root.viewOnlyHoldingsModel
viewAndPostHoldingsModel: root.viewAndPostHoldingsModel
moderateHoldingsModel: root.moderateHoldingsModel
onRevealAddressClicked: root.revealAddressClicked()
onInvitationPendingClicked: root.invitationPendingClicked()