2022-03-23 15:38:23 +00:00
|
|
|
import QtQuick 2.14
|
|
|
|
import QtQuick.Layouts 1.14
|
|
|
|
import QtQuick.Controls 2.14
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
import shared.controls.chat 1.0
|
|
|
|
|
2023-06-23 06:17:04 +00:00
|
|
|
import AppLayouts.Communities.layouts 1.0
|
2022-03-23 15:38:23 +00:00
|
|
|
|
|
|
|
SettingsPageLayout {
|
|
|
|
id: root
|
|
|
|
|
2023-06-20 07:14:25 +00:00
|
|
|
property var rootStore
|
2022-03-23 15:38:23 +00:00
|
|
|
property var membersModel
|
2022-06-28 15:03:10 +00:00
|
|
|
property var bannedMembersModel
|
2022-08-04 07:49:41 +00:00
|
|
|
property var pendingMemberRequestsModel
|
|
|
|
property var declinedMemberRequestsModel
|
2022-06-28 15:03:10 +00:00
|
|
|
property string communityName
|
2022-03-23 15:38:23 +00:00
|
|
|
|
|
|
|
property bool editable: true
|
|
|
|
|
|
|
|
signal membershipRequestsClicked()
|
|
|
|
signal kickUserClicked(string id)
|
|
|
|
signal banUserClicked(string id)
|
2022-06-28 15:03:10 +00:00
|
|
|
signal unbanUserClicked(string id)
|
2022-08-04 07:49:41 +00:00
|
|
|
signal acceptRequestToJoin(string id)
|
|
|
|
signal declineRequestToJoin(string id)
|
2022-03-23 15:38:23 +00:00
|
|
|
|
2023-04-06 11:11:57 +00:00
|
|
|
function goTo(tab: int) {
|
|
|
|
if(root.contentItem) {
|
|
|
|
root.contentItem.goTo(tab)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-23 15:38:23 +00:00
|
|
|
title: qsTr("Members")
|
|
|
|
|
|
|
|
content: ColumnLayout {
|
2023-04-06 11:11:57 +00:00
|
|
|
|
|
|
|
function goTo(tab: int) {
|
|
|
|
let tabButton = membersTabBar.currentItem
|
|
|
|
switch (tab) {
|
|
|
|
case Constants.CommunityMembershipSubSections.Members:
|
|
|
|
tabButton = allMembersBtn
|
|
|
|
break
|
|
|
|
case Constants.CommunityMembershipSubSections.MembershipRequests:
|
|
|
|
tabButton = pendingRequestsBtn
|
|
|
|
break
|
|
|
|
case Constants.CommunityMembershipSubSections.RejectedMembers:
|
|
|
|
tabButton = declinedRequestsBtn
|
|
|
|
break
|
|
|
|
case Constants.CommunityMembershipSubSections.BannedMembers:
|
|
|
|
tabButton = bannedBtn
|
|
|
|
break
|
|
|
|
}
|
|
|
|
|
|
|
|
if(tabButton.enabled)
|
|
|
|
membersTabBar.currentIndex = tabButton.TabBar.index
|
|
|
|
}
|
|
|
|
|
2022-08-08 15:56:57 +00:00
|
|
|
spacing: 19
|
2022-03-23 15:38:23 +00:00
|
|
|
|
2022-06-28 15:03:10 +00:00
|
|
|
StatusTabBar {
|
|
|
|
id: membersTabBar
|
2022-03-23 15:38:23 +00:00
|
|
|
Layout.fillWidth: true
|
2022-08-08 15:56:57 +00:00
|
|
|
Layout.topMargin: 5
|
2022-03-23 15:38:23 +00:00
|
|
|
|
2022-06-28 15:03:10 +00:00
|
|
|
StatusTabButton {
|
|
|
|
id: allMembersBtn
|
|
|
|
width: implicitWidth
|
|
|
|
text: qsTr("All Members")
|
|
|
|
}
|
2022-03-23 15:38:23 +00:00
|
|
|
|
2022-08-04 07:49:41 +00:00
|
|
|
StatusTabButton {
|
|
|
|
id: pendingRequestsBtn
|
|
|
|
width: implicitWidth
|
|
|
|
text: qsTr("Pending Requests")
|
|
|
|
enabled: pendingMemberRequestsModel.count > 0
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusTabButton {
|
|
|
|
id: declinedRequestsBtn
|
|
|
|
width: implicitWidth
|
|
|
|
text: qsTr("Rejected")
|
|
|
|
enabled: declinedMemberRequestsModel.count > 0
|
|
|
|
}
|
2022-06-28 15:03:10 +00:00
|
|
|
|
|
|
|
StatusTabButton {
|
|
|
|
id: bannedBtn
|
|
|
|
width: implicitWidth
|
|
|
|
enabled: bannedMembersModel.count > 0
|
|
|
|
text: qsTr("Banned")
|
|
|
|
}
|
2022-03-23 15:38:23 +00:00
|
|
|
}
|
|
|
|
|
2022-06-28 15:03:10 +00:00
|
|
|
StackLayout {
|
|
|
|
id: stackLayout
|
2022-03-23 15:38:23 +00:00
|
|
|
Layout.fillWidth: true
|
2022-06-28 15:03:10 +00:00
|
|
|
Layout.fillHeight: true
|
|
|
|
currentIndex: membersTabBar.currentIndex
|
|
|
|
|
2023-06-26 11:48:45 +00:00
|
|
|
MembersTabPanel {
|
2022-06-28 15:03:10 +00:00
|
|
|
model: root.membersModel
|
2023-06-20 07:14:25 +00:00
|
|
|
rootStore: root.rootStore
|
2022-06-28 15:03:10 +00:00
|
|
|
placeholderText: {
|
2023-06-21 20:37:51 +00:00
|
|
|
if (root.membersModel.count === 0)
|
2022-06-28 15:03:10 +00:00
|
|
|
return qsTr("No members to search")
|
2023-06-21 20:37:51 +00:00
|
|
|
|
|
|
|
return qsTr("Search %1's %n member(s)", "", root.membersModel ? root.membersModel.count : 0).arg(root.communityName)
|
2022-06-28 15:03:10 +00:00
|
|
|
}
|
2023-06-26 11:48:45 +00:00
|
|
|
panelType: MembersTabPanel.TabType.AllMembers
|
2022-03-23 15:38:23 +00:00
|
|
|
|
2022-06-28 15:03:10 +00:00
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
2022-03-23 15:38:23 +00:00
|
|
|
|
2022-06-28 15:03:10 +00:00
|
|
|
onKickUserClicked: {
|
|
|
|
kickModal.userNameToKick = name
|
|
|
|
kickModal.userIdToKick = id
|
|
|
|
kickModal.open()
|
|
|
|
}
|
2022-03-23 15:38:23 +00:00
|
|
|
|
2022-06-28 15:03:10 +00:00
|
|
|
onBanUserClicked: {
|
|
|
|
banModal.userNameToBan = name
|
|
|
|
banModal.userIdToBan = id
|
|
|
|
banModal.open()
|
|
|
|
}
|
|
|
|
}
|
2022-03-23 15:38:23 +00:00
|
|
|
|
2023-06-26 11:48:45 +00:00
|
|
|
MembersTabPanel {
|
2022-08-04 07:49:41 +00:00
|
|
|
model: root.pendingMemberRequestsModel
|
2023-06-20 07:14:25 +00:00
|
|
|
rootStore: root.rootStore
|
2022-08-04 07:49:41 +00:00
|
|
|
placeholderText: {
|
2023-06-21 20:37:51 +00:00
|
|
|
if (root.pendingMemberRequestsModel.count === 0)
|
2022-08-04 07:49:41 +00:00
|
|
|
return qsTr("No pending requests to search")
|
2023-06-21 20:37:51 +00:00
|
|
|
|
|
|
|
return qsTr("Search %1's %n pending request(s)", "", root.pendingMemberRequestsModel.count).arg(root.communityName)
|
2022-08-04 07:49:41 +00:00
|
|
|
}
|
2023-06-26 11:48:45 +00:00
|
|
|
panelType: MembersTabPanel.TabType.PendingRequests
|
2022-08-04 07:49:41 +00:00
|
|
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
|
|
|
|
onAcceptRequestToJoin: root.acceptRequestToJoin(id)
|
|
|
|
onDeclineRequestToJoin: root.declineRequestToJoin(id)
|
|
|
|
}
|
|
|
|
|
2023-06-26 11:48:45 +00:00
|
|
|
MembersTabPanel {
|
2022-08-04 07:49:41 +00:00
|
|
|
model: root.declinedMemberRequestsModel
|
2023-06-20 07:14:25 +00:00
|
|
|
rootStore: root.rootStore
|
2022-08-04 07:49:41 +00:00
|
|
|
placeholderText: {
|
2023-06-21 20:37:51 +00:00
|
|
|
if (root.declinedMemberRequestsModel.count === 0)
|
2022-08-04 07:49:41 +00:00
|
|
|
return qsTr("No rejected members to search")
|
2023-06-21 20:37:51 +00:00
|
|
|
|
|
|
|
return qsTr("Search %1's %n rejected member(s)", "", root.declinedMemberRequestsModel.count).arg(root.communityName)
|
2022-08-04 07:49:41 +00:00
|
|
|
}
|
2023-06-26 11:48:45 +00:00
|
|
|
panelType: MembersTabPanel.TabType.DeclinedRequests
|
2022-08-04 07:49:41 +00:00
|
|
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
|
|
|
|
onAcceptRequestToJoin: root.acceptRequestToJoin(id)
|
|
|
|
}
|
|
|
|
|
2023-06-26 11:48:45 +00:00
|
|
|
MembersTabPanel {
|
2022-06-28 15:03:10 +00:00
|
|
|
model: root.bannedMembersModel
|
2023-06-20 07:14:25 +00:00
|
|
|
rootStore: root.rootStore
|
2022-06-28 15:03:10 +00:00
|
|
|
placeholderText: {
|
2023-06-21 20:37:51 +00:00
|
|
|
if (root.bannedMembersModel.count === 0)
|
2022-06-28 15:03:10 +00:00
|
|
|
return qsTr("No banned members to search")
|
2023-06-21 20:37:51 +00:00
|
|
|
|
|
|
|
return qsTr("Search %1's %n banned member(s)", "", root.bannedMembersModel.count).arg(root.communityName)
|
2022-06-28 15:03:10 +00:00
|
|
|
}
|
2023-06-26 11:48:45 +00:00
|
|
|
panelType: MembersTabPanel.TabType.BannedMembers
|
2022-03-23 15:38:23 +00:00
|
|
|
|
2022-06-28 15:03:10 +00:00
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
2022-03-23 15:38:23 +00:00
|
|
|
|
2022-06-28 15:03:10 +00:00
|
|
|
onUnbanUserClicked: root.unbanUserClicked(id)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-03-23 15:38:23 +00:00
|
|
|
|
2022-06-28 15:03:10 +00:00
|
|
|
StatusModal {
|
|
|
|
id: banModal
|
2022-03-23 15:38:23 +00:00
|
|
|
|
2022-06-28 15:03:10 +00:00
|
|
|
property string userNameToBan: ""
|
|
|
|
property string userIdToBan: ""
|
2022-03-23 15:38:23 +00:00
|
|
|
|
2022-06-28 15:03:10 +00:00
|
|
|
readonly property string text: qsTr("Are you sure you ban <b>%1</b> from %2?").arg(userNameToBan).arg(root.communityName)
|
2022-03-23 15:38:23 +00:00
|
|
|
|
2022-06-28 15:03:10 +00:00
|
|
|
anchors.centerIn: parent
|
|
|
|
width: 400
|
2023-05-23 12:46:16 +00:00
|
|
|
headerSettings.title: qsTr("Ban %1").arg(userNameToBan)
|
2022-03-23 15:38:23 +00:00
|
|
|
|
2022-06-28 15:03:10 +00:00
|
|
|
contentItem: StatusBaseText {
|
|
|
|
id: banContentText
|
|
|
|
anchors.centerIn: parent
|
|
|
|
font.pixelSize: 15
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
padding: 15
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
text: banModal.text
|
|
|
|
}
|
2022-03-23 15:38:23 +00:00
|
|
|
|
2022-06-28 15:03:10 +00:00
|
|
|
rightButtons: [
|
|
|
|
StatusButton {
|
|
|
|
text: qsTr("Cancel")
|
|
|
|
onClicked: banModal.close()
|
|
|
|
normalColor: "transparent"
|
|
|
|
hoverColor: "transparent"
|
|
|
|
},
|
|
|
|
StatusButton {
|
|
|
|
id: banButton
|
|
|
|
text: qsTr("Ban")
|
|
|
|
type: StatusBaseButton.Type.Danger
|
|
|
|
onClicked: {
|
|
|
|
root.banUserClicked(banModal.userIdToBan)
|
|
|
|
banModal.close()
|
2022-03-23 15:38:23 +00:00
|
|
|
}
|
2022-06-28 15:03:10 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
2022-03-23 15:38:23 +00:00
|
|
|
|
2022-06-28 15:03:10 +00:00
|
|
|
StatusModal {
|
|
|
|
id: kickModal
|
2022-03-23 15:38:23 +00:00
|
|
|
|
2022-06-28 15:03:10 +00:00
|
|
|
property string userNameToKick: ""
|
|
|
|
property string userIdToKick: ""
|
2022-03-23 15:38:23 +00:00
|
|
|
|
2022-06-28 15:03:10 +00:00
|
|
|
readonly property string text : qsTr("Are you sure you kick <b>%1</b> from %2?").arg(userNameToKick).arg(communityName)
|
2022-03-23 15:38:23 +00:00
|
|
|
|
2022-06-28 15:03:10 +00:00
|
|
|
anchors.centerIn: parent
|
|
|
|
width: 400
|
2023-05-23 12:46:16 +00:00
|
|
|
headerSettings.title: qsTr("Kick %1").arg(userNameToKick)
|
2022-03-23 15:38:23 +00:00
|
|
|
|
2022-06-28 15:03:10 +00:00
|
|
|
contentItem: StatusBaseText {
|
|
|
|
id: kickContentText
|
|
|
|
anchors.centerIn: parent
|
|
|
|
font.pixelSize: 15
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
padding: 15
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
text: kickModal.text
|
|
|
|
}
|
2022-03-23 15:38:23 +00:00
|
|
|
|
2022-06-28 15:03:10 +00:00
|
|
|
rightButtons: [
|
|
|
|
StatusButton {
|
|
|
|
text: qsTr("Cancel")
|
|
|
|
onClicked: kickModal.close()
|
|
|
|
normalColor: "transparent"
|
|
|
|
hoverColor: "transparent"
|
|
|
|
},
|
|
|
|
StatusButton {
|
2022-10-25 19:08:15 +00:00
|
|
|
objectName: "CommunityMembers_KickModal_KickButton"
|
2022-06-28 15:03:10 +00:00
|
|
|
text: qsTr("Kick")
|
|
|
|
type: StatusBaseButton.Type.Danger
|
|
|
|
onClicked: {
|
|
|
|
root.kickUserClicked(kickModal.userIdToKick)
|
|
|
|
kickModal.close()
|
|
|
|
}
|
2022-03-23 15:38:23 +00:00
|
|
|
}
|
2022-06-28 15:03:10 +00:00
|
|
|
]
|
2022-03-23 15:38:23 +00:00
|
|
|
}
|
|
|
|
}
|