2021-03-16 13:07:09 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import QtQuick.Layouts 1.13
|
|
|
|
import "../../../../imports"
|
|
|
|
import "../../../../shared"
|
|
|
|
import "../../../../shared/status"
|
|
|
|
import "./"
|
|
|
|
import "../components"
|
|
|
|
|
|
|
|
Item {
|
|
|
|
property string headerTitle: ""
|
|
|
|
property string headerDescription: ""
|
|
|
|
property string headerImageSource: ""
|
|
|
|
height: childrenRect.height
|
|
|
|
|
|
|
|
CommunityPopupButton {
|
|
|
|
id: inviteBtn
|
|
|
|
//% "Invite People"
|
|
|
|
label: qsTrId("invite-people")
|
|
|
|
width: parent.width
|
|
|
|
iconName: "invite"
|
|
|
|
onClicked: openPopup(inviteFriendsPopup)
|
|
|
|
Component {
|
|
|
|
id: inviteFriendsPopup
|
|
|
|
InviteFriendsToCommunityPopup {
|
|
|
|
onClosed: {
|
|
|
|
destroy()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-03-16 15:16:10 +00:00
|
|
|
|
2021-03-16 13:07:09 +00:00
|
|
|
Separator {
|
|
|
|
id: sep
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.top: inviteBtn.bottom
|
|
|
|
anchors.topMargin: Style.current.smallPadding
|
|
|
|
anchors.leftMargin: -Style.current.padding
|
|
|
|
anchors.rightMargin: -Style.current.padding
|
|
|
|
}
|
|
|
|
|
2021-03-16 15:16:10 +00:00
|
|
|
|
|
|
|
StatusSettingsLineButton {
|
2021-03-16 13:07:09 +00:00
|
|
|
id: membershipRequestsBtn
|
2021-03-16 15:16:10 +00:00
|
|
|
text: qsTr("Membership requests")
|
|
|
|
badgeText: chatsModel.communities.activeCommunity.communityMembershipRequests.nbRequests.toString()
|
|
|
|
visible: chatsModel.communities.activeCommunity.communityMembershipRequests.nbRequests > 0
|
|
|
|
badgeSize: 22
|
|
|
|
badgeRadius: badgeSize / 2
|
|
|
|
isBadge: true
|
|
|
|
height: 64
|
2021-03-16 13:07:09 +00:00
|
|
|
anchors.top: sep.bottom
|
|
|
|
anchors.topMargin: visible ? Style.current.smallPadding : 0
|
2021-03-16 15:16:10 +00:00
|
|
|
anchors.leftMargin: 0
|
|
|
|
anchors.rightMargin: 0
|
|
|
|
onClicked: membershipRequestPopup.open()
|
2021-03-16 13:07:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Separator {
|
|
|
|
id: sep2
|
|
|
|
visible: membershipRequestsBtn.visible
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.top: membershipRequestsBtn.bottom
|
|
|
|
anchors.topMargin: Style.current.smallPadding
|
|
|
|
anchors.leftMargin: -Style.current.padding
|
|
|
|
anchors.rightMargin: -Style.current.padding
|
|
|
|
}
|
|
|
|
|
|
|
|
ListView {
|
|
|
|
id: memberList
|
|
|
|
anchors.top: sep2.visible ? sep2.bottom : sep.bottom
|
|
|
|
anchors.topMargin: Style.current.smallPadding
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.bottomMargin: Style.current.halfPadding
|
|
|
|
spacing: 4
|
|
|
|
model: community.members
|
2021-03-17 09:24:24 +00:00
|
|
|
delegate: Rectangle {
|
2021-03-16 13:07:09 +00:00
|
|
|
id: contactRow
|
|
|
|
width: parent.width
|
2021-03-17 09:24:24 +00:00
|
|
|
height: 64
|
|
|
|
radius: Style.current.radius
|
|
|
|
color: isHovered ? Style.current.backgroundHover : Style.current.transparent
|
2021-03-16 13:07:09 +00:00
|
|
|
|
2021-03-17 09:24:24 +00:00
|
|
|
property bool isHovered: false
|
2021-03-16 13:07:09 +00:00
|
|
|
property string nickname: appMain.getUserNickname(model.pubKey)
|
|
|
|
|
|
|
|
StatusImageIdenticon {
|
|
|
|
id: identicon
|
|
|
|
anchors.left: parent.left
|
2021-03-17 09:24:24 +00:00
|
|
|
anchors.leftMargin: Style.current.padding
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
2021-03-16 13:07:09 +00:00
|
|
|
source: model.identicon
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
text: !model.userName.endsWith(".eth") && !!contactRow.nickname ?
|
|
|
|
contactRow.nickname : Utils.removeStatusEns(model.userName)
|
|
|
|
anchors.left: identicon.right
|
|
|
|
anchors.leftMargin: Style.current.smallPadding
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: Style.current.smallPadding
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
2021-03-17 09:24:24 +00:00
|
|
|
font.pixelSize: 15
|
2021-03-16 13:07:09 +00:00
|
|
|
}
|
|
|
|
|
2021-03-17 09:24:24 +00:00
|
|
|
MouseArea {
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
anchors.fill: parent
|
|
|
|
hoverEnabled: true
|
|
|
|
onEntered: contactRow.isHovered = true
|
|
|
|
onExited: contactRow.isHovered = false
|
|
|
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
2021-03-18 12:02:15 +00:00
|
|
|
onClicked: openProfilePopup(model.userName, model.pubKey, model.identicon, '', contactRow.nickname)
|
2021-03-17 09:24:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
StatusContextMenuButton {
|
2021-03-16 13:07:09 +00:00
|
|
|
id: moreActionsBtn
|
|
|
|
anchors.right: parent.right
|
2021-03-17 09:24:24 +00:00
|
|
|
anchors.rightMargin: Style.current.padding
|
2021-03-16 13:07:09 +00:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
2021-03-17 09:24:24 +00:00
|
|
|
onClicked: contextMenu.popup(-contextMenu.width + moreActionsBtn.width, moreActionsBtn.height + 4)
|
|
|
|
hoverEnabled: true
|
2021-03-16 13:07:09 +00:00
|
|
|
cursorShape: Qt.PointingHandCursor
|
2021-03-17 09:24:24 +00:00
|
|
|
onExited: {
|
|
|
|
contactRow.isHovered = false
|
|
|
|
moreActionsBtn.highlighted = false
|
|
|
|
}
|
|
|
|
onEntered: {
|
|
|
|
contactRow.isHovered = true
|
|
|
|
moreActionsBtn.highlighted = true
|
|
|
|
}
|
2021-03-16 13:07:09 +00:00
|
|
|
PopupMenu {
|
|
|
|
id: contextMenu
|
|
|
|
Action {
|
|
|
|
icon.source: "../../../img/communities/menu/view-profile.svg"
|
|
|
|
icon.width: 16
|
|
|
|
icon.height: 16
|
|
|
|
//% "View Profile"
|
|
|
|
text: qsTrId("view-profile")
|
|
|
|
onTriggered: openProfilePopup(model.userName, model.pubKey, model.identicon, '', contactRow.nickname)
|
|
|
|
}
|
2021-03-17 09:24:24 +00:00
|
|
|
/* Action { */
|
|
|
|
/* icon.source: "../../../img/communities/menu/roles.svg" */
|
|
|
|
/* icon.width: 16 */
|
|
|
|
/* icon.height: 16 */
|
|
|
|
/* //% "Roles" */
|
|
|
|
/* text: qsTrId("roles") */
|
|
|
|
/* onTriggered: console.log("TODO") */
|
|
|
|
/* } */
|
|
|
|
Separator {
|
|
|
|
height: 10
|
2021-03-16 13:07:09 +00:00
|
|
|
}
|
|
|
|
Action {
|
2021-03-17 09:24:24 +00:00
|
|
|
property string type: "danger"
|
2021-03-16 13:07:09 +00:00
|
|
|
icon.source: "../../../img/communities/menu/kick.svg"
|
|
|
|
icon.width: 16
|
|
|
|
icon.height: 16
|
|
|
|
icon.color: Style.current.red
|
|
|
|
//% "Kick"
|
|
|
|
text: qsTrId("kick")
|
|
|
|
onTriggered: chatsModel.removeUserFromCommunity(model.pubKey)
|
|
|
|
}
|
2021-03-17 09:24:24 +00:00
|
|
|
/* Action { */
|
|
|
|
/* icon.source: "../../../img/communities/menu/ban.svg" */
|
|
|
|
/* icon.width: 16 */
|
|
|
|
/* icon.height: 16 */
|
|
|
|
/* icon.color: Style.current.red */
|
|
|
|
/* //% "Ban" */
|
|
|
|
/* text: qsTrId("ban") */
|
|
|
|
/* onTriggered: console.log("TODO") */
|
|
|
|
/* } */
|
|
|
|
/* Separator {} */
|
|
|
|
/* Action { */
|
|
|
|
/* icon.source: "../../../img/communities/menu/transfer-ownership.svg" */
|
|
|
|
/* icon.width: 16 */
|
|
|
|
/* icon.height: 16 */
|
|
|
|
/* icon.color: Style.current.red */
|
|
|
|
/* //% "Transfer ownership" */
|
|
|
|
/* text: qsTrId("transfer-ownership") */
|
|
|
|
/* onTriggered: console.log("TODO") */
|
|
|
|
/* } */
|
2021-03-16 13:07:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|