2021-05-28 17:35:21 +00:00
|
|
|
import QtQuick 2.13
|
2021-06-21 15:03:40 +00:00
|
|
|
import QtGraphicalEffects 1.13
|
2021-09-28 15:04:06 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
2021-05-28 17:35:21 +00:00
|
|
|
import "../../../../../shared"
|
2021-10-14 12:14:11 +00:00
|
|
|
import "../../../../../shared/panels"
|
2021-10-14 13:27:02 +00:00
|
|
|
import "../../../../../shared/controls"
|
2021-05-28 17:35:21 +00:00
|
|
|
import "../../../../../shared/status"
|
|
|
|
import ".."
|
2021-07-07 15:58:59 +00:00
|
|
|
import "../../components"
|
2021-05-28 17:35:21 +00:00
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
property string chatId: ""
|
|
|
|
property string name: "channelName"
|
|
|
|
property string identicon
|
2021-06-11 19:50:52 +00:00
|
|
|
property string responseTo
|
2021-06-21 15:03:40 +00:00
|
|
|
property string communityId
|
2021-06-11 19:50:52 +00:00
|
|
|
property int notificationType
|
2021-06-17 22:09:00 +00:00
|
|
|
property int chatType: chatsModel.channelView.chats.getChannelType(chatId)
|
2021-05-28 17:35:21 +00:00
|
|
|
property int realChatType: {
|
|
|
|
if (chatType === Constants.chatTypeCommunity) {
|
|
|
|
// TODO add a check for private community chats once it is created
|
|
|
|
return Constants.chatTypePublic
|
|
|
|
}
|
|
|
|
return chatType
|
|
|
|
}
|
|
|
|
|
|
|
|
property string profileImage: realChatType === Constants.chatTypeOneToOne ? appMain.getProfileImage(chatId) || "" : ""
|
|
|
|
|
|
|
|
id: wrapper
|
2021-07-20 14:24:16 +00:00
|
|
|
height: visible ? 24 : 0
|
2021-06-11 19:50:52 +00:00
|
|
|
width: childrenRect.width + 12
|
2021-05-28 17:35:21 +00:00
|
|
|
color: Style.current.transparent
|
|
|
|
border.color: Style.current.borderSecondary
|
|
|
|
border.width: 1
|
|
|
|
radius: 11
|
|
|
|
|
2021-06-11 19:50:52 +00:00
|
|
|
Loader {
|
|
|
|
active: true
|
|
|
|
height: parent.height
|
2021-07-07 15:58:59 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: 4
|
2021-06-11 19:50:52 +00:00
|
|
|
sourceComponent: {
|
|
|
|
switch (model.notificationType) {
|
2021-07-07 15:58:59 +00:00
|
|
|
case Constants.activityCenterNotificationTypeMention: return communityOrChannelContentComponent
|
2021-06-11 20:34:25 +00:00
|
|
|
case Constants.activityCenterNotificationTypeReply: return replyComponent
|
2021-07-07 15:58:59 +00:00
|
|
|
default: return communityOrChannelContentComponent
|
2021-05-28 17:35:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-11 19:50:52 +00:00
|
|
|
Component {
|
|
|
|
id: replyComponent
|
2021-05-28 17:35:21 +00:00
|
|
|
|
2021-06-11 19:50:52 +00:00
|
|
|
Item {
|
2021-07-27 16:59:38 +00:00
|
|
|
property int replyMessageIndex: chatsModel.messageView.getMessageIndex(chatId, responseTo)
|
2021-06-21 19:35:32 +00:00
|
|
|
property string repliedMessageContent: replyMessageIndex > -1 ? chatsModel.messageView.getMessageData(chatId, replyMessageIndex, "message") : "";
|
2021-06-11 19:50:52 +00:00
|
|
|
|
|
|
|
|
2021-06-10 19:13:46 +00:00
|
|
|
onReplyMessageIndexChanged: {
|
|
|
|
wrapper.visible = replyMessageIndex > -1
|
|
|
|
}
|
|
|
|
|
2021-06-11 19:50:52 +00:00
|
|
|
width: childrenRect.width
|
|
|
|
height: parent.height
|
|
|
|
SVGImage {
|
|
|
|
id: replyIcon
|
|
|
|
width: 16
|
|
|
|
height: 16
|
2021-09-28 15:04:06 +00:00
|
|
|
source: Style.svg("reply-small-arrow")
|
2021-06-11 19:50:52 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.verticalCenter:parent.verticalCenter
|
|
|
|
}
|
2021-05-28 17:35:21 +00:00
|
|
|
|
2021-06-11 19:50:52 +00:00
|
|
|
StyledTextEdit {
|
|
|
|
text: Utils.getReplyMessageStyle(Emoji.parse(Utils.linkifyAndXSS(repliedMessageContent), Emoji.size.small), false, appSettings.useCompactMode)
|
|
|
|
textFormat: Text.RichText
|
|
|
|
height: 18
|
|
|
|
width: implicitWidth > 300 ? 300 : implicitWidth
|
|
|
|
clip: true
|
|
|
|
anchors.left: replyIcon.right
|
|
|
|
anchors.leftMargin: 4
|
|
|
|
color: Style.current.secondaryText
|
|
|
|
font.weight: Font.Medium
|
|
|
|
font.pixelSize: 13
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
selectByMouse: true
|
2021-06-21 15:03:40 +00:00
|
|
|
readOnly: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
2021-07-07 15:58:59 +00:00
|
|
|
id: communityOrChannelContentComponent
|
2021-06-11 19:50:52 +00:00
|
|
|
|
2021-07-07 15:58:59 +00:00
|
|
|
BadgeContent {
|
|
|
|
chatId: wrapper.chatId
|
|
|
|
name: wrapper.name
|
|
|
|
identicon: wrapper.identicon
|
|
|
|
communityId: wrapper.communityId
|
2021-06-11 19:50:52 +00:00
|
|
|
}
|
|
|
|
}
|
2021-05-28 17:35:21 +00:00
|
|
|
}
|