2022-03-23 10:56:25 +00:00
|
|
|
import QtQuick 2.14
|
|
|
|
import QtQuick.Controls 2.14
|
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
import StatusQ.Popups 0.1
|
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
|
2022-07-14 11:03:36 +00:00
|
|
|
StatusListView {
|
2022-03-23 10:56:25 +00:00
|
|
|
id: root
|
|
|
|
|
|
|
|
property bool hasAddedContacts: false
|
|
|
|
|
|
|
|
signal inviteFriends(var communityData)
|
2023-06-14 08:42:52 +00:00
|
|
|
signal closeCommunityClicked(string communityId)
|
|
|
|
signal leaveCommunityClicked(string community, string communityId, string outroMessage)
|
2022-07-25 15:39:09 +00:00
|
|
|
signal setCommunityMutedClicked(string communityId, bool muted)
|
|
|
|
signal setActiveCommunityClicked(string communityId)
|
2022-03-23 10:56:25 +00:00
|
|
|
|
|
|
|
interactive: false
|
|
|
|
implicitHeight: contentItem.childrenRect.height
|
|
|
|
spacing: 0
|
|
|
|
|
|
|
|
delegate: StatusListItem {
|
|
|
|
id: statusCommunityItem
|
|
|
|
width: parent.width
|
|
|
|
title: model.name
|
2022-09-15 15:49:13 +00:00
|
|
|
statusListItemTitle.font.pixelSize: 17
|
|
|
|
statusListItemTitle.font.bold: true
|
2022-03-23 10:56:25 +00:00
|
|
|
subTitle: model.description
|
2022-09-15 15:49:13 +00:00
|
|
|
tertiaryTitle: qsTr("%n member(s)", "", model.members.count)
|
2022-08-11 11:55:08 +00:00
|
|
|
asset.name: model.image
|
|
|
|
asset.isLetterIdenticon: !model.image
|
|
|
|
asset.bgColor: model.color || Theme.palette.primaryColor1
|
2022-09-21 11:19:50 +00:00
|
|
|
asset.width: 40
|
|
|
|
asset.height: 40
|
2022-03-23 10:56:25 +00:00
|
|
|
visible: model.joined
|
|
|
|
height: visible ? implicitHeight: 0
|
|
|
|
|
2022-09-15 15:49:13 +00:00
|
|
|
onClicked: setActiveCommunityClicked(model.id)
|
2022-07-25 15:39:09 +00:00
|
|
|
|
2022-03-23 10:56:25 +00:00
|
|
|
components: [
|
|
|
|
StatusFlatButton {
|
2023-06-14 08:42:52 +00:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
2022-08-11 12:24:49 +00:00
|
|
|
objectName: "CommunitiesListPanel_leaveCommunityPopupButton"
|
2022-03-23 10:56:25 +00:00
|
|
|
size: StatusBaseButton.Size.Small
|
|
|
|
type: StatusBaseButton.Type.Danger
|
2022-09-13 07:37:09 +00:00
|
|
|
borderColor: "transparent"
|
2023-06-19 14:16:35 +00:00
|
|
|
enabled: model.memberRole !== Constants.memberRole.owner
|
2023-06-14 08:42:52 +00:00
|
|
|
text: model.spectated ? qsTr("Close Community") : qsTr("Leave Community")
|
|
|
|
onClicked: model.spectated ? root.closeCommunityClicked(model.id) : root.leaveCommunityClicked(model.name, model.id, model.outroMessage)
|
2022-03-23 10:56:25 +00:00
|
|
|
},
|
2022-09-15 15:49:13 +00:00
|
|
|
StatusFlatButton {
|
2023-04-12 19:08:42 +00:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
size: StatusBaseButton.Size.Small
|
2022-09-15 15:49:13 +00:00
|
|
|
icon.name: model.muted ? "notification-muted" : "notification"
|
2022-07-25 15:39:09 +00:00
|
|
|
onClicked: root.setCommunityMutedClicked(model.id, !model.muted)
|
2022-03-23 10:56:25 +00:00
|
|
|
},
|
2022-09-15 15:49:13 +00:00
|
|
|
StatusFlatButton {
|
2023-04-12 19:08:42 +00:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
size: StatusBaseButton.Size.Small
|
2022-03-23 10:56:25 +00:00
|
|
|
icon.name: "invite-users"
|
|
|
|
onClicked: root.inviteFriends(model)
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
2023-06-14 08:42:52 +00:00
|
|
|
}
|