status-desktop/ui/app/AppLayouts/Chat/popups/community/CommunityProfilePopup.qml

123 lines
3.9 KiB
QML
Raw Normal View History

2020-12-15 16:04:19 +00:00
import QtQuick 2.12
import QtQuick.Controls 2.12
import StatusQ.Controls 0.1
import StatusQ.Popups 0.1
import utils 1.0
2020-12-15 16:04:19 +00:00
import "../../panels/communities"
StatusModal {
id: root
property var store
property var community
property var contactsStore
property bool hasAddedContacts
property var communitySectionModule
onClosed: {
while (contentItem.depth > 1) {
contentItem.pop()
}
}
header.title: contentItem.currentItem.headerTitle
header.subTitle: contentItem.currentItem.headerSubtitle || ""
header.asset.name: contentItem.currentItem.headerImageSource || ""
header.asset.isImage: !!contentItem.currentItem.headerImageSource
header.asset.isLetterIdenticon: contentItem.currentItem.headerTitle === root.community.name && !contentItem.currentItem.headerImageSource
header.asset.bgColor: root.community.color
contentItem: StackView {
id: stack
initialItem: profileOverview
width: root.width
implicitHeight: currentItem.implicitHeight || currentItem.height
2020-12-16 18:56:48 +00:00
pushEnter: Transition { enabled: false }
pushExit: Transition { enabled: false }
popEnter: Transition { enabled: false }
popExit: Transition { enabled: false }
2020-12-18 20:15:00 +00:00
Component {
id: profileOverview
CommunityProfilePopupOverviewPanel {
width: stack.width
headerTitle: root.community.name
headerSubtitle: {
switch(root.community.access) {
case Constants.communityChatPublicAccess: return qsTr("Public community");
case Constants.communityChatInvitationOnlyAccess: return qsTr("Invitation only community");
case Constants.communityChatOnRequestAccess: return qsTr("On request community");
default: return qsTr("Unknown community");
2020-12-17 13:24:33 +00:00
}
}
headerImageSource: root.community.image
community: root.community
onTransferOwnershipButtonClicked: Global.openPopup(transferOwnershiproot, {
privateKey: communitySectionModule.exportCommunity(root.community.id),
store: root.store
})
onLeaveButtonClicked: {
communitySectionModule.leaveCommunity();
root.close();
}
onCopyToClipboard: {
root.store.copyToClipboard(link);
}
}
}
Component {
id: transferOwnershiproot
TransferOwnershipPopup {
anchors.centerIn: parent
onClosed: {
destroy()
}
}
}
Component {
id: inviteFriendsView
CommunityProfilePopupInviteFriendsPanel {
width: stack.width
headerTitle: qsTr("Invite friends")
community: root.community
contactsStore: root.contactsStore
rootStore: root.store
2020-12-16 18:56:48 +00:00
}
}
}
2020-12-18 20:15:00 +00:00
leftButtons: [
StatusBackButton {
id: backButton
visible: contentItem.depth > 1
height: !visible ? 0 : implicitHeight
onClicked: {
contentItem.pop()
2020-12-16 18:56:48 +00:00
}
}
]
rightButtons: [
StatusButton {
text: qsTr("Invite")
visible: root.contentItem.depth > 2
height: !visible ? 0 : implicitHeight
enabled: root.contentItem.currentItem !== undefined && root.contentItem.currentItem.pubKeys.length > 0
onClicked: {
root.contentItem.currentItem.sendInvites(root.contentItem.currentItem.pubKeys, "") // NOTE: empty message
root.contentItem.pop()
}
}
]
2020-12-15 16:04:19 +00:00
}