2022-09-15 19:34:41 +03: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 16:00:35 +03:00
|
|
|
import "../controls"
|
|
|
|
|
2022-09-16 16:06:52 +03:00
|
|
|
ActivityNotificationMessage {
|
2022-09-15 19:34:41 +03:00
|
|
|
id: root
|
|
|
|
|
2022-10-28 17:25:48 +03:00
|
|
|
badgeComponent: {
|
2022-11-30 15:15:29 +04:00
|
|
|
if (!notification)
|
|
|
|
return null
|
|
|
|
|
2022-10-28 17:25:48 +03:00
|
|
|
switch (notification.chatType)
|
|
|
|
{
|
|
|
|
case Constants.chatType.communityChat:
|
|
|
|
return communityBadgeComponent
|
|
|
|
case Constants.chatType.privateGroupChat:
|
|
|
|
return groupChatBadgeComponent
|
|
|
|
default:
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
}
|
2022-09-21 16:00:35 +03:00
|
|
|
|
|
|
|
Component {
|
|
|
|
id: communityBadgeComponent
|
|
|
|
|
|
|
|
CommunityBadge {
|
|
|
|
id: communityBadge
|
|
|
|
|
2022-09-22 19:35:18 +03:00
|
|
|
property var community: root.store.getCommunityDetailsAsJson(notification.message.communityId)
|
2022-10-28 17:25:48 +03:00
|
|
|
property var channel: root.store.getChatDetails(notification.chatId)
|
2022-09-22 19:35:18 +03:00
|
|
|
|
|
|
|
communityName: community.name
|
|
|
|
communityImage: community.image
|
|
|
|
communityColor: community.color
|
2022-10-28 17:25:48 +03:00
|
|
|
channelName: channel.name
|
2022-09-21 16:00:35 +03:00
|
|
|
|
2022-09-22 19:35:18 +03:00
|
|
|
onCommunityNameClicked: {
|
|
|
|
root.store.setActiveCommunity(notification.message.communityId)
|
2022-11-16 21:17:38 +04:00
|
|
|
root.closeActivityCenter()
|
2022-09-22 19:35:18 +03:00
|
|
|
}
|
|
|
|
onChannelNameClicked: {
|
2022-10-26 20:00:20 +04:00
|
|
|
root.activityCenterStore.switchTo(notification)
|
2022-11-16 21:17:38 +04:00
|
|
|
root.closeActivityCenter()
|
2022-09-22 19:35:18 +03:00
|
|
|
}
|
2022-09-21 16:00:35 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: groupChatBadgeComponent
|
|
|
|
|
|
|
|
ChannelBadge {
|
2022-10-28 17:25:48 +03: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 11:17:35 +04:00
|
|
|
|
|
|
|
onChannelNameClicked: {
|
|
|
|
root.activityCenterStore.switchTo(notification)
|
2022-11-16 21:17:38 +04:00
|
|
|
root.closeActivityCenter()
|
2022-10-29 11:17:35 +04:00
|
|
|
}
|
2022-09-21 16:00:35 +03:00
|
|
|
}
|
|
|
|
}
|
2022-11-23 01:01:30 +03:00
|
|
|
|
|
|
|
onMessageClicked: {
|
|
|
|
root.activityCenterStore.switchTo(notification)
|
|
|
|
root.closeActivityCenter()
|
|
|
|
}
|
2022-10-28 17:25:48 +03:00
|
|
|
}
|