2020-12-15 16:04:19 +00:00
|
|
|
import QtQuick 2.12
|
2021-03-16 13:07:09 +00:00
|
|
|
import QtQuick.Controls 2.12
|
2020-12-15 16:04:19 +00:00
|
|
|
import QtQuick.Dialogs 1.3
|
2020-12-16 18:56:48 +00:00
|
|
|
import QtQuick.Layouts 1.13
|
|
|
|
import QtGraphicalEffects 1.13
|
2021-04-20 09:21:01 +00:00
|
|
|
import QtQuick.Controls.Universal 2.12
|
2020-12-15 16:04:19 +00:00
|
|
|
import "../../../../imports"
|
|
|
|
import "../../../../shared"
|
|
|
|
import "../../../../shared/status"
|
|
|
|
import "../ContactsColumn"
|
|
|
|
|
|
|
|
ModalPopup {
|
2021-05-24 03:09:49 +00:00
|
|
|
property string communityId: chatsModel.communities.activeCommunity.id
|
|
|
|
property string name: chatsModel.communities.activeCommunity.name
|
|
|
|
property string description: chatsModel.communities.activeCommunity.description
|
|
|
|
property int access: chatsModel.communities.activeCommunity.access
|
|
|
|
property string source: chatsModel.communities.activeCommunity.source
|
|
|
|
property string communityColor: chatsModel.communities.activeCommunity.communityColor
|
|
|
|
property int nbMembers: chatsModel.communities.activeCommunity.nbMembers
|
|
|
|
property bool isAdmin: chatsModel.communities.activeCommunity.isAdmin
|
2021-03-18 17:58:17 +00:00
|
|
|
height: stack.currentItem.height + modalHeader.height + modalFooter.height + Style.current.padding * 3
|
2020-12-15 16:04:19 +00:00
|
|
|
id: popup
|
|
|
|
|
2021-03-16 13:07:09 +00:00
|
|
|
onClosed: {
|
|
|
|
while (stack.depth > 1) {
|
|
|
|
stack.pop()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-15 16:04:19 +00:00
|
|
|
header: Item {
|
2021-03-16 13:07:09 +00:00
|
|
|
id: modalHeader
|
2020-12-15 16:04:19 +00:00
|
|
|
height: childrenRect.height
|
|
|
|
width: parent.width
|
|
|
|
|
2021-03-16 13:07:09 +00:00
|
|
|
property string title: stack.currentItem.headerTitle
|
|
|
|
property string description: stack.currentItem.headerDescription
|
|
|
|
property string imageSource: stack.currentItem.headerImageSource
|
|
|
|
property bool useLetterIdenticon: !!stack.currentItem.useLetterIdenticon
|
|
|
|
|
2021-03-16 12:39:09 +00:00
|
|
|
Loader {
|
2020-12-15 16:04:19 +00:00
|
|
|
id: communityImg
|
2021-03-16 13:07:09 +00:00
|
|
|
sourceComponent: !modalHeader.useLetterIdenticon ? commmunityImgCmp : letterIdenticonCmp
|
|
|
|
active: !!modalHeader.imageSource || modalHeader.useLetterIdenticon
|
2020-12-15 16:04:19 +00:00
|
|
|
}
|
|
|
|
|
2021-03-16 12:39:09 +00:00
|
|
|
Component {
|
|
|
|
id: commmunityImgCmp
|
|
|
|
RoundedImage {
|
2021-03-16 13:07:09 +00:00
|
|
|
source: modalHeader.imageSource
|
2021-03-16 12:39:09 +00:00
|
|
|
width: 40
|
|
|
|
height: 40
|
2021-03-16 13:07:09 +00:00
|
|
|
visible: !!modalHeader.imageSource
|
2021-03-16 12:39:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: letterIdenticonCmp
|
|
|
|
StatusLetterIdenticon {
|
|
|
|
width: 40
|
|
|
|
height: 40
|
|
|
|
chatName: popup.name
|
2021-03-23 19:13:36 +00:00
|
|
|
color: popup.communityColor || Style.current.blue
|
2021-03-16 12:39:09 +00:00
|
|
|
}
|
2021-03-16 13:07:09 +00:00
|
|
|
}
|
2021-03-16 12:39:09 +00:00
|
|
|
|
2020-12-15 16:04:19 +00:00
|
|
|
StyledTextEdit {
|
|
|
|
id: communityName
|
2021-03-16 13:07:09 +00:00
|
|
|
text: modalHeader.title
|
2020-12-15 16:04:19 +00:00
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: 2
|
2021-03-16 13:07:09 +00:00
|
|
|
anchors.left: communityImg.active ? communityImg.right : parent.left
|
|
|
|
anchors.leftMargin: communityImg.active ? Style.current.smallPadding : 0
|
2020-12-15 16:04:19 +00:00
|
|
|
font.bold: true
|
|
|
|
font.pixelSize: 17
|
|
|
|
readOnly: true
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
2021-03-16 13:07:09 +00:00
|
|
|
id: headerDescription
|
|
|
|
text: modalHeader.description
|
2020-12-15 16:04:19 +00:00
|
|
|
anchors.left: communityName.left
|
|
|
|
anchors.top: communityName.bottom
|
|
|
|
anchors.topMargin: 2
|
|
|
|
font.pixelSize: 15
|
|
|
|
font.weight: Font.Thin
|
|
|
|
color: Style.current.secondaryText
|
|
|
|
}
|
2021-02-12 16:32:04 +00:00
|
|
|
|
|
|
|
Separator {
|
2021-03-16 13:07:09 +00:00
|
|
|
anchors.top: headerDescription.bottom
|
2021-04-20 12:31:36 +00:00
|
|
|
anchors.topMargin: modalHeader.description === "" ? 0 : Style.current.padding
|
2021-02-12 16:32:04 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: -Style.current.padding
|
|
|
|
anchors.leftMargin: -Style.current.padding
|
|
|
|
}
|
2020-12-15 16:04:19 +00:00
|
|
|
}
|
|
|
|
|
2021-03-16 13:07:09 +00:00
|
|
|
StackView {
|
|
|
|
id: stack
|
|
|
|
initialItem: profileOverview
|
2021-03-18 17:58:17 +00:00
|
|
|
width: parent.width
|
|
|
|
|
2020-12-16 18:56:48 +00:00
|
|
|
|
2021-03-16 13:07:09 +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
|
|
|
|
2021-04-20 12:31:36 +00:00
|
|
|
Component {
|
|
|
|
id: inviteFriendsView
|
|
|
|
CommunityProfilePopupInviteFriendsView {
|
|
|
|
headerTitle: qsTr("Invite friends")
|
|
|
|
contactListSearch.chatKey.text: ""
|
|
|
|
contactListSearch.pubKey: ""
|
|
|
|
contactListSearch.pubKeys: []
|
|
|
|
contactListSearch.ensUsername: ""
|
|
|
|
contactListSearch.existingContacts.visible: profileModel.contacts.list.hasAddedContacts()
|
|
|
|
contactListSearch.noContactsRect.visible: !contactListSearch.existingContacts.visible
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-16 13:07:09 +00:00
|
|
|
Component {
|
|
|
|
id: membersList
|
|
|
|
CommunityProfilePopupMembersList {
|
|
|
|
headerTitle: qsTr("Members")
|
|
|
|
headerDescription: popup.nbMembers.toString()
|
2021-05-24 03:09:49 +00:00
|
|
|
members: chatsModel.communities.activeCommunity.members
|
2020-12-16 18:56:48 +00:00
|
|
|
}
|
|
|
|
}
|
2020-12-18 20:15:00 +00:00
|
|
|
|
2021-03-16 13:07:09 +00:00
|
|
|
Component {
|
|
|
|
id: profileOverview
|
|
|
|
CommunityProfilePopupOverview {
|
|
|
|
property bool useLetterIdenticon: !!!popup.source
|
2021-05-24 03:09:49 +00:00
|
|
|
headerTitle: chatsModel.communities.activeCommunity.name
|
2021-03-16 13:07:09 +00:00
|
|
|
headerDescription: {
|
|
|
|
switch(access) {
|
|
|
|
//% "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 13:24:33 +00:00
|
|
|
}
|
|
|
|
}
|
2021-05-24 03:09:49 +00:00
|
|
|
headerImageSource: chatsModel.communities.activeCommunity.thumbnailImage
|
|
|
|
description: chatsModel.communities.activeCommunity.description
|
2020-12-16 18:56:48 +00:00
|
|
|
}
|
|
|
|
}
|
2021-03-16 13:07:09 +00:00
|
|
|
}
|
2020-12-18 20:15:00 +00:00
|
|
|
|
2021-03-16 13:07:09 +00:00
|
|
|
footer: Item {
|
|
|
|
id: modalFooter
|
|
|
|
visible: stack.depth > 1
|
|
|
|
width: parent.width
|
|
|
|
height: modalFooter.visible ? btnBack.height : 0
|
|
|
|
StatusRoundButton {
|
|
|
|
id: btnBack
|
|
|
|
anchors.left: parent.left
|
|
|
|
icon.name: "arrow-right"
|
|
|
|
icon.width: 20
|
|
|
|
icon.height: 16
|
|
|
|
rotation: 180
|
2021-04-20 09:21:01 +00:00
|
|
|
type: globalSettings.theme === Universal.Dark ? "secondary" : "primary"
|
2021-03-16 13:07:09 +00:00
|
|
|
onClicked: {
|
|
|
|
stack.pop()
|
2020-12-16 18:56:48 +00:00
|
|
|
}
|
|
|
|
}
|
2021-04-20 12:31:36 +00:00
|
|
|
|
|
|
|
StatusButton {
|
|
|
|
text: qsTr("Invite")
|
|
|
|
anchors.right: parent.right
|
|
|
|
enabled: stack.currentItem.contactListSearch !== undefined && stack.currentItem.contactListSearch.pubKeys.length > 0
|
|
|
|
onClicked: {
|
|
|
|
stack.currentItem.sendInvites(stack.currentItem.contactListSearch.pubKeys)
|
|
|
|
stack.pop()
|
|
|
|
}
|
|
|
|
}
|
2020-12-16 18:56:48 +00:00
|
|
|
}
|
2020-12-15 16:04:19 +00:00
|
|
|
}
|
|
|
|
|