feat(ActivityCenter): Fix messages and AC notifications height
Close #7497
This commit is contained in:
parent
d4d22f4094
commit
b9ca8654a8
|
@ -10,7 +10,7 @@ Rectangle {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
height: visible ? 24 : 0
|
height: visible ? 24 : 0
|
||||||
width: childrenRect.width + Style.current.smallPadding * 2
|
width: childrenRect.width + Style.current.smallPadding
|
||||||
radius: height / 2
|
radius: height / 2
|
||||||
border.width: 1
|
border.width: 1
|
||||||
border.color: Style.current.borderSecondary
|
border.color: Style.current.borderSecondary
|
||||||
|
|
|
@ -157,6 +157,7 @@ Popup {
|
||||||
roleValue: Constants.activityCenterNotificationTypeMention
|
roleValue: Constants.activityCenterNotificationTypeMention
|
||||||
|
|
||||||
ActivityNotificationMention {
|
ActivityNotificationMention {
|
||||||
|
width: listView.availableWidth
|
||||||
store: root.store
|
store: root.store
|
||||||
notification: model
|
notification: model
|
||||||
messageContextMenu: root.messageContextMenu
|
messageContextMenu: root.messageContextMenu
|
||||||
|
@ -168,6 +169,7 @@ Popup {
|
||||||
roleValue: Constants.activityCenterNotificationTypeReply
|
roleValue: Constants.activityCenterNotificationTypeReply
|
||||||
|
|
||||||
ActivityNotificationReply {
|
ActivityNotificationReply {
|
||||||
|
width: listView.availableWidth
|
||||||
store: root.store
|
store: root.store
|
||||||
notification: model
|
notification: model
|
||||||
messageContextMenu: root.messageContextMenu
|
messageContextMenu: root.messageContextMenu
|
||||||
|
@ -179,6 +181,7 @@ Popup {
|
||||||
roleValue: Constants.activityCenterNotificationTypeContactRequest
|
roleValue: Constants.activityCenterNotificationTypeContactRequest
|
||||||
|
|
||||||
ActivityNotificationContactRequest {
|
ActivityNotificationContactRequest {
|
||||||
|
width: listView.availableWidth
|
||||||
store: root.store
|
store: root.store
|
||||||
notification: model
|
notification: model
|
||||||
messageContextMenu: root.messageContextMenu
|
messageContextMenu: root.messageContextMenu
|
||||||
|
|
|
@ -14,29 +14,51 @@ Item {
|
||||||
property var notification
|
property var notification
|
||||||
property var store
|
property var store
|
||||||
|
|
||||||
property alias markReadBtnVisible: markReadBtn.visible
|
property alias bodyComponent: bodyLoader.sourceComponent
|
||||||
|
property alias badgeComponent: badgeLoader.sourceComponent
|
||||||
|
property alias actionComponent: actionLoader.sourceComponent
|
||||||
|
property alias action: actionLoader
|
||||||
|
|
||||||
width: listView.availableWidth
|
height: Math.max(50, bodyLoader.height + (badgeLoader.item ? badgeLoader.height : 0))
|
||||||
height: 50
|
|
||||||
|
|
||||||
StatusFlatRoundButton {
|
Loader {
|
||||||
id: markReadBtn
|
id: bodyLoader
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.right: actionLoader.left
|
||||||
|
anchors.left: parent.left
|
||||||
|
}
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
id: badgeLoader
|
||||||
|
anchors.top: bodyLoader.bottom
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: 61 // TODO find a way to align with the text of the message
|
||||||
|
}
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
id: actionLoader
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.rightMargin: Style.current.padding
|
anchors.rightMargin: Style.current.padding
|
||||||
icon.source: Style.svg("check-activity")
|
|
||||||
icon.color: notification.read ? icon.disabledColor : "transparent"
|
sourceComponent: StatusFlatRoundButton {
|
||||||
color: "transparent"
|
id: markReadBtn
|
||||||
tooltip.text: !notification.read ? qsTr("Mark as Read") : qsTr("Mark as Unread")
|
icon.source: Style.svg("check-activity")
|
||||||
tooltip.orientation: StatusToolTip.Orientation.Left
|
icon.color: notification.read ? icon.disabledColor : "transparent"
|
||||||
tooltip.x: -tooltip.width - Style.current.padding
|
color: "transparent"
|
||||||
tooltip.y: 4
|
tooltip.text: !notification.read ? qsTr("Mark as Read") : qsTr("Mark as Unread")
|
||||||
onClicked: {
|
tooltip.orientation: StatusToolTip.Orientation.Left
|
||||||
notification.read ?
|
tooltip.x: -tooltip.width - Style.current.padding
|
||||||
root.store.activityCenterModuleInst.markActivityCenterNotificationUnread(
|
tooltip.y: 4
|
||||||
notification.id, notification.message.communityId, notification.message.chatId, notification.notificationType) :
|
onClicked: {
|
||||||
root.store.activityCenterModuleInst.markActivityCenterNotificationRead(
|
notification.read ?
|
||||||
notification.id, notification.message.communityId, notification.chatId, notification.notificationType)
|
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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -12,5 +12,5 @@ ActivityNotificationMessage {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
// TODO: mark as read ignores notification type
|
// TODO: mark as read ignores notification type
|
||||||
// markReadBtnVisible: false
|
actionComponent: null
|
||||||
}
|
}
|
|
@ -14,7 +14,7 @@ import "../controls"
|
||||||
ActivityNotificationMessage {
|
ActivityNotificationMessage {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
badge: notification.message.communityId ? communityBadgeComponent : notification.chatId ? groupChatBadgeComponent : null
|
badgeComponent: notification.message.communityId ? communityBadgeComponent : notification.chatId ? groupChatBadgeComponent : null
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: communityBadgeComponent
|
id: communityBadgeComponent
|
||||||
|
|
|
@ -19,19 +19,9 @@ ActivityNotificationBase {
|
||||||
"" : root.store.activityCenterList.getNotificationData(
|
"" : root.store.activityCenterList.getNotificationData(
|
||||||
previousNotificationIndex, "timestamp")
|
previousNotificationIndex, "timestamp")
|
||||||
|
|
||||||
property alias badge: badgeLoader.sourceComponent
|
|
||||||
|
|
||||||
signal activityCenterClose()
|
signal activityCenterClose()
|
||||||
|
|
||||||
height: Math.max(60, notificationMessage.height + (badgeLoader.item ? badgeLoader.height : 0))
|
bodyComponent: MessageView {
|
||||||
|
|
||||||
MessageView {
|
|
||||||
id: notificationMessage
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
z: -1
|
|
||||||
|
|
||||||
rootStore: root.store
|
rootStore: root.store
|
||||||
messageStore: root.store.messageStore
|
messageStore: root.store.messageStore
|
||||||
messageContextMenu: root.messageContextMenu
|
messageContextMenu: root.messageContextMenu
|
||||||
|
@ -74,11 +64,4 @@ ActivityNotificationBase {
|
||||||
prevMessageIndex: root.previousNotificationIndex
|
prevMessageIndex: root.previousNotificationIndex
|
||||||
prevMsgTimestamp: root.previousNotificationTimestamp
|
prevMsgTimestamp: root.previousNotificationTimestamp
|
||||||
}
|
}
|
||||||
|
|
||||||
Loader {
|
|
||||||
id: badgeLoader
|
|
||||||
anchors.top: notificationMessage.bottom
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.leftMargin: 61 // TODO find a way to align with the text of the message
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -212,6 +212,7 @@ Loader {
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
height: implicitHeight
|
||||||
z: (typeof chatLogView === "undefined") ? 1 : (chatLogView.count - index)
|
z: (typeof chatLogView === "undefined") ? 1 : (chatLogView.count - index)
|
||||||
|
|
||||||
sourceComponent: {
|
sourceComponent: {
|
||||||
|
|
Loading…
Reference in New Issue