summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2023-08-14 01:11:27 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2023-08-25 19:03:16 +0200
commitaef0cb988438a125802c90ee41032c13ef6f8fec (patch)
tree03494b474327739ed6a01b5b482a3bcf76c060e2
parentRemaining events apart from verification (diff)
downloadnheko-aef0cb988438a125802c90ee41032c13ef6f8fec.tar.xz
Show reactions again
-rw-r--r--resources/qml/MessageView.qml40
1 files changed, 38 insertions, 2 deletions
diff --git a/resources/qml/MessageView.qml b/resources/qml/MessageView.qml
index 2f50789f..976312f2 100644
--- a/resources/qml/MessageView.qml
+++ b/resources/qml/MessageView.qml
@@ -63,7 +63,7 @@ Item {
             id: wrapper
             ListView.delayRemove: true
             width: chat.delegateMaxWidth
-            height: Math.max((section.item?.height ?? 0) + gridContainer.implicitHeight, 10)
+            height: Math.max((section.item?.height ?? 0) + gridContainer.implicitHeight + reactionRow.implicitHeight + unreadRow.height, 10)
             anchors.horizontalCenter: ListView.view.contentItem.horizontalCenter
             //room: chatRoot.roommodel
 
@@ -81,6 +81,10 @@ Item {
             required property string userId
             required property string userName
             required property string threadId
+            required property int userPowerlevel
+            required property var reactions
+
+            property int avatarMargin: (wrapper.isStateEvent || Settings.smallAvatars ? 0 : (Nheko.avatarSize + 8)) + (wrapper.threadId ? 6 : 0) // align bubble with section header
 
             data: [
             Loader {
@@ -96,6 +100,7 @@ Item {
                 property date timestamp: wrapper.timestamp
                 property string userId: wrapper.userId
                 property string userName: wrapper.userName
+                property string userPowerlevel: wrapper.userPowerlevel
 
                 active: previousMessageUserId !== userId || previousMessageDay !== day || previousMessageIsStateEvent !== isStateEvent
                 //asynchronous: true
@@ -112,7 +117,7 @@ Item {
                     ColumnLayout {
                         id: contentColumn
                         Layout.fillWidth: true
-                        Layout.leftMargin: (wrapper.isStateEvent || Settings.smallAvatars ? 0 : (Nheko.avatarSize + 8)) + (wrapper.threadId ? 6 : 0) // align bubble with section header
+                        Layout.leftMargin: wrapper.avatarMargin // align bubble with section header
 
                         AbstractButton {
                             id: replyRow
@@ -179,6 +184,37 @@ Item {
                     }
                 },
 
+                Reactions {
+                    id: reactionRow
+
+                    eventId: wrapper.eventId
+                    layoutDirection: row.bubbleOnRight ? Qt.RightToLeft : Qt.LeftToRight
+                    reactions: wrapper.reactions
+                    width: wrapper.width - wrapper.avatarMargin
+                    x: wrapper.avatarMargin
+
+                    anchors {
+                        //left: row.bubbleOnRight ? undefined : row.left
+                        //right: row.bubbleOnRight ? row.right : undefined
+                        top: gridContainer.bottom
+                        topMargin: -4
+                    }
+                },
+                Rectangle {
+                    id: unreadRow
+
+                    color: palette.highlight
+                    height: visible ? 3 : 0
+                    visible: (wrapper.index > 0 && (room.fullyReadEventId == wrapper.eventId))
+
+                    anchors {
+                        left: parent.left
+                        right: parent.right
+                        top: reactionRow.bottom
+                        topMargin: 5
+                    }
+                },
+
                 Rectangle {
                     width: Math.min(contentColumn.implicitWidth, contentColumn.width)
                     height: contentColumn.implicitHeight