From 0f07ea09da5c65ea037825772d757cfe1a152fdb Mon Sep 17 00:00:00 2001 From: Alex Jbanca Date: Wed, 1 Nov 2023 13:19:18 +0200 Subject: [PATCH] fix(LinkPreviews): Left align the message link preview tight corner --- storybook/pages/LinksMessageViewPage.qml | 9 --------- ui/StatusQ/src/StatusQ/Components/StatusMessage.qml | 4 ++-- .../controls/delegates/LinkPreviewCardDelegate.qml | 3 --- .../shared/controls/delegates/LinkPreviewGifDelegate.qml | 3 --- ui/imports/shared/status/StatusChatImageLoader.qml | 6 +++--- ui/imports/shared/views/chat/LinksMessageView.qml | 4 ---- ui/imports/shared/views/chat/MessageView.qml | 1 - 7 files changed, 5 insertions(+), 25 deletions(-) diff --git a/storybook/pages/LinksMessageViewPage.qml b/storybook/pages/LinksMessageViewPage.qml index 708594e87d..cf5c540548 100644 --- a/storybook/pages/LinksMessageViewPage.qml +++ b/storybook/pages/LinksMessageViewPage.qml @@ -27,7 +27,6 @@ SplitView { playAnimations: true linkPreviewModel: mockedLinkPreviewModel gifLinks: [ "https://media.tenor.com/qN_ytiwLh24AAAAC/cold.gif" ] - isCurrentUser: true gifUnfurlingEnabled: false canAskToUnfurlGifs: true @@ -44,14 +43,6 @@ SplitView { ColumnLayout { spacing: 25 ColumnLayout { - Label { - text: qsTr("Sender") - } - CheckBox { - text: qsTr("Current user") - checked: linksMessageView.isCurrentUser - onToggled: linksMessageView.isCurrentUser = !linksMessageView.isCurrentUser - } Label { text: qsTr("GIF unfuring settings") } diff --git a/ui/StatusQ/src/StatusQ/Components/StatusMessage.qml b/ui/StatusQ/src/StatusQ/Components/StatusMessage.qml index 847c138152..82cb3bc7ee 100644 --- a/ui/StatusQ/src/StatusQ/Components/StatusMessage.qml +++ b/ui/StatusQ/src/StatusQ/Components/StatusMessage.qml @@ -315,7 +315,7 @@ Control { album: root.messageDetails.albumCount > 0 ? root.messageDetails.album : [root.messageDetails.messageContent] albumCount: root.messageDetails.albumCount > 0 ? root.messageDetails.albumCount : 1 imageWidth: Math.min(messageLayout.width / root.messageDetails.albumCount - 9 * (root.messageDetails.albumCount - 1), 144) - shapeType: root.messageDetails.amISender ? StatusImageMessage.ShapeType.RIGHT_ROUNDED : StatusImageMessage.ShapeType.LEFT_ROUNDED + shapeType: StatusImageMessage.ShapeType.LEFT_ROUNDED onImageClicked: root.imageClicked(image, mouse, imageSource) } } @@ -333,7 +333,7 @@ Control { delegate: StatusImageMessage { source: model.source onClicked: root.imageClicked(image, mouse, imageSource) - shapeType: root.messageDetails.amISender ? StatusImageMessage.ShapeType.RIGHT_ROUNDED : StatusImageMessage.ShapeType.LEFT_ROUNDED + shapeType: StatusImageMessage.ShapeType.LEFT_ROUNDED } } } diff --git a/ui/imports/shared/controls/delegates/LinkPreviewCardDelegate.qml b/ui/imports/shared/controls/delegates/LinkPreviewCardDelegate.qml index b0af202721..9252036be9 100644 --- a/ui/imports/shared/controls/delegates/LinkPreviewCardDelegate.qml +++ b/ui/imports/shared/controls/delegates/LinkPreviewCardDelegate.qml @@ -48,9 +48,6 @@ LinkPreviewCard { required property var statusCommunityChannelCommunityPreviewBanner //View properties - property bool isCurrentUser: false - - leftTail: !isCurrentUser type: root.previewType linkData { title: standardPreview ? standardPreview.title : "" diff --git a/ui/imports/shared/controls/delegates/LinkPreviewGifDelegate.qml b/ui/imports/shared/controls/delegates/LinkPreviewGifDelegate.qml index c6326f8f0d..a0dfec6523 100644 --- a/ui/imports/shared/controls/delegates/LinkPreviewGifDelegate.qml +++ b/ui/imports/shared/controls/delegates/LinkPreviewGifDelegate.qml @@ -13,7 +13,6 @@ CalloutCard { required property string link required property bool playAnimation required property bool isOnline - required property bool isCurrentUser readonly property bool isPlaying: linkImage.playing readonly property alias imageAlias: linkImage.imageAlias @@ -23,7 +22,6 @@ CalloutCard { implicitWidth: linkImage.width implicitHeight: linkImage.height - leftTail: !isCurrentUser StatusChatImageLoader { id: linkImage @@ -34,7 +32,6 @@ CalloutCard { anchors.centerIn: parent source: root.link imageWidth: 300 - isCurrentUser: root.isCurrentUser playing: root.playAnimation && localAnimationEnabled isOnline: root.isOnline asynchronous: true diff --git a/ui/imports/shared/status/StatusChatImageLoader.qml b/ui/imports/shared/status/StatusChatImageLoader.qml index 2367630751..2af3f66705 100644 --- a/ui/imports/shared/status/StatusChatImageLoader.qml +++ b/ui/imports/shared/status/StatusChatImageLoader.qml @@ -10,7 +10,6 @@ Item { property int verticalPadding: 0 property int imageWidth: 350 - property bool isCurrentUser: false property url source property bool isActiveChannel: false property bool playing: Global.applicationWindow.active @@ -20,6 +19,7 @@ Item { property bool isOnline: true // TODO: mark as required when migrating to 5.15 or above property bool imageLoaded: (imageMessage.status === Image.Ready) property alias asynchronous: imageMessage.asynchronous + property bool leftTail: true signal clicked(var image, var mouse) @@ -90,7 +90,7 @@ Item { width: 32 height: 32 radius: 4 - visible: !root.isCurrentUser && !allCornersRounded + visible: root.leftTail && !allCornersRounded } Rectangle { anchors.bottom: parent.bottom @@ -98,7 +98,7 @@ Item { width: 32 height: 32 radius: 4 - visible: root.isCurrentUser && !allCornersRounded + visible: !root.leftTail && !allCornersRounded } } } diff --git a/ui/imports/shared/views/chat/LinksMessageView.qml b/ui/imports/shared/views/chat/LinksMessageView.qml index 2e74edbdd4..cbd9e24bc1 100644 --- a/ui/imports/shared/views/chat/LinksMessageView.qml +++ b/ui/imports/shared/views/chat/LinksMessageView.qml @@ -22,8 +22,6 @@ Flow { required property var linkPreviewModel required property var gifLinks - required property bool isCurrentUser - required property bool gifUnfurlingEnabled required property bool canAskToUnfurlGifs @@ -65,7 +63,6 @@ Flow { link: modelData isOnline: root.isOnline - isCurrentUser: root.isCurrentUser playAnimation: root.playAnimations onClicked: root.imageClicked(imageAlias, mouse, link, link) } @@ -79,7 +76,6 @@ Flow { model: root.linkPreviewModel delegate: LinkPreviewCardDelegate { id: delegate - isCurrentUser: root.isCurrentUser highlight: url === root.highlightLink onHoveredChanged: { linksRepeater.hoveredUrl = hovered ? url : "" diff --git a/ui/imports/shared/views/chat/MessageView.qml b/ui/imports/shared/views/chat/MessageView.qml index 870a34a0ad..587322c126 100644 --- a/ui/imports/shared/views/chat/MessageView.qml +++ b/ui/imports/shared/views/chat/MessageView.qml @@ -758,7 +758,6 @@ Loader { gifLinks: root.gifLinks playAnimations: root.messageStore.playAnimation isOnline: root.rootStore.mainModuleInst.isOnline - isCurrentUser: root.amISender highlightLink: delegate.hoveredLink onImageClicked: (image, mouse, imageSource, url) => { d.onImageClicked(image, mouse, imageSource, url)