2022-10-05 14:51:42 +00:00
|
|
|
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
|
2022-10-13 15:52:44 +00:00
|
|
|
import shared.controls 1.0
|
2022-10-05 14:51:42 +00:00
|
|
|
import utils 1.0
|
|
|
|
|
|
|
|
import "../controls"
|
2023-02-23 11:09:05 +00:00
|
|
|
import "../stores"
|
2022-10-05 14:51:42 +00:00
|
|
|
|
2022-10-13 15:52:44 +00:00
|
|
|
ActivityNotificationBase {
|
2022-10-05 14:51:42 +00:00
|
|
|
id: root
|
|
|
|
|
2022-10-13 15:52:44 +00:00
|
|
|
bodyComponent: RowLayout {
|
2023-02-15 12:24:18 +00:00
|
|
|
width: parent.width
|
2022-10-19 12:56:00 +00:00
|
|
|
height: 50
|
2022-11-30 11:15:29 +00:00
|
|
|
readonly property var community: notification ?
|
|
|
|
root.store.getCommunityDetailsAsJson(notification.communityId) :
|
|
|
|
null
|
2022-10-05 14:51:42 +00:00
|
|
|
|
2022-10-13 15:52:44 +00:00
|
|
|
StatusSmartIdenticon {
|
|
|
|
id: identicon
|
2022-11-30 11:15:29 +00:00
|
|
|
name: community ? community.name : ""
|
|
|
|
asset.color: community ? community.color : "black"
|
|
|
|
asset.name: community ? community.image : ""
|
2022-10-13 15:52:44 +00:00
|
|
|
asset.width: 40
|
|
|
|
asset.height: 40
|
|
|
|
asset.letterSize: width / 2.4
|
|
|
|
asset.isImage: true
|
2022-10-19 12:56:00 +00:00
|
|
|
Layout.alignment: Qt.AlignVCenter
|
2022-10-18 19:46:57 +00:00
|
|
|
Layout.leftMargin: Style.current.padding
|
2022-10-13 15:52:44 +00:00
|
|
|
}
|
|
|
|
|
2022-10-18 19:46:57 +00:00
|
|
|
StatusBaseText {
|
2022-10-13 15:52:44 +00:00
|
|
|
text: qsTr("Request to join")
|
2022-10-29 07:17:35 +00:00
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
font.weight: Font.Medium
|
|
|
|
font.pixelSize: 13
|
2022-10-13 15:52:44 +00:00
|
|
|
Layout.alignment: Qt.AlignVCenter
|
|
|
|
}
|
2022-10-05 14:51:42 +00:00
|
|
|
|
2022-10-13 15:52:44 +00:00
|
|
|
CommunityBadge {
|
2022-11-30 11:15:29 +00:00
|
|
|
communityName: community ? community.name : ""
|
|
|
|
communityImage: community ? community.image : ""
|
|
|
|
communityColor: community ? community.color : "black"
|
2022-10-13 15:52:44 +00:00
|
|
|
onCommunityNameClicked: root.store.setActiveCommunity(notification.communityId)
|
|
|
|
Layout.alignment: Qt.AlignVCenter
|
2023-02-15 12:24:18 +00:00
|
|
|
Layout.maximumWidth: 190
|
2022-10-13 15:52:44 +00:00
|
|
|
}
|
2022-10-05 14:51:42 +00:00
|
|
|
|
2022-10-18 19:46:57 +00:00
|
|
|
StatusBaseText {
|
2022-10-13 15:52:44 +00:00
|
|
|
text: {
|
2022-11-30 11:15:29 +00:00
|
|
|
if (!notification)
|
|
|
|
return ""
|
2023-02-23 11:09:05 +00:00
|
|
|
if (notification.membershipStatus === ActivityCenterStore.ActivityCenterMembershipStatus.Pending)
|
2022-10-13 15:52:44 +00:00
|
|
|
return qsTr("pending")
|
2023-02-23 11:09:05 +00:00
|
|
|
if (notification.membershipStatus === ActivityCenterStore.ActivityCenterMembershipStatus.Accepted)
|
2022-10-13 15:52:44 +00:00
|
|
|
return qsTr("accepted")
|
2023-02-23 11:09:05 +00:00
|
|
|
if (notification.membershipStatus === ActivityCenterStore.ActivityCenterMembershipStatus.Declined)
|
2022-10-13 15:52:44 +00:00
|
|
|
return qsTr("declined")
|
|
|
|
return ""
|
|
|
|
}
|
2022-10-29 07:17:35 +00:00
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
font.weight: Font.Medium
|
|
|
|
font.pixelSize: 13
|
2022-10-13 15:52:44 +00:00
|
|
|
Layout.alignment: Qt.AlignVCenter
|
2022-10-18 19:46:57 +00:00
|
|
|
Layout.fillWidth: true
|
2022-10-05 14:51:42 +00:00
|
|
|
}
|
2022-10-13 15:52:44 +00:00
|
|
|
}
|
|
|
|
|
2023-02-23 11:09:05 +00:00
|
|
|
ctaComponent: notification && notification.membershipStatus === ActivityCenterStore.ActivityCenterMembershipStatus.Accepted ?
|
2022-11-30 11:15:29 +00:00
|
|
|
visitComponent : null
|
2022-10-13 15:52:44 +00:00
|
|
|
|
|
|
|
Component {
|
|
|
|
id: visitComponent
|
|
|
|
|
|
|
|
StyledTextEdit {
|
|
|
|
text: Utils.getLinkStyle(qsTr("Visit Community"), hoveredLink, Style.current.blue)
|
|
|
|
readOnly: true
|
|
|
|
textFormat: Text.RichText
|
|
|
|
color: Style.current.blue
|
|
|
|
font.pixelSize: 13
|
2022-10-29 07:17:35 +00:00
|
|
|
onLinkActivated: {
|
|
|
|
root.store.setActiveCommunity(notification.communityId)
|
2022-11-16 17:17:38 +00:00
|
|
|
root.closeActivityCenter()
|
2022-10-29 07:17:35 +00:00
|
|
|
}
|
2022-10-05 14:51:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|