feat(ActivityCenter): Add ReplyBadge & review fixes

Close 7276
This commit is contained in:
MishkaRogachev 2022-09-23 17:14:31 +03:00 committed by Mikhail Rogachev
parent b9ca8654a8
commit ac9d68b6f5
8 changed files with 44 additions and 22 deletions

View File

@ -381,7 +381,7 @@ QtObject {
return obj return obj
} }
catch (e) { catch (e) {
console.debug("error parsing community by id: ", id, " error: ", e.message) console.warn("error parsing community by id: ", id, " error: ", e.message)
return {} return {}
} }
} }

View File

@ -1,5 +1,4 @@
import QtQuick 2.14 import QtQuick 2.14
import QtQuick.Layouts 1.14
import utils 1.0 import utils 1.0
@ -10,7 +9,7 @@ Rectangle {
id: root id: root
height: visible ? 24 : 0 height: visible ? 24 : 0
width: childrenRect.width + Style.current.smallPadding width: childrenRect.width + Style.current.smallPadding * 2
radius: height / 2 radius: height / 2
border.width: 1 border.width: 1
border.color: Style.current.borderSecondary border.color: Style.current.borderSecondary

View File

@ -21,9 +21,19 @@ Badge {
signal communityNameClicked() signal communityNameClicked()
signal channelNameClicked() signal channelNameClicked()
SVGImage {
id: communityIcon
anchors.left: parent.left
anchors.leftMargin: Style.current.smallPadding
anchors.verticalCenter:parent.verticalCenter
width: 16
height: 16
source: Style.svg("communities")
}
StatusSmartIdenticon { StatusSmartIdenticon {
id: identicon id: identicon
anchors.left: parent.left anchors.left: communityIcon.right
anchors.leftMargin: Style.current.smallPadding anchors.leftMargin: Style.current.smallPadding
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
name: root.communityName name: root.communityName

View File

@ -9,33 +9,43 @@ import shared.panels 1.0
import StatusQ.Core.Utils 0.1 as StatusQUtils import StatusQ.Core.Utils 0.1 as StatusQUtils
Item { Badge {
id: replyComponent id: root
property string repliedMessageContent property string repliedMessageContent
signal replyClicked()
SVGImage { SVGImage {
id: replyIcon id: replyIcon
width: 16
height: 16
source: Style.svg("reply-small-arrow")
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: Style.current.smallPadding
anchors.verticalCenter:parent.verticalCenter anchors.verticalCenter:parent.verticalCenter
width: 16
height: width
source: Style.svg("reply-small-arrow")
MouseArea {
id: arrowArea
hoverEnabled: true
anchors.fill: parent
onClicked: root.replyClicked()
}
} }
StyledTextEdit { StyledTextEdit {
text: Utils.getReplyMessageStyle(StatusQUtils.Emoji.parse(StatusQUtils.Utils.linkifyAndXSS(repliedMessageContent), StatusQUtils.Emoji.size.small), false) id: communityNameText
textFormat: Text.RichText
height: 18
width: implicitWidth > 300 ? 300 : implicitWidth width: implicitWidth > 300 ? 300 : implicitWidth
clip: true height: 18
anchors.left: replyIcon.right anchors.left: replyIcon.right
anchors.leftMargin: 4 anchors.leftMargin: 4
color: Style.current.secondaryText
font.weight: Font.Medium
font.pixelSize: 13
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
selectByMouse: true text: Utils.getReplyMessageStyle(StatusQUtils.Emoji.parse(StatusQUtils.Utils.linkifyAndXSS(repliedMessageContent),
StatusQUtils.Emoji.size.small), false)
readOnly: true readOnly: true
textFormat: Text.RichText
clip: true
color: root.communityColor
font.pixelSize: 13
} }
} }

View File

@ -1,3 +1,3 @@
ChannelBadge 1.0 ChannelBadge.qml ChannelBadge 1.0 ChannelBadge.qml
CommunityBadge 1.0 CommunityBadge.qml CommunityBadge 1.0 CommunityBadge.qml
ReplyComponent 1.0 ReplyComponent.qml ReplyBadge 1.0 ReplyBadge.qml

View File

@ -7,7 +7,6 @@ import StatusQ.Components 0.1
import shared 1.0 import shared 1.0
import utils 1.0 import utils 1.0
import shared.panels.chat 1.0
import "../controls" import "../controls"

View File

@ -29,7 +29,6 @@ ActivityNotificationBase {
messageId: notification.id messageId: notification.id
senderDisplayName: notification.message.senderDisplayName senderDisplayName: notification.message.senderDisplayName
messageText: notification.message.messageText messageText: notification.message.messageText
responseToMessageWithId: notification.message.responseToMessageWithId
senderId: notification.message.senderId senderId: notification.message.senderId
senderOptionalName: notification.message.senderOptionalName senderOptionalName: notification.message.senderOptionalName
senderIcon: notification.message.senderIcon senderIcon: notification.message.senderIcon

View File

@ -7,11 +7,16 @@ import StatusQ.Components 0.1
import shared 1.0 import shared 1.0
import utils 1.0 import utils 1.0
import shared.panels.chat 1.0
import "../controls"
ActivityNotificationMessage { ActivityNotificationMessage {
id: root id: root
badgeComponent: ReplyBadge {
repliedMessageContent: notification.repliedMessage.messageText
onReplyClicked: root.store.activityCenterModuleInst.switchTo(notification.sectionId, notification.chatId, notification.id)
}
// repliedMessageContent: notification.repliedMessage.messageText // repliedMessageContent: notification.repliedMessage.messageText
// repliedMessageId: notification.message.responseToMessageWithId // repliedMessageId: notification.message.responseToMessageWithId
} }