fix(CompactChat): fix margins for images and invites

Fixes #2407
This commit is contained in:
Jonathan Rainville 2021-04-30 10:45:13 -04:00 committed by Iuri Matias
parent 4b3a677f4d
commit 22398284e9
3 changed files with 18 additions and 26 deletions

View File

@ -171,8 +171,6 @@ Item {
return fetchMoreMessagesButtonComponent return fetchMoreMessagesButtonComponent
case Constants.systemMessagePrivateGroupType: case Constants.systemMessagePrivateGroupType:
return privateGroupHeaderComponent return privateGroupHeaderComponent
case Constants.communityInviteType:
return invitationBubble
default: default:
return isStatusUpdate ? statusUpdateComponent : return isStatusUpdate ? statusUpdateComponent :
(appSettings.useCompactMode ? compactMessageComponent : messageComponent) (appSettings.useCompactMode ? compactMessageComponent : messageComponent)
@ -302,15 +300,6 @@ Item {
container: root container: root
} }
} }
Component {
id: invitationBubble
InvitationBubble {
communityId: root.communityId
anchors.right: !appSettings.useCompactMode && isCurrentUser ? parent.right : undefined
anchors.rightMargin: Style.current.padding
}
}
} }
/*##^## /*##^##

View File

@ -62,8 +62,9 @@ Item {
anchors.top: dateGroupLbl.visible ? dateGroupLbl.bottom : parent.top anchors.top: dateGroupLbl.visible ? dateGroupLbl.bottom : parent.top
anchors.topMargin: dateGroupLbl.visible ? Style.current.padding : 0 anchors.topMargin: dateGroupLbl.visible ? Style.current.padding : 0
height: childrenRect.height height: childrenRect.height
+ (chatName.visible || emojiReactionLoader.active ? Style.current.smallPadding : 0) + (chatName.visible || emojiReactionLoader.active ? Style.current.halfPadding : 0)
+ (chatName.visible && emojiReactionLoader.active ? Style.current.padding : 0) + (chatName.visible && emojiReactionLoader.active ? Style.current.padding : 0)
+ (!chatName.visible && chatImageContent.active ? 6 : 0)
+ (emojiReactionLoader.active ? emojiReactionLoader.height: 0) + (emojiReactionLoader.active ? emojiReactionLoader.height: 0)
+ (retry.visible && !chatTime.visible ? Style.current.smallPadding : 0) + (retry.visible && !chatTime.visible ? Style.current.smallPadding : 0)
width: parent.width width: parent.width
@ -134,6 +135,7 @@ Item {
id: chatImageContent id: chatImageContent
active: isImage active: isImage
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: active ? 6 : 0
z: 51 z: 51
sourceComponent: Component { sourceComponent: Component {
@ -216,6 +218,19 @@ Item {
TransactionBubble {} TransactionBubble {}
} }
} }
Loader {
active: contentType === Constants.communityInviteType
anchors.left: parent.left
anchors.top: parent.top
anchors.topMargin: active ? 8 : 0
sourceComponent: Component {
id: invitationBubble
InvitationBubble {
communityId: container.communityId
}
}
}
} }
@ -253,7 +268,7 @@ Item {
id: emojiReactionLoader id: emojiReactionLoader
active: emojiReactionsModel.length active: emojiReactionsModel.length
anchors.bottom: messageContainer.bottom anchors.bottom: messageContainer.bottom
anchors.bottomMargin: Style.current.smallPadding anchors.bottomMargin: Style.current.halfPadding
anchors.left: messageContainer.left anchors.left: messageContainer.left
anchors.leftMargin: messageContainer.chatText.textField.leftPadding anchors.leftMargin: messageContainer.chatText.textField.leftPadding

View File

@ -15,7 +15,7 @@ Item {
id: root id: root
anchors.left: parent.left anchors.left: parent.left
height: childrenRect.height height: childrenRect.height
width: rectangleBubbleLoader.width + chatImage.width width: rectangleBubbleLoader.width
Component.onCompleted: { Component.onCompleted: {
chatsModel.communities.setObservedCommunity(root.communityId) chatsModel.communities.setObservedCommunity(root.communityId)
@ -23,23 +23,11 @@ Item {
root.invitedCommunity = chatsModel.communities.observedCommunity root.invitedCommunity = chatsModel.communities.observedCommunity
} }
UserImage {
id: chatImage
visible: (!isLink && authorCurrentMsg !== authorPrevMsg && !isCurrentUser) ||
(appSettings.useCompactMode && isCurrentUser && authorCurrentMsg !== authorPrevMsg)
anchors.left: parent.left
anchors.leftMargin: visible ? Style.current.padding : 0
anchors.top: parent.top
}
Loader { Loader {
id: rectangleBubbleLoader id: rectangleBubbleLoader
active: !!invitedCommunity active: !!invitedCommunity
width: item.width width: item.width
height: item.height height: item.height
anchors.left: !isLink && (!isCurrentUser || (isCurrentUser === appSettings.useCompactMode)) ? chatImage.right : undefined
anchors.leftMargin: isLink ? 0 : Style.current.smallPadding
anchors.right: !appSettings.useCompactMode && isCurrentUser ? parent.right : undefined
sourceComponent: Component { sourceComponent: Component {
Rectangle { Rectangle {