2021-03-16 13:07:09 +00:00
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Controls 2.12
|
|
|
|
import QtQuick.Dialogs 1.3
|
|
|
|
import QtQuick.Layouts 1.13
|
|
|
|
import QtGraphicalEffects 1.13
|
2021-04-20 09:21:01 +00:00
|
|
|
import QtQuick.Controls.Universal 2.12
|
2021-03-16 13:07:09 +00:00
|
|
|
import "../../../../imports"
|
|
|
|
import "../../../../shared"
|
|
|
|
import "../../../../shared/status"
|
|
|
|
import "../ContactsColumn"
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
property string headerTitle: ""
|
|
|
|
property string headerDescription: ""
|
|
|
|
property string headerImageSource: ""
|
|
|
|
property string description: ""
|
|
|
|
|
|
|
|
width: parent.width
|
|
|
|
height: childrenRect.height
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: descriptionText
|
|
|
|
text: root.description
|
|
|
|
wrapMode: Text.Wrap
|
|
|
|
width: parent.width
|
|
|
|
font.pixelSize: 15
|
|
|
|
}
|
|
|
|
|
|
|
|
Separator {
|
|
|
|
id: sep1
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.top: descriptionText.bottom
|
|
|
|
anchors.topMargin: Style.current.smallPadding
|
|
|
|
anchors.leftMargin: -Style.current.padding
|
|
|
|
anchors.rightMargin: -Style.current.padding
|
|
|
|
}
|
|
|
|
|
|
|
|
TextWithLabel {
|
|
|
|
id: shareCommunity
|
|
|
|
anchors.top: sep1.bottom
|
|
|
|
anchors.topMargin: Style.current.bigPadding
|
|
|
|
//% "Share community"
|
|
|
|
label: qsTrId("share-community")
|
2021-03-17 15:56:27 +00:00
|
|
|
text: `${Constants.communityLinkPrefix}${communityId.substring(0, 4)}...${communityId.substring(communityId.length -2)}`
|
|
|
|
textToCopy: Constants.communityLinkPrefix + communityId
|
2021-03-16 13:07:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Separator {
|
|
|
|
id: sep2
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.top: shareCommunity.bottom
|
|
|
|
anchors.topMargin: Style.current.smallPadding
|
|
|
|
anchors.leftMargin: -Style.current.padding
|
|
|
|
anchors.rightMargin: -Style.current.padding
|
|
|
|
}
|
|
|
|
|
|
|
|
Column {
|
|
|
|
anchors.top: sep2.bottom
|
|
|
|
anchors.topMargin: Style.current.halfPadding
|
|
|
|
width: parent.width
|
|
|
|
|
|
|
|
Loader {
|
|
|
|
width: parent.width
|
|
|
|
sourceComponent: Component {
|
|
|
|
CommunityPopupButton {
|
|
|
|
id: memberBtn
|
|
|
|
label: qsTr("Members")
|
|
|
|
iconName: "members"
|
|
|
|
txtColor: Style.current.textColor
|
|
|
|
onClicked: stack.push(membersList)
|
2021-04-20 09:21:01 +00:00
|
|
|
type: globalSettings.theme === Universal.Dark ? "secondary" : "primary"
|
2021-03-16 13:07:09 +00:00
|
|
|
|
|
|
|
Item {
|
|
|
|
property int nbRequests: chatsModel.communities.activeCommunity.communityMembershipRequests.nbRequests
|
|
|
|
|
|
|
|
id: memberBlock
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: Style.current.padding
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
width: childrenRect.width
|
|
|
|
height: memberBtn.height
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: nbMemberText
|
|
|
|
text: nbMembers.toString()
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
padding: 0
|
|
|
|
font.pixelSize: 15
|
|
|
|
color: Style.current.secondaryText
|
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: badge
|
|
|
|
visible: memberBlock.nbRequests > 0
|
|
|
|
anchors.left: nbMemberText.right
|
|
|
|
anchors.leftMargin: visible ? Style.current.halfPadding : 0
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
color: Style.current.blue
|
|
|
|
width: visible ? 22 : 0
|
|
|
|
height: 22
|
|
|
|
radius: width / 2
|
|
|
|
Text {
|
|
|
|
font.pixelSize: 12
|
|
|
|
color: Style.current.white
|
|
|
|
anchors.centerIn: parent
|
|
|
|
text: memberBlock.nbRequests
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SVGImage {
|
|
|
|
id: caret
|
|
|
|
anchors.left: badge.right
|
|
|
|
anchors.leftMargin: Style.current.padding
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
source: "../../../img/caret.svg"
|
|
|
|
width: 13
|
|
|
|
height: 7
|
|
|
|
rotation: -90
|
|
|
|
ColorOverlay {
|
|
|
|
anchors.fill: parent
|
|
|
|
source: parent
|
|
|
|
color: Style.current.secondaryText
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO add this back when roles exist
|
|
|
|
// Loader {
|
|
|
|
// active: isAdmin
|
|
|
|
// width: parent.width
|
|
|
|
// sourceComponent: CommunityPopupButton {
|
|
|
|
// label: qsTr("Roles")
|
|
|
|
// iconName: "roles"
|
|
|
|
// width: parent.width
|
|
|
|
// onClicked: console.log("TODO:")
|
|
|
|
// txtColor: Style.current.textColor
|
|
|
|
// SVGImage {
|
|
|
|
// anchors.verticalCenter: parent.verticalCenter
|
|
|
|
// anchors.right: parent.right
|
|
|
|
// anchors.rightMargin: Style.current.padding
|
|
|
|
// source: "../../../img/caret.svg"
|
|
|
|
// width: 13
|
|
|
|
// height: 7
|
|
|
|
// rotation: -90
|
|
|
|
// ColorOverlay {
|
|
|
|
// anchors.fill: parent
|
|
|
|
// source: parent
|
|
|
|
// color: Style.current.secondaryText
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
2021-06-29 17:42:13 +00:00
|
|
|
CommunityPopupButton {
|
|
|
|
id: notificationsBtn
|
|
|
|
//% "Notifications"
|
|
|
|
label: qsTrId("notifications")
|
|
|
|
iconName: "notifications"
|
|
|
|
width: parent.width
|
|
|
|
txtColor: Style.current.textColor
|
|
|
|
type: globalSettings.theme === Universal.Dark ? "secondary" : "primary"
|
|
|
|
onClicked: function(){
|
|
|
|
notificationSwitch.clicked()
|
|
|
|
}
|
|
|
|
StatusSwitch {
|
|
|
|
id: notificationSwitch
|
|
|
|
checked: !chatsModel.communities.activeCommunity.muted
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: Style.current.padding
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
onClicked: function () {
|
|
|
|
chatsModel.communities.setCommunityMuted(chatsModel.communities.activeCommunity.id, notificationSwitch.checked)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-03-16 13:07:09 +00:00
|
|
|
|
|
|
|
Item {
|
|
|
|
id: spacer1
|
|
|
|
width: parent.width
|
|
|
|
height: Style.current.halfPadding
|
|
|
|
}
|
|
|
|
|
|
|
|
Separator {
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: -Style.current.padding
|
|
|
|
anchors.leftMargin: -Style.current.padding
|
|
|
|
}
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: spacer2
|
|
|
|
width: parent.width
|
|
|
|
height: Style.current.halfPadding
|
|
|
|
}
|
|
|
|
|
|
|
|
Loader {
|
2021-05-24 03:09:49 +00:00
|
|
|
// TODO: once Edit is vailable in the app, put back isAdmin
|
|
|
|
active: isAdmin
|
2021-03-16 13:07:09 +00:00
|
|
|
width: parent.width
|
|
|
|
sourceComponent: CommunityPopupButton {
|
|
|
|
//% "Edit community"
|
|
|
|
label: qsTrId("edit-community")
|
|
|
|
iconName: "edit"
|
2021-05-24 03:09:49 +00:00
|
|
|
type: globalSettings.theme === Universal.Dark ? "secondary" : "primary"
|
2021-03-16 13:07:09 +00:00
|
|
|
onClicked: openPopup(editCommunityPopup)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Loader {
|
|
|
|
active: isAdmin
|
|
|
|
width: parent.width
|
|
|
|
sourceComponent: CommunityPopupButton {
|
|
|
|
label: qsTr("Transfer ownership")
|
|
|
|
iconName: "../transfer"
|
2021-04-20 09:21:01 +00:00
|
|
|
type: globalSettings.theme === Universal.Dark ? "secondary" : "primary"
|
2021-04-28 19:03:41 +00:00
|
|
|
onClicked: openPopup(transferOwnershipPopup, {privateKey: chatsModel.communities.exportComumnity()})
|
2021-03-16 13:07:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CommunityPopupButton {
|
|
|
|
//% "Leave community"
|
|
|
|
label: qsTrId("leave-community")
|
|
|
|
iconName: "leave"
|
2021-07-13 13:32:54 +00:00
|
|
|
type: "warn"
|
|
|
|
txtColor: Style.current.red
|
2021-05-04 15:03:41 +00:00
|
|
|
onClicked: chatsModel.communities.leaveCommunity(communityId)
|
2021-03-16 13:07:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|