fix(@desktop/timeline): Fix timeline reaction

fixes #3251

- Being able to react in timeline chat
- Once there is a reaction, being able to remove them or add new
- Height of the message taking in consideration if there is reaction or
  not
This commit is contained in:
Anthony Laibe 2021-08-20 11:42:15 +02:00 committed by Iuri Matias
parent afa9c555ce
commit 899cb7b2f5
3 changed files with 20 additions and 12 deletions

View File

@ -427,6 +427,10 @@ Item {
statusAgeEpoch: root.statusAgeEpoch statusAgeEpoch: root.statusAgeEpoch
clickMessage: root.clickMessage clickMessage: root.clickMessage
container: root container: root
messageContextMenu: root.messageContextMenu
onAddEmoji: {
root.clickMessage(isProfileClick, isSticker, isImage , image, emojiOnly, hideEmojiPicker);
}
} }
} }

View File

@ -11,14 +11,18 @@ MouseArea {
property bool hovered: containsMouse property bool hovered: containsMouse
property var container property var container
property int statusAgeEpoch: 0 property int statusAgeEpoch: 0
property var messageContextMenu
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: 0 anchors.topMargin: 0
height: (isImage ? chatImageContent.height : chatText.height) + chatName.height + 2* Style.current.padding + (emojiReactions !== "" ? 20 : 0) height: (isImage ? chatImageContent.height : chatText.height) + chatName.height + 2* Style.current.padding + (emojiReactionsModel.length ? 20 : 0)
width: parent.width width: parent.width
hoverEnabled: true hoverEnabled: true
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
propagateComposedEvents: true propagateComposedEvents: true
signal addEmoji(bool isProfileClick, bool isSticker, bool isImage , var image, bool emojiOnly, bool hideEmojiPicker)
onClicked: { onClicked: {
mouse.accepted = false mouse.accepted = false
} }
@ -117,7 +121,7 @@ MouseArea {
Loader { Loader {
id: emojiReactionLoader id: emojiReactionLoader
active: emojiReactions !== "" active: emojiReactionsModel.length
sourceComponent: emojiReactionsComponent sourceComponent: emojiReactionsComponent
anchors.left: chatImage.right anchors.left: chatImage.right
anchors.leftMargin: Style.current.halfPadding anchors.leftMargin: Style.current.halfPadding
@ -127,7 +131,13 @@ MouseArea {
Component { Component {
id: emojiReactionsComponent id: emojiReactionsComponent
EmojiReactions {} EmojiReactions {
onAddEmojiClicked: {
root.addEmoji(false, false, false, null, true, false);
messageContextMenu.x = (chatText.textField.leftPadding + 4);
messageContextMenu.y -= (56 + Style.current.padding);
}
}
} }
Separator { Separator {

View File

@ -35,11 +35,6 @@ ScrollView {
popup.openPopup(profileModel.profile.pubKey !== fromAuthorParam, userNameParam, fromAuthorParam, identiconParam, textParam, nicknameParam); popup.openPopup(profileModel.profile.pubKey !== fromAuthorParam, userNameParam, fromAuthorParam, identiconParam, textParam, nicknameParam);
} }
MessageContextMenu {
id: messageContextMenu
}
StatusImageModal { StatusImageModal {
id: imagePopup id: imagePopup
onClicked: { onClicked: {
@ -47,10 +42,6 @@ ScrollView {
} }
} }
EmojiReactions {
id: reactionModel
}
property Component profilePopupComponent: ProfilePopup { property Component profilePopupComponent: ProfilePopup {
id: profilePopup id: profilePopup
height: 450 height: 450
@ -175,6 +166,9 @@ ScrollView {
return -1; return -1;
} }
timeout: model.timeout timeout: model.timeout
messageContextMenu: MessageContextMenu {
reactionModel: EmojiReactions { }
}
} }
} }