2020-12-15 12:04:19 -04:00
|
|
|
import QtQuick 2.12
|
2021-03-16 14:07:09 +01:00
|
|
|
import QtQuick.Controls 2.12
|
2021-07-15 13:15:56 +02:00
|
|
|
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
import StatusQ.Popups 0.1
|
|
|
|
|
2021-09-28 18:04:06 +03:00
|
|
|
|
|
|
|
import utils 1.0
|
2020-12-15 12:04:19 -04:00
|
|
|
|
2021-10-01 18:58:36 +03:00
|
|
|
import "../../panels/communities"
|
|
|
|
|
2021-07-15 13:15:56 +02:00
|
|
|
StatusModal {
|
2021-10-22 23:49:47 +03:00
|
|
|
id: root
|
2021-07-16 14:36:27 +02:00
|
|
|
|
2021-10-22 23:49:47 +03:00
|
|
|
property var store
|
2021-07-16 14:36:27 +02:00
|
|
|
property var community
|
|
|
|
|
2021-03-16 14:07:09 +01:00
|
|
|
onClosed: {
|
2021-09-07 15:37:00 +02:00
|
|
|
while (contentItem.depth > 1) {
|
|
|
|
contentItem.pop()
|
2021-03-16 14:07:09 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-07 15:37:00 +02:00
|
|
|
header.title: contentItem.currentItem.headerTitle
|
|
|
|
header.subTitle: contentItem.currentItem.headerSubtitle || ""
|
|
|
|
header.image.source: contentItem.currentItem.headerImageSource || ""
|
2021-10-22 23:49:47 +03:00
|
|
|
header.icon.isLetterIdenticon: contentItem.currentItem.headerTitle == root.community.name && !contentItem.currentItem.headerImageSource
|
|
|
|
header.icon.background.color: root.community.communityColor
|
2021-02-12 11:32:04 -05:00
|
|
|
|
2021-09-02 17:40:10 +03:00
|
|
|
contentItem: StackView {
|
2021-03-16 14:07:09 +01:00
|
|
|
id: stack
|
|
|
|
initialItem: profileOverview
|
2021-10-22 23:49:47 +03:00
|
|
|
width: root.width
|
2021-09-07 15:37:00 +02:00
|
|
|
implicitHeight: currentItem.implicitHeight || currentItem.height
|
2020-12-16 14:56:48 -04:00
|
|
|
|
2021-03-16 14:07:09 +01:00
|
|
|
pushEnter: Transition { enabled: false }
|
|
|
|
pushExit: Transition { enabled: false }
|
|
|
|
popEnter: Transition { enabled: false }
|
|
|
|
popExit: Transition { enabled: false }
|
2020-12-18 15:15:00 -05:00
|
|
|
|
2021-03-16 14:07:09 +01:00
|
|
|
Component {
|
|
|
|
id: profileOverview
|
2021-10-01 18:58:36 +03:00
|
|
|
CommunityProfilePopupOverviewPanel {
|
2021-07-15 13:15:56 +02:00
|
|
|
width: stack.width
|
|
|
|
|
2021-10-22 23:49:47 +03:00
|
|
|
headerTitle: root.community.name
|
2021-07-15 13:15:56 +02:00
|
|
|
headerSubtitle: {
|
2021-10-22 23:49:47 +03:00
|
|
|
switch(root.community.access) {
|
2021-03-16 14:07:09 +01:00
|
|
|
//% "Public community"
|
|
|
|
case Constants.communityChatPublicAccess: return qsTrId("public-community");
|
|
|
|
//% "Invitation only community"
|
|
|
|
case Constants.communityChatInvitationOnlyAccess: return qsTrId("invitation-only-community");
|
|
|
|
//% "On request community"
|
|
|
|
case Constants.communityChatOnRequestAccess: return qsTrId("on-request-community");
|
|
|
|
//% "Unknown community"
|
|
|
|
default: return qsTrId("unknown-community");
|
2020-12-17 09:24:33 -04:00
|
|
|
}
|
|
|
|
}
|
2021-10-22 23:49:47 +03:00
|
|
|
headerImageSource: root.community.thumbnailImage
|
|
|
|
community: root.community
|
2021-07-15 13:15:56 +02:00
|
|
|
|
2021-10-22 23:49:47 +03:00
|
|
|
onMembersListButtonClicked: root.contentItem.push(membersList)
|
2021-07-15 13:15:56 +02:00
|
|
|
onNotificationsButtonClicked: {
|
2021-10-22 23:49:47 +03:00
|
|
|
root.store.setCommunityMuted(root.community.id, checked);
|
2021-07-15 13:15:56 +02:00
|
|
|
}
|
2021-10-22 23:49:47 +03:00
|
|
|
onEditButtonClicked: openroot(editCommunityroot, {
|
|
|
|
community: root.community
|
2021-07-16 14:36:27 +02:00
|
|
|
})
|
2021-10-22 23:49:47 +03:00
|
|
|
onTransferOwnershipButtonClicked: openroot(transferOwnershiproot, {privateKey: root.store.exportCommunity()})
|
2021-08-02 12:39:51 +03:00
|
|
|
onLeaveButtonClicked: {
|
2021-10-22 23:49:47 +03:00
|
|
|
root.store.leaveCommunity(root.community.id);
|
|
|
|
root.close();
|
2021-08-02 12:39:51 +03:00
|
|
|
}
|
2021-10-21 03:41:54 +03:00
|
|
|
onCopyToClipboard: {
|
2021-10-22 23:49:47 +03:00
|
|
|
root.store.copyToClipboard(link);
|
2021-10-21 03:41:54 +03:00
|
|
|
}
|
2021-07-16 14:36:27 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
2021-10-22 23:49:47 +03:00
|
|
|
id: transferOwnershiproot
|
2021-07-16 14:36:27 +02:00
|
|
|
TransferOwnershipPopup {
|
|
|
|
anchors.centerIn: parent
|
|
|
|
onClosed: {
|
|
|
|
destroy()
|
|
|
|
}
|
2021-07-15 13:15:56 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: membersList
|
2021-10-01 18:58:36 +03:00
|
|
|
CommunityProfilePopupMembersListPanel {
|
2021-07-15 13:15:56 +02:00
|
|
|
width: stack.width
|
2021-07-22 17:03:59 +02:00
|
|
|
//% "Members"
|
|
|
|
headerTitle: qsTrId("members-label")
|
2021-10-22 23:49:47 +03:00
|
|
|
headerSubtitle: root.community.nbMembers.toString()
|
|
|
|
community: root.community
|
|
|
|
onInviteButtonClicked: root.contentItem.push(inviteFriendsView)
|
2021-07-15 13:15:56 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: inviteFriendsView
|
2021-10-01 18:58:36 +03:00
|
|
|
CommunityProfilePopupInviteFriendsPanel {
|
2021-07-15 13:15:56 +02:00
|
|
|
width: stack.width
|
2021-07-22 17:03:59 +02:00
|
|
|
//% "Invite friends"
|
|
|
|
headerTitle: qsTrId("invite-friends")
|
2021-10-22 23:49:47 +03:00
|
|
|
community: root.community
|
2021-07-15 13:15:56 +02:00
|
|
|
|
|
|
|
contactListSearch.chatKey.text: ""
|
|
|
|
contactListSearch.pubKey: ""
|
|
|
|
contactListSearch.pubKeys: []
|
|
|
|
contactListSearch.ensUsername: ""
|
2021-10-22 23:49:47 +03:00
|
|
|
contactListSearch.existingContacts.visible: root.store.profileModelInst.contacts.list.hasAddedContacts()
|
2021-07-15 13:15:56 +02:00
|
|
|
contactListSearch.noContactsRect.visible: !contactListSearch.existingContacts.visible
|
2020-12-16 14:56:48 -04:00
|
|
|
}
|
|
|
|
}
|
2021-03-16 14:07:09 +01:00
|
|
|
}
|
2020-12-18 15:15:00 -05:00
|
|
|
|
2021-07-15 13:15:56 +02:00
|
|
|
leftButtons: [
|
2021-03-16 14:07:09 +01:00
|
|
|
StatusRoundButton {
|
2021-07-16 09:53:41 +02:00
|
|
|
id: backButton
|
2021-03-16 14:07:09 +01:00
|
|
|
icon.name: "arrow-right"
|
|
|
|
icon.height: 16
|
2021-07-15 13:15:56 +02:00
|
|
|
icon.width: 20
|
2021-03-16 14:07:09 +01:00
|
|
|
rotation: 180
|
2021-09-07 15:37:00 +02:00
|
|
|
visible: contentItem.depth > 1
|
2021-07-15 13:15:56 +02:00
|
|
|
height: !visible ? 0 : implicitHeight
|
2021-03-16 14:07:09 +01:00
|
|
|
onClicked: {
|
2021-09-07 15:37:00 +02:00
|
|
|
contentItem.pop()
|
2020-12-16 14:56:48 -04:00
|
|
|
}
|
|
|
|
}
|
2021-07-15 13:15:56 +02:00
|
|
|
]
|
2021-04-20 14:31:36 +02:00
|
|
|
|
2021-07-15 13:15:56 +02:00
|
|
|
rightButtons: [
|
2021-04-20 14:31:36 +02:00
|
|
|
StatusButton {
|
2021-07-22 17:03:59 +02:00
|
|
|
//% "Invite"
|
|
|
|
text: qsTrId("community-invite-title")
|
2021-10-22 23:49:47 +03:00
|
|
|
visible: root.contentItem.depth > 2
|
2021-07-15 13:15:56 +02:00
|
|
|
height: !visible ? 0 : implicitHeight
|
2021-10-22 23:49:47 +03:00
|
|
|
enabled: root.contentItem.currentItem.contactListSearch !== undefined && root.contentItem.currentItem.contactListSearch.pubKeys.length > 0
|
2021-04-20 14:31:36 +02:00
|
|
|
onClicked: {
|
2021-10-22 23:49:47 +03:00
|
|
|
root.contentItem.currentItem.sendInvites(root.contentItem.currentItem.contactListSearch.pubKeys)
|
|
|
|
root.contentItem.pop()
|
2021-04-20 14:31:36 +02:00
|
|
|
}
|
|
|
|
}
|
2021-07-15 13:15:56 +02:00
|
|
|
]
|
2020-12-15 12:04:19 -04:00
|
|
|
}
|
|
|
|
|