status-desktop/ui/app/mainui/activitycenter/views/ActivityNotificationCommuni...

58 lines
2.7 KiB
QML
Raw Normal View History

import QtQuick 2.14
import QtQuick.Layouts 1.14
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Components 0.1
import shared 1.0
import shared.panels 1.0
import utils 1.0
import shared.views.chat 1.0
import "../controls"
import "../panels"
2023-02-23 11:09:05 +00:00
import "../stores"
ActivityNotificationMessage {
id: root
contactDetails: notification ? Utils.getContactDetailsAsJson(notification.author, false) : null
messageDetails.messageText: qsTr("Wants to join")
messageDetails.sender.profileImage.name: contactDetails ? contactDetails.displayIcon : ""
messageDetails.sender.profileImage.assetSettings.isImage: true
messageDetails.sender.profileImage.pubkey: notification ? notification.author : ""
messageDetails.sender.profileImage.colorId: Utils.colorIdForPubkey(notification ? notification.author : "")
messageDetails.sender.profileImage.colorHash: Utils.getColorHashAsJson(notification ? notification.author : "", contactDetails && contactDetails.ensVerified)
messageBadgeComponent: CommunityBadge {
readonly property var community: notification ?
root.store.getCommunityDetailsAsJson(notification.communityId) :
null
communityName: community ? community.name : ""
communityImage: community ? community.image : ""
communityColor: community ? community.color : "black"
onCommunityNameClicked: {
root.store.setActiveCommunity(notification.communityId)
root.closeActivityCenter()
}
Layout.maximumWidth: 190
}
ctaComponent: MembershipCta {
2023-02-23 11:09:05 +00:00
pending: notification && notification.membershipStatus === ActivityCenterStore.ActivityCenterMembershipStatus.Pending
accepted: notification && notification.membershipStatus === ActivityCenterStore.ActivityCenterMembershipStatus.Accepted
declined: notification && notification.membershipStatus === ActivityCenterStore.ActivityCenterMembershipStatus.Declined
acceptedPending: notification && notification.membershipStatus === ActivityCenterStore.ActivityCenterMembershipStatus.AcceptedPending
declinedPending: notification && notification.membershipStatus === ActivityCenterStore.ActivityCenterMembershipStatus.DeclinedPending
onAcceptRequestToJoinCommunity: root.store.acceptRequestToJoinCommunity(notification.id, notification.communityId)
onDeclineRequestToJoinCommunity: root.store.declineRequestToJoinCommunity(notification.id, notification.communityId)
//TODO: Get backend value. If the membersip is in acceptedPending or declinedPending state, another user can't accept or decline the request
//Only the user who requested can cancel the request
ctaAllowed: true
}
}