status-desktop/ui/app/mainui/activitycenter/views/ActivityNotificationMention...

73 lines
1.9 KiB
QML

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
import "../controls"
ActivityNotificationMessage {
id: root
badgeComponent: {
switch (notification.chatType)
{
case Constants.chatType.communityChat:
return communityBadgeComponent
case Constants.chatType.privateGroupChat:
return groupChatBadgeComponent
default:
return null
}
}
Component {
id: communityBadgeComponent
CommunityBadge {
id: communityBadge
property var community: root.store.getCommunityDetailsAsJson(notification.message.communityId)
property var channel: root.store.getChatDetails(notification.chatId)
communityName: community.name
communityImage: community.image
communityColor: community.color
channelName: channel.name
onCommunityNameClicked: {
root.store.setActiveCommunity(notification.message.communityId)
root.activityCenterClose()
}
onChannelNameClicked: {
root.activityCenterStore.switchTo(notification)
root.activityCenterClose()
}
}
}
Component {
id: groupChatBadgeComponent
ChannelBadge {
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
onChannelNameClicked: {
root.activityCenterStore.switchTo(notification)
root.activityCenterClose()
}
}
}
}