2022-09-15 16:34:41 +00:00
|
|
|
import QtQuick 2.14
|
|
|
|
import QtQuick.Layouts 1.14
|
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
|
|
|
|
import shared 1.0
|
|
|
|
import utils 1.0
|
|
|
|
|
2022-09-21 13:00:35 +00:00
|
|
|
import "../controls"
|
|
|
|
|
2022-09-16 13:06:52 +00:00
|
|
|
ActivityNotificationMessage {
|
2022-09-15 16:34:41 +00:00
|
|
|
id: root
|
|
|
|
|
2022-10-28 14:25:48 +00:00
|
|
|
badgeComponent: {
|
2022-11-30 11:15:29 +00:00
|
|
|
if (!notification)
|
|
|
|
return null
|
|
|
|
|
2022-10-28 14:25:48 +00:00
|
|
|
switch (notification.chatType)
|
|
|
|
{
|
|
|
|
case Constants.chatType.communityChat:
|
|
|
|
return communityBadgeComponent
|
|
|
|
case Constants.chatType.privateGroupChat:
|
|
|
|
return groupChatBadgeComponent
|
|
|
|
default:
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
}
|
2022-09-21 13:00:35 +00:00
|
|
|
|
|
|
|
Component {
|
|
|
|
id: communityBadgeComponent
|
|
|
|
|
|
|
|
CommunityBadge {
|
|
|
|
id: communityBadge
|
|
|
|
|
2022-09-22 16:35:18 +00:00
|
|
|
property var community: root.store.getCommunityDetailsAsJson(notification.message.communityId)
|
2022-10-28 14:25:48 +00:00
|
|
|
property var channel: root.store.getChatDetails(notification.chatId)
|
2022-09-22 16:35:18 +00:00
|
|
|
|
|
|
|
communityName: community.name
|
|
|
|
communityImage: community.image
|
|
|
|
communityColor: community.color
|
2022-10-28 14:25:48 +00:00
|
|
|
channelName: channel.name
|
2022-09-21 13:00:35 +00:00
|
|
|
|
2022-09-22 16:35:18 +00:00
|
|
|
onCommunityNameClicked: {
|
|
|
|
root.store.setActiveCommunity(notification.message.communityId)
|
2022-11-16 17:17:38 +00:00
|
|
|
root.closeActivityCenter()
|
2022-09-22 16:35:18 +00:00
|
|
|
}
|
|
|
|
onChannelNameClicked: {
|
2022-10-26 16:00:20 +00:00
|
|
|
root.activityCenterStore.switchTo(notification)
|
2022-11-16 17:17:38 +00:00
|
|
|
root.closeActivityCenter()
|
2022-09-22 16:35:18 +00:00
|
|
|
}
|
2022-09-21 13:00:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: groupChatBadgeComponent
|
|
|
|
|
|
|
|
ChannelBadge {
|
2022-10-28 14:25:48 +00:00
|
|
|
property var group: root.store.getChatDetails(notification.chatId)
|
|
|
|
|
|
|
|
chatType: notification.chatType
|
|
|
|
name: group.name
|
|
|
|
asset.isImage: asset.name != ""
|
|
|
|
asset.name: group.icon
|
|
|
|
asset.emoji: group.emoji
|
|
|
|
asset.color: group.color
|
2022-10-29 07:17:35 +00:00
|
|
|
|
|
|
|
onChannelNameClicked: {
|
|
|
|
root.activityCenterStore.switchTo(notification)
|
2022-11-16 17:17:38 +00:00
|
|
|
root.closeActivityCenter()
|
2022-10-29 07:17:35 +00:00
|
|
|
}
|
2022-09-21 13:00:35 +00:00
|
|
|
}
|
|
|
|
}
|
2022-11-22 22:01:30 +00:00
|
|
|
|
|
|
|
onMessageClicked: {
|
|
|
|
root.activityCenterStore.switchTo(notification)
|
|
|
|
root.closeActivityCenter()
|
|
|
|
}
|
2022-10-28 14:25:48 +00:00
|
|
|
}
|