2021-03-16 13:07:09 +00:00
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Layouts 1.13
|
2021-07-15 11:15:56 +00:00
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
import StatusQ.Popups 0.1
|
|
|
|
|
2021-09-28 15:04:06 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
2021-03-16 13:07:09 +00:00
|
|
|
|
2021-07-15 11:15:56 +00:00
|
|
|
Column {
|
2021-03-16 13:07:09 +00:00
|
|
|
id: root
|
|
|
|
|
|
|
|
property string headerTitle: ""
|
2021-07-15 11:15:56 +00:00
|
|
|
property string headerSubtitle: ""
|
2021-03-16 13:07:09 +00:00
|
|
|
property string headerImageSource: ""
|
2021-07-16 12:36:27 +00:00
|
|
|
property var community
|
2021-03-16 13:07:09 +00:00
|
|
|
|
2021-07-15 11:15:56 +00:00
|
|
|
signal membersListButtonClicked()
|
|
|
|
signal notificationsButtonClicked(bool checked)
|
|
|
|
signal editButtonClicked()
|
|
|
|
signal transferOwnershipButtonClicked()
|
|
|
|
signal leaveButtonClicked()
|
|
|
|
|
|
|
|
Item {
|
2021-07-16 07:53:41 +00:00
|
|
|
height: Math.max(46, communityDescription.height + 16)
|
2021-03-16 13:07:09 +00:00
|
|
|
width: parent.width
|
2021-07-15 11:15:56 +00:00
|
|
|
StatusBaseText {
|
|
|
|
id: communityDescription
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.leftMargin: 16
|
|
|
|
anchors.rightMargin: 16
|
2021-07-16 12:36:27 +00:00
|
|
|
text: root.community.description
|
2021-07-15 11:15:56 +00:00
|
|
|
font.pixelSize: 15
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
wrapMode: Text.Wrap
|
|
|
|
}
|
2021-03-16 13:07:09 +00:00
|
|
|
}
|
|
|
|
|
2021-07-15 11:15:56 +00:00
|
|
|
StatusModalDivider {
|
|
|
|
bottomPadding: 8
|
2021-03-16 13:07:09 +00:00
|
|
|
}
|
|
|
|
|
2021-07-15 11:15:56 +00:00
|
|
|
StatusDescriptionListItem {
|
2021-07-22 15:03:59 +00:00
|
|
|
//% "Share community"
|
|
|
|
title: qsTrId("share-community")
|
2021-07-16 12:36:27 +00:00
|
|
|
subTitle: `${Constants.communityLinkPrefix}${root.community.id.substring(0, 4)}...${root.community.id.substring(root.community.id.length -2)}`
|
2021-07-22 15:03:59 +00:00
|
|
|
//% "Copy to clipboard"
|
|
|
|
tooltip.text: qsTrId("copy-to-clipboard")
|
2021-07-15 11:15:56 +00:00
|
|
|
icon.name: "copy"
|
|
|
|
iconButton.onClicked: {
|
2021-07-16 12:36:27 +00:00
|
|
|
let link = `${Constants.communityLinkPrefix}${root.community.id}`
|
2021-07-15 11:15:56 +00:00
|
|
|
chatsModel.copyToClipboard(link)
|
|
|
|
tooltip.visible = !tooltip.visible
|
|
|
|
}
|
|
|
|
width: parent.width
|
2021-03-16 13:07:09 +00:00
|
|
|
}
|
|
|
|
|
2021-07-15 11:15:56 +00:00
|
|
|
StatusModalDivider {
|
|
|
|
topPadding: 8
|
|
|
|
bottomPadding: 8
|
2021-03-16 13:07:09 +00:00
|
|
|
}
|
|
|
|
|
2021-07-15 11:15:56 +00:00
|
|
|
StatusListItem {
|
|
|
|
id: membersListItem
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
|
2021-07-16 12:36:27 +00:00
|
|
|
property int nbRequests: root.community.communityMembershipRequests.nbRequests
|
2021-07-15 11:15:56 +00:00
|
|
|
|
2021-07-16 20:22:50 +00:00
|
|
|
//% "Members"
|
|
|
|
title: qsTrId("members-label")
|
2021-07-15 11:15:56 +00:00
|
|
|
icon.name: "group-chat"
|
2021-07-16 12:36:27 +00:00
|
|
|
label: root.community.nbMembers.toString()
|
2021-07-15 11:15:56 +00:00
|
|
|
sensor.onClicked: root.membersListButtonClicked()
|
|
|
|
|
|
|
|
components: [
|
|
|
|
StatusBadge {
|
|
|
|
visible: !!membersListItem.nbRequests
|
|
|
|
value: membersListItem.nbRequests
|
2021-07-20 09:50:36 +00:00
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: 2
|
2021-07-15 11:15:56 +00:00
|
|
|
},
|
|
|
|
StatusIcon {
|
|
|
|
icon: "chevron-down"
|
|
|
|
rotation: 270
|
|
|
|
color: Theme.palette.baseColor1
|
2021-03-16 13:07:09 +00:00
|
|
|
}
|
2021-07-15 11:15:56 +00:00
|
|
|
]
|
|
|
|
}
|
2021-03-16 13:07:09 +00:00
|
|
|
|
2021-07-15 11:15:56 +00:00
|
|
|
StatusListItem {
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
2021-07-16 20:22:50 +00:00
|
|
|
//% "Notifications"
|
|
|
|
title: qsTrId("notifications")
|
2021-07-15 11:15:56 +00:00
|
|
|
icon.name: "notification"
|
|
|
|
components: [
|
2021-06-29 17:42:13 +00:00
|
|
|
StatusSwitch {
|
2021-07-16 12:36:27 +00:00
|
|
|
checked: !root.community.muted
|
2021-07-20 08:16:21 +00:00
|
|
|
onClicked: root.notificationsButtonClicked(!checked)
|
2021-06-29 17:42:13 +00:00
|
|
|
}
|
2021-07-15 11:15:56 +00:00
|
|
|
]
|
|
|
|
}
|
2021-03-16 13:07:09 +00:00
|
|
|
|
2021-07-15 11:15:56 +00:00
|
|
|
StatusModalDivider {
|
|
|
|
topPadding: 8
|
|
|
|
bottomPadding: 8
|
|
|
|
}
|
2021-03-16 13:07:09 +00:00
|
|
|
|
2021-07-15 11:15:56 +00:00
|
|
|
StatusListItem {
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
2021-07-16 12:36:27 +00:00
|
|
|
visible: root.community.isAdmin || root.community.admin
|
2021-07-22 15:03:59 +00:00
|
|
|
//% "Edit community"
|
|
|
|
title: qsTrId("edit-community")
|
2021-07-15 11:15:56 +00:00
|
|
|
icon.name: "edit"
|
|
|
|
type: StatusListItem.Type.Secondary
|
|
|
|
sensor.onClicked: root.editButtonClicked()
|
|
|
|
}
|
2021-03-16 13:07:09 +00:00
|
|
|
|
2021-07-15 11:15:56 +00:00
|
|
|
StatusListItem {
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
2021-07-16 12:36:27 +00:00
|
|
|
visible: root.community.isAdmin || root.community.admin
|
2021-07-22 15:03:59 +00:00
|
|
|
//% "Transfer ownership"
|
|
|
|
title: qsTrId("transfer-ownership")
|
2021-07-15 11:15:56 +00:00
|
|
|
icon.name: "exchange"
|
|
|
|
type: StatusListItem.Type.Secondary
|
|
|
|
sensor.onClicked: root.transferOwnershipButtonClicked()
|
|
|
|
}
|
2021-03-16 13:07:09 +00:00
|
|
|
|
2021-07-15 11:15:56 +00:00
|
|
|
StatusListItem {
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
2021-07-16 20:22:50 +00:00
|
|
|
//% "Leave community"
|
|
|
|
title: qsTrId("leave-community")
|
2021-07-15 11:15:56 +00:00
|
|
|
icon.name: "arrow-right"
|
|
|
|
icon.height: 16
|
|
|
|
icon.width: 20
|
|
|
|
icon.rotation: 180
|
2021-07-21 09:52:10 +00:00
|
|
|
type: StatusListItem.Type.Danger
|
2021-07-15 11:15:56 +00:00
|
|
|
sensor.onClicked: root.leaveButtonClicked()
|
2021-03-16 13:07:09 +00:00
|
|
|
}
|
2021-07-15 11:15:56 +00:00
|
|
|
|
2021-07-16 20:22:50 +00:00
|
|
|
//% "Roles"
|
2021-07-15 11:15:56 +00:00
|
|
|
/* // TODO add this back when roles exist */
|
|
|
|
/* // Loader { */
|
2021-07-16 12:36:27 +00:00
|
|
|
/* // active: root.community.isAdmin */
|
2021-07-15 11:15:56 +00:00
|
|
|
/* // width: parent.width */
|
|
|
|
/* // sourceComponent: CommunityPopupButton { */
|
2021-07-16 20:22:50 +00:00
|
|
|
/* // label: qsTrId("community-roles") */
|
2021-07-15 11:15:56 +00:00
|
|
|
/* // 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 */
|
2021-09-28 15:04:06 +00:00
|
|
|
/* // source: Style.svg("caret") */
|
2021-07-15 11:15:56 +00:00
|
|
|
/* // width: 13 */
|
|
|
|
/* // height: 7 */
|
|
|
|
/* // rotation: -90 */
|
|
|
|
/* // ColorOverlay { */
|
|
|
|
/* // anchors.fill: parent */
|
|
|
|
/* // source: parent */
|
|
|
|
/* // color: Style.current.secondaryText */
|
|
|
|
/* // } */
|
|
|
|
/* // } */
|
|
|
|
/* // } */
|
|
|
|
/* // } */
|
2021-03-16 13:07:09 +00:00
|
|
|
}
|