2021-02-10 20:37:17 +00:00
|
|
|
import QtQuick 2.12
|
2021-07-20 09:50:36 +00:00
|
|
|
import QtQuick.Controls 2.3
|
|
|
|
|
|
|
|
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-10-27 21:27:49 +00:00
|
|
|
import shared 1.0
|
2021-02-10 20:37:17 +00:00
|
|
|
|
2021-07-20 09:50:36 +00:00
|
|
|
StatusModal {
|
2021-02-10 20:37:17 +00:00
|
|
|
id: popup
|
2021-10-22 20:49:47 +00:00
|
|
|
property var store
|
2022-01-21 19:18:56 +00:00
|
|
|
property var pendingRequestsToJoin
|
2021-02-10 20:37:17 +00:00
|
|
|
onOpened: {
|
2021-09-07 13:51:32 +00:00
|
|
|
contentItem.errorText.text = ""
|
2021-02-10 20:37:17 +00:00
|
|
|
}
|
|
|
|
|
2021-07-22 15:03:59 +00:00
|
|
|
//% "Membership requests"
|
|
|
|
header.title: qsTrId("membership-requests")
|
2021-09-07 13:51:32 +00:00
|
|
|
header.subTitle: contentItem.membershipRequestList.count
|
2021-02-10 20:37:17 +00:00
|
|
|
|
2021-09-02 14:40:10 +00:00
|
|
|
contentItem: Column {
|
2021-07-20 09:50:36 +00:00
|
|
|
property alias errorText: errorText
|
|
|
|
property alias membershipRequestList: membershipRequestList
|
|
|
|
width: popup.width
|
2021-02-10 20:37:17 +00:00
|
|
|
|
2021-07-20 09:50:36 +00:00
|
|
|
StatusBaseText {
|
2021-02-10 20:37:17 +00:00
|
|
|
id: errorText
|
|
|
|
visible: !!text
|
|
|
|
height: visible ? implicitHeight : 0
|
2021-07-20 09:50:36 +00:00
|
|
|
color: Theme.palette.dangerColor1
|
2021-02-10 20:37:17 +00:00
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
wrapMode: Text.Wrap
|
|
|
|
width: parent.width
|
|
|
|
}
|
|
|
|
|
2021-07-20 09:50:36 +00:00
|
|
|
Item {
|
|
|
|
height: 8
|
|
|
|
width: parent.width
|
|
|
|
}
|
2021-02-10 20:37:17 +00:00
|
|
|
|
2021-07-20 09:50:36 +00:00
|
|
|
ScrollView {
|
|
|
|
width: parent.width
|
|
|
|
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
|
|
|
topPadding: 8
|
|
|
|
bottomPadding: 8
|
|
|
|
height: 300
|
|
|
|
clip: true
|
|
|
|
|
|
|
|
ListView {
|
|
|
|
id: membershipRequestList
|
|
|
|
anchors.fill: parent
|
2022-01-21 19:18:56 +00:00
|
|
|
model: popup.pendingRequestsToJoin
|
2021-07-20 09:50:36 +00:00
|
|
|
clip: true
|
|
|
|
|
|
|
|
delegate: StatusListItem {
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
2022-01-21 19:18:56 +00:00
|
|
|
property var contactDetails: Utils.getContactDetailsAsJson(model.pubKey)
|
2021-07-20 09:50:36 +00:00
|
|
|
|
2022-01-21 19:18:56 +00:00
|
|
|
property string displayName: contactDetails.displayName || root.store.generateAlias(model.pubKey)
|
2021-07-20 09:50:36 +00:00
|
|
|
|
2022-01-21 19:18:56 +00:00
|
|
|
image.isIdenticon: contactDetails.isDisplayIconIdenticon === undefined ?
|
|
|
|
true: contactDetails.isDisplayIconIdenticon
|
|
|
|
image.source: {
|
|
|
|
if (!contactDetails.identicon) {
|
|
|
|
return root.store.generateIdenticon(model.pubKey)
|
|
|
|
}
|
|
|
|
return contactDetails.isDisplayIconIdenticon ? contactDetails.identicon : contactDetails.thumbnailImage
|
|
|
|
}
|
2021-07-20 09:50:36 +00:00
|
|
|
|
|
|
|
title: displayName
|
|
|
|
|
|
|
|
components: [
|
|
|
|
StatusRoundIcon {
|
|
|
|
icon.name: "thumbs-up"
|
|
|
|
icon.color: Theme.palette.white
|
|
|
|
icon.background.width: 28
|
|
|
|
icon.background.height: 28
|
|
|
|
icon.background.color: Theme.palette.successColor1
|
|
|
|
MouseArea {
|
|
|
|
id: thumbsUpSensor
|
|
|
|
hoverEnabled: true
|
|
|
|
anchors.fill: parent
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
2022-01-21 19:18:56 +00:00
|
|
|
onClicked: popup.store.acceptRequestToJoinCommunity(model.communityId, id)
|
2021-02-10 20:37:17 +00:00
|
|
|
}
|
2021-07-20 09:50:36 +00:00
|
|
|
},
|
|
|
|
StatusRoundIcon {
|
|
|
|
icon.name: "thumbs-down"
|
|
|
|
icon.color: Theme.palette.white
|
|
|
|
icon.background.width: 28
|
|
|
|
icon.background.height: 28
|
|
|
|
icon.background.color: Theme.palette.dangerColor1
|
|
|
|
MouseArea {
|
|
|
|
id: thumbsDownSensor
|
|
|
|
hoverEnabled: true
|
|
|
|
anchors.fill: parent
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
2022-01-21 19:18:56 +00:00
|
|
|
onClicked: popup.store.declineRequestToJoinCommunity(model.communityId, id)
|
2021-02-10 20:37:17 +00:00
|
|
|
}
|
|
|
|
}
|
2021-07-20 09:50:36 +00:00
|
|
|
]
|
2021-02-10 20:37:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-20 09:50:36 +00:00
|
|
|
leftButtons: [
|
|
|
|
StatusRoundButton {
|
|
|
|
icon.name: "arrow-right"
|
|
|
|
icon.width: 20
|
|
|
|
icon.height: 16
|
|
|
|
rotation: 180
|
|
|
|
onClicked: popup.close()
|
|
|
|
}
|
|
|
|
]
|
2021-02-10 20:37:17 +00:00
|
|
|
}
|