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" title: "CommunityIntroDialog"
section: "Popups" section: "Popups"
} }
ListElement {
title: "CommunityTokenPermissionsPopup"
section: "Popups"
}
ListElement { ListElement {
title: "MembersSelector" title: "MembersSelector"
section: "Components" 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 { ColumnLayout {
id: root id: root
property bool isOnlyChannelPanelEditor: false
property string channelName: "#vip" property string channelName: "#vip"
property bool joinCommunity: true // Otherwise, enter channel property bool joinCommunity: true // Otherwise, enter channel
property bool requirementsMet: true property bool requirementsMet: true
property bool isInvitationPending: false property bool isInvitationPending: false
property bool isJoinRequestRejected: false property bool isJoinRequestRejected: false
property bool requiresRequest: false property bool requiresRequest: false
property var communityHoldings: PermissionsModel.shortPermissionsModel property var communityHoldingsModel: PermissionsModel.shortPermissionsModel
property var viewOnlyHoldings: PermissionsModel.shortPermissionsModel property var viewOnlyHoldingsModel: PermissionsModel.shortPermissionsModel
property var viewAndPostHoldings: PermissionsModel.shortPermissionsModel property var viewAndPostHoldingsModel: PermissionsModel.shortPermissionsModel
property var moderateHoldings: PermissionsModel.shortPermissionsModel property var moderateHoldingsModel: PermissionsModel.shortPermissionsModel
spacing: 16 spacing: 16
ColumnLayout { ColumnLayout {
visible: !isOnlyChannelPanelEditor
Label { Label {
Layout.fillWidth: true Layout.fillWidth: true
text: "View type:" text: "View type:"
@ -33,6 +35,7 @@ ColumnLayout {
text: "Join community" text: "Join community"
onCheckedChanged: if(checked) d.joinCommunity = true onCheckedChanged: if(checked) d.joinCommunity = true
} }
RadioButton { RadioButton {
text: "Enter channel" text: "Enter channel"
onCheckedChanged: if(checked) d.joinCommunity = false onCheckedChanged: if(checked) d.joinCommunity = false
@ -40,6 +43,7 @@ ColumnLayout {
} }
ColumnLayout { ColumnLayout {
visible: !isOnlyChannelPanelEditor
Label { Label {
Layout.fillWidth: true Layout.fillWidth: true
text: "Requirements met:" text: "Requirements met:"
@ -52,6 +56,7 @@ ColumnLayout {
} }
ColumnLayout { ColumnLayout {
visible: !isOnlyChannelPanelEditor
Label { Label {
Layout.fillWidth: true Layout.fillWidth: true
text: "Request pending:" text: "Request pending:"
@ -64,6 +69,7 @@ ColumnLayout {
} }
ColumnLayout { ColumnLayout {
visible: !isOnlyChannelPanelEditor
Label { Label {
Layout.fillWidth: true Layout.fillWidth: true
text: "Request rejected:" text: "Request rejected:"
@ -76,7 +82,7 @@ ColumnLayout {
} }
ColumnLayout { ColumnLayout {
visible: root.joinCommunity visible: !isOnlyChannelPanelEditor && root.joinCommunity
Label { Label {
Layout.fillWidth: true Layout.fillWidth: true
text: "Requires request:" text: "Requires request:"
@ -98,12 +104,12 @@ ColumnLayout {
RadioButton { RadioButton {
checked: true checked: true
text: "Short model" text: "Short model"
onCheckedChanged: if(checked) root.communityHoldings = PermissionsModel.shortPermissionsModel onCheckedChanged: if(checked) root.communityHoldingsModel = PermissionsModel.shortPermissionsModel
} }
RadioButton { RadioButton {
text: "Long model" text: "Long model"
onCheckedChanged: if(checked) root.communityHoldings = PermissionsModel.longPermissionsModel onCheckedChanged: if(checked) root.communityHoldingsModel = PermissionsModel.longPermissionsModel
} }
} }
@ -134,17 +140,17 @@ ColumnLayout {
RadioButton { RadioButton {
checked: true checked: true
text: "Short model" text: "Short model"
onCheckedChanged: if(checked) root.viewOnlyHoldings = PermissionsModel.shortPermissionsModel onCheckedChanged: if(checked) root.viewOnlyHoldingsModel = PermissionsModel.shortPermissionsModel
} }
RadioButton { RadioButton {
text: "Long model" text: "Long model"
onCheckedChanged: if(checked) root.viewOnlyHoldings = PermissionsModel.longPermissionsModel onCheckedChanged: if(checked) root.viewOnlyHoldingsModel = PermissionsModel.longPermissionsModel
} }
RadioButton { RadioButton {
text: "None" text: "None"
onCheckedChanged: if(checked) root.viewOnlyHoldings = undefined onCheckedChanged: if(checked) root.viewOnlyHoldingsModel = undefined
} }
} }
@ -159,17 +165,17 @@ ColumnLayout {
RadioButton { RadioButton {
checked: true checked: true
text: "Short model" text: "Short model"
onCheckedChanged: if(checked) root.viewAndPostHoldings = PermissionsModel.shortPermissionsModel onCheckedChanged: if(checked) root.viewAndPostHoldingsModel = PermissionsModel.shortPermissionsModel
} }
RadioButton { RadioButton {
text: "Long model" text: "Long model"
onCheckedChanged: if(checked) root.viewAndPostHoldings = PermissionsModel.longPermissionsModel onCheckedChanged: if(checked) root.viewAndPostHoldingsModel = PermissionsModel.longPermissionsModel
} }
RadioButton { RadioButton {
text: "None" text: "None"
onCheckedChanged: if(checked) root.viewAndPostHoldings = undefined onCheckedChanged: if(checked) root.viewAndPostHoldingsModel = undefined
} }
} }
@ -184,17 +190,17 @@ ColumnLayout {
RadioButton { RadioButton {
checked: true checked: true
text: "Short model" text: "Short model"
onCheckedChanged: if(checked) root.moderateHoldings = PermissionsModel.shortPermissionsModel onCheckedChanged: if(checked) root.moderateHoldingsModel = PermissionsModel.shortPermissionsModel
} }
RadioButton { RadioButton {
text: "Long model" text: "Long model"
onCheckedChanged: if(checked) root.moderateHoldings = PermissionsModel.longPermissionsModel onCheckedChanged: if(checked) root.moderateHoldingsModel = PermissionsModel.longPermissionsModel
} }
RadioButton { RadioButton {
text: "None" 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 isInvitationPending: true
property bool isJoinRequestRejected: false property bool isJoinRequestRejected: false
property bool requiresRequest: false property bool requiresRequest: false
property var communityHoldings: PermissionsModel.shortPermissionsModel property var communityHoldingsModel: PermissionsModel.shortPermissionsModel
property var viewOnlyHoldings: PermissionsModel.shortPermissionsModel property var viewOnlyHoldingsModel: PermissionsModel.shortPermissionsModel
property var viewAndPostHoldings: PermissionsModel.shortPermissionsModel property var viewAndPostHoldingsModel: PermissionsModel.shortPermissionsModel
property var moderateHoldings: PermissionsModel.shortPermissionsModel property var moderateHoldingsModel: PermissionsModel.shortPermissionsModel
// Blur background: // Blur background:
property int membersCount: 184 property int membersCount: 184
@ -128,10 +128,10 @@ Nemo enim 😋 ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit,
requirementsMet: d.requirementsMet requirementsMet: d.requirementsMet
isJoinRequestRejected: d.isJoinRequestRejected isJoinRequestRejected: d.isJoinRequestRejected
requiresRequest: d.requiresRequest requiresRequest: d.requiresRequest
communityHoldings: d.communityHoldings communityHoldingsModel: d.communityHoldingsModel
viewOnlyHoldings: d.viewOnlyHoldings viewOnlyHoldingsModel: d.viewOnlyHoldingsModel
viewAndPostHoldings: d.viewAndPostHoldings viewAndPostHoldingsModel: d.viewAndPostHoldingsModel
moderateHoldings: d.moderateHoldings moderateHoldingsModel: d.moderateHoldingsModel
onInfoButtonClicked: logs.logEvent("JoinCommunityView::onInfoButtonClicked()") onInfoButtonClicked: logs.logEvent("JoinCommunityView::onInfoButtonClicked()")
onAdHocChatButtonClicked: { onAdHocChatButtonClicked: {
@ -269,10 +269,10 @@ Nemo enim 😋 ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit,
onIsInvitationPendingChanged: d.isInvitationPending = isInvitationPending onIsInvitationPendingChanged: d.isInvitationPending = isInvitationPending
onIsJoinRequestRejectedChanged: d.isJoinRequestRejected = isJoinRequestRejected onIsJoinRequestRejectedChanged: d.isJoinRequestRejected = isJoinRequestRejected
onRequiresRequestChanged: d.requiresRequest = requiresRequest onRequiresRequestChanged: d.requiresRequest = requiresRequest
onCommunityHoldingsChanged: d.communityHoldings = communityHoldings onCommunityHoldingsModelChanged: d.communityHoldingsModel = communityHoldingsModel
onViewOnlyHoldingsChanged: d.viewOnlyHoldings = viewOnlyHoldings onViewOnlyHoldingsModelChanged: d.viewOnlyHoldingsModel = viewOnlyHoldingsModel
onViewAndPostHoldingsChanged: d.viewAndPostHoldings = viewAndPostHoldings onViewAndPostHoldingsModelChanged: d.viewAndPostHoldingsModel = viewAndPostHoldingsModel
onModerateHoldingsChanged: d.moderateHoldings = moderateHoldings onModerateHoldingsModelChanged: d.moderateHoldingsModel = moderateHoldingsModel
} }
} }
} }

View File

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

View File

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

View File

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

View File

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