fix read background to only cover the message and fix hidden text

This commit is contained in:
Jonathan Rainville 2021-06-14 11:40:05 -04:00
parent 93b4c29060
commit 1ecb636f58
4 changed files with 88 additions and 68 deletions

View File

@ -152,7 +152,7 @@ Popup {
Component {
id: messageNotificationComponent
Rectangle {
Item {
visible: {
if (hideReadNotifications && model.read) {
return false
@ -163,8 +163,35 @@ Popup {
(model.notificationType === Constants.activityCenterNotificationTypeReply && activityCenter.currentFilter === ActivityCenter.Filter.Replies)
}
width: parent.width
height: childrenRect.height + Style.current.smallPadding
color: model.read ? Style.current.transparent : Utils.setColorAlpha(Style.current.blue, 0.1)
height: messageNotificationContent.height
StatusIconButton {
id: markReadBtn
icon.name: "double-check"
iconColor: Style.current.primary
icon.width: 24
icon.height: 24
width: 32
height: 32
onClicked: chatsModel.activityNotificationList.markActivityCenterNotificationRead(model.id)
anchors.right: parent.right
anchors.rightMargin: 12
anchors.verticalCenter: messageNotificationContent.verticalCenter
z: 52
StatusToolTip {
visible: markReadBtn.hovered
text: qsTr("Mark as Read")
orientation: "left"
x: - width - Style.current.padding
y: markReadBtn.height / 2 - height / 2 + 4
}
}
Item {
id: messageNotificationContent
width: parent.width
height: childrenRect.height
Message {
id: notificationMessage
@ -192,6 +219,7 @@ Popup {
pinnedBy: model.message.pinnedBy
pinnedMessage: model.message.isPinned
activityCenterMessage: true
read: model.read
clickMessage: function (isProfileClick) {
if (isProfileClick) {
const pk = model.message.fromAuthor
@ -219,29 +247,6 @@ Popup {
prevMsgTimestamp: notificationDelegate.idx === 0 ? "" : chatsModel.activityNotificationList.getNotificationData(prevMessageIndex, "timestamp")
}
StatusIconButton {
id: markReadBtn
icon.name: "double-check"
iconColor: Style.current.primary
icon.width: 24
icon.height: 24
width: 32
height: 32
onClicked: chatsModel.activityNotificationList.markActivityCenterNotificationRead(model.id)
anchors.right: parent.right
anchors.rightMargin: 12
anchors.verticalCenter: notificationMessage.verticalCenter
z: 52
StatusToolTip {
visible: markReadBtn.hovered
text: qsTr("Mark as Read")
orientation: "left"
x: - width - Style.current.padding
y: markReadBtn.height / 2 - height / 2 + 4
}
}
ActivityChannelBadge {
id: badge
name: model.name
@ -252,6 +257,16 @@ Popup {
anchors.left: parent.left
anchors.leftMargin: 61 // TODO find a way to align with the text of the message
}
Rectangle {
anchors.top: notificationMessage.bottom
anchors.bottom: badge.bottom
anchors.bottomMargin: -Style.current.smallPadding
width: parent.width
color: model.read ? Style.current.transparent : Utils.setColorAlpha(Style.current.blue, 0.1)
}
}
}
}
}

View File

@ -31,6 +31,7 @@ Item {
property bool placeholderMessage: false
property bool activityCenterMessage: false
property bool pinnedMessage: false
property bool read: true
property string pinnedBy
property bool forceHoverHandler: false // Used to force the HoverHandler to be active (useful for messages in popups)
property string communityId: ""

View File

@ -41,7 +41,7 @@ Item {
selectByMouse: true
color: Style.current.textColor
height: root.veryLongChatText && !root.readMore ? Math.min(implicitHeight, 200) : implicitHeight
clip: true
clip: height < implicitHeight
onLinkActivated: function (link) {
if(link.startsWith("#")) {
const channelName = link.substring(1);

View File

@ -76,7 +76,11 @@ Item {
width: parent.width
color: {
if (placeholderMessage || activityCenterMessage) {
if (activityCenterMessage) {
return read ? Style.current.transparent : Utils.setColorAlpha(Style.current.blue, 0.1)
}
if (placeholderMessage) {
return Style.current.transparent
}