fix(messagesView): Increase spacing between chat messages
Added padding between messages as specified in Figma: topPadding - 8 if the current message has header, 2 otherwise bottomPadding - 8 if both current and next message have header, 2 otherwise
This commit is contained in:
parent
e378cb4fd9
commit
94b911a986
|
@ -117,14 +117,6 @@ Control {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
implicitWidth: messageLayout.implicitWidth
|
|
||||||
+ messageLayout.anchors.leftMargin
|
|
||||||
+ messageLayout.anchors.rightMargin
|
|
||||||
|
|
||||||
implicitHeight: messageLayout.implicitHeight
|
|
||||||
+ messageLayout.anchors.topMargin
|
|
||||||
+ messageLayout.anchors.bottomMargin
|
|
||||||
|
|
||||||
hoverEnabled: (!root.isActiveMessage && !root.disableHover)
|
hoverEnabled: (!root.isActiveMessage && !root.disableHover)
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
color: {
|
color: {
|
||||||
|
@ -151,6 +143,10 @@ Control {
|
||||||
}
|
}
|
||||||
|
|
||||||
contentItem: Item {
|
contentItem: Item {
|
||||||
|
|
||||||
|
implicitWidth: messageLayout.implicitWidth
|
||||||
|
implicitHeight: messageLayout.implicitHeight
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors {
|
anchors {
|
||||||
top: parent.top
|
top: parent.top
|
||||||
|
@ -212,8 +208,6 @@ Control {
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: messageLayout
|
id: messageLayout
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.topMargin: 2
|
|
||||||
anchors.bottomMargin: 2
|
|
||||||
spacing: 2
|
spacing: 2
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
|
|
|
@ -91,7 +91,7 @@ Loader {
|
||||||
property double prevMsgTimestamp: prevMessageAsJsonObj ? prevMessageAsJsonObj.timestamp : 0
|
property double prevMsgTimestamp: prevMessageAsJsonObj ? prevMessageAsJsonObj.timestamp : 0
|
||||||
property double nextMsgTimestamp: nextMessageAsJsonObj ? nextMessageAsJsonObj.timestamp : 0
|
property double nextMsgTimestamp: nextMessageAsJsonObj ? nextMessageAsJsonObj.timestamp : 0
|
||||||
|
|
||||||
property bool shouldRepeatHeader: ((messageTimestamp - prevMsgTimestamp) / 60 / 1000) > Constants.repeatHeaderInterval || isExpired
|
property bool shouldRepeatHeader: d.getShouldRepeatHeader(messageTimestamp, prevMsgTimestamp, messageOutgoingStatus)
|
||||||
|
|
||||||
property bool hasMention: false
|
property bool hasMention: false
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ Loader {
|
||||||
property bool isMessage: isEmoji || isImage || isSticker || isText || isAudio
|
property bool isMessage: isEmoji || isImage || isSticker || isText || isAudio
|
||||||
|| messageContentType === Constants.messageContentType.communityInviteType || messageContentType === Constants.messageContentType.transactionType
|
|| messageContentType === Constants.messageContentType.communityInviteType || messageContentType === Constants.messageContentType.transactionType
|
||||||
|
|
||||||
readonly property bool isExpired: (messageOutgoingStatus === Constants.sending && (Math.floor(messageTimestamp) + 180000) < Date.now()) || messageOutgoingStatus === Constants.expired
|
readonly property bool isExpired: d.getIsExpired(messageOutgoingStatus, messageTimestamp)
|
||||||
readonly property bool isSending: messageOutgoingStatus === Constants.sending && !isExpired
|
readonly property bool isSending: messageOutgoingStatus === Constants.sending && !isExpired
|
||||||
property int statusAgeEpoch: 0
|
property int statusAgeEpoch: 0
|
||||||
|
|
||||||
|
@ -182,7 +182,6 @@ Loader {
|
||||||
}
|
}
|
||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
signal openStickerPackPopup(string stickerPackId)
|
signal openStickerPackPopup(string stickerPackId)
|
||||||
// Not Refactored Yet
|
// Not Refactored Yet
|
||||||
// Connections {
|
// Connections {
|
||||||
|
@ -269,6 +268,15 @@ Loader {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getShouldRepeatHeader(messageTimeStamp, prevMessageTimeStamp, messageOutgoingStatus) {
|
||||||
|
return ((messageTimeStamp - prevMessageTimeStamp) / 60 / 1000) > Constants.repeatHeaderInterval
|
||||||
|
|| d.getIsExpired(messageTimeStamp, messageOutgoingStatus)
|
||||||
|
}
|
||||||
|
|
||||||
|
function getIsExpired(messageTimeStamp, messageOutgoingStatus) {
|
||||||
|
return (messageOutgoingStatus === Constants.sending && (Math.floor(messageTimeStamp) + 180000) < Date.now()) || messageOutgoingStatus === Constants.expired
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onLinkUrlsChanged: {
|
onLinkUrlsChanged: {
|
||||||
|
@ -463,6 +471,15 @@ Loader {
|
||||||
root.messageStore.editMessage(root.messageId, root.messageContentType, interpretedMessage)
|
root.messageStore.editMessage(root.messageId, root.messageContentType, interpretedMessage)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function nextMessageHasHeader() {
|
||||||
|
if(!root.nextMessageAsJsonObj) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return root.senderId !== root.nextMessageAsJsonObj.senderId ||
|
||||||
|
d.getShouldRepeatHeader(root.nextMessageAsJsonObj.timeStamp, root.messageTimestamp, root.nextMessageAsJsonObj.outgoingStatus) ||
|
||||||
|
root.nextMessageAsJsonObj.responseToMessageWithId !== ""
|
||||||
|
}
|
||||||
|
|
||||||
audioMessageInfoText: qsTr("Audio Message")
|
audioMessageInfoText: qsTr("Audio Message")
|
||||||
cancelButtonText: qsTr("Cancel")
|
cancelButtonText: qsTr("Cancel")
|
||||||
saveButtonText: qsTr("Save")
|
saveButtonText: qsTr("Save")
|
||||||
|
@ -500,7 +517,8 @@ Loader {
|
||||||
showHeader: root.senderId !== root.authorPrevMsg ||
|
showHeader: root.senderId !== root.authorPrevMsg ||
|
||||||
root.shouldRepeatHeader || dateGroupLabel.visible || isAReply
|
root.shouldRepeatHeader || dateGroupLabel.visible || isAReply
|
||||||
isActiveMessage: d.isMessageActive
|
isActiveMessage: d.isMessageActive
|
||||||
|
topPadding: showHeader ? Style.current.halfPadding : 2
|
||||||
|
bottomPadding: showHeader && nextMessageHasHeader() ? Style.current.halfPadding : 2
|
||||||
disableHover: root.disableHover ||
|
disableHover: root.disableHover ||
|
||||||
(root.chatLogView && root.chatLogView.flickingVertically) ||
|
(root.chatLogView && root.chatLogView.flickingVertically) ||
|
||||||
activityCenterMessage ||
|
activityCenterMessage ||
|
||||||
|
|
Loading…
Reference in New Issue