2022-09-15 16:34:41 +00:00
|
|
|
import QtQuick 2.14
|
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
|
|
|
|
import shared 1.0
|
|
|
|
import utils 1.0
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
property var notification
|
|
|
|
property var store
|
|
|
|
|
2022-09-23 12:24:50 +00:00
|
|
|
property alias bodyComponent: bodyLoader.sourceComponent
|
|
|
|
property alias badgeComponent: badgeLoader.sourceComponent
|
2022-09-27 16:21:00 +00:00
|
|
|
property alias ctaComponent: ctaLoader.sourceComponent
|
2022-09-15 16:34:41 +00:00
|
|
|
|
2022-09-23 12:24:50 +00:00
|
|
|
height: Math.max(50, bodyLoader.height + (badgeLoader.item ? badgeLoader.height : 0))
|
2022-09-15 16:34:41 +00:00
|
|
|
|
2022-09-23 12:24:50 +00:00
|
|
|
Loader {
|
|
|
|
id: bodyLoader
|
|
|
|
anchors.top: parent.top
|
2022-09-27 16:21:00 +00:00
|
|
|
anchors.right: ctaLoader.left
|
2022-09-23 12:24:50 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
}
|
|
|
|
|
|
|
|
Loader {
|
|
|
|
id: badgeLoader
|
2022-10-01 12:07:14 +00:00
|
|
|
anchors.bottom: parent.bottom
|
2022-09-23 12:24:50 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: 61 // TODO find a way to align with the text of the message
|
|
|
|
}
|
|
|
|
|
|
|
|
Loader {
|
2022-09-27 16:21:00 +00:00
|
|
|
id: ctaLoader
|
|
|
|
anchors.bottom: bodyLoader.bottom
|
2022-09-15 16:34:41 +00:00
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: Style.current.padding
|
2022-09-23 12:24:50 +00:00
|
|
|
|
|
|
|
sourceComponent: StatusFlatRoundButton {
|
|
|
|
id: markReadBtn
|
|
|
|
icon.source: Style.svg("check-activity")
|
|
|
|
icon.color: notification.read ? icon.disabledColor : "transparent"
|
|
|
|
color: "transparent"
|
|
|
|
tooltip.text: !notification.read ? qsTr("Mark as Read") : qsTr("Mark as Unread")
|
|
|
|
tooltip.orientation: StatusToolTip.Orientation.Left
|
|
|
|
tooltip.x: -tooltip.width - Style.current.padding
|
|
|
|
tooltip.y: 4
|
|
|
|
onClicked: {
|
|
|
|
notification.read ?
|
|
|
|
root.store.activityCenterModuleInst.markActivityCenterNotificationUnread(
|
|
|
|
notification.id, notification.message.communityId,
|
|
|
|
notification.message.chatId, notification.notificationType) :
|
|
|
|
root.store.activityCenterModuleInst.markActivityCenterNotificationRead(
|
|
|
|
notification.id, notification.message.communityId,
|
|
|
|
notification.chatId, notification.notificationType)
|
|
|
|
}
|
2022-09-15 16:34:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|