2020-12-11 20:29:46 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import "../../../../shared"
|
|
|
|
import "../../../../shared/status"
|
|
|
|
import "../../../../imports"
|
|
|
|
import "../components"
|
|
|
|
|
2021-02-17 16:31:59 +00:00
|
|
|
StatusIconTabButton {
|
2020-12-11 20:29:46 +00:00
|
|
|
property string communityId: ""
|
|
|
|
property string name: "channelName"
|
2021-02-22 18:53:47 +00:00
|
|
|
property int unviewedMessagesCount: 0
|
2021-02-10 20:37:17 +00:00
|
|
|
property string image
|
2020-12-11 20:29:46 +00:00
|
|
|
property bool hasMentions: false
|
|
|
|
|
2020-12-11 20:38:10 +00:00
|
|
|
id: communityButton
|
2021-02-17 16:31:59 +00:00
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
iconSource: communityButton.image
|
|
|
|
anchors.topMargin: 0
|
2020-12-11 20:29:46 +00:00
|
|
|
|
2021-02-17 16:31:59 +00:00
|
|
|
section: Constants.community
|
|
|
|
|
|
|
|
checked: chatsModel.communities.activeCommunity.active && chatsModel.communities.activeCommunity.id === communityId
|
2020-12-11 20:29:46 +00:00
|
|
|
|
2021-02-17 16:31:59 +00:00
|
|
|
borderOnChecked: true
|
|
|
|
doNotHandleClick: true
|
|
|
|
onClicked: {
|
|
|
|
appMain.changeAppSection(Constants.chat)
|
|
|
|
chatsModel.communities.setActiveCommunity(communityId)
|
2020-12-11 20:29:46 +00:00
|
|
|
}
|
|
|
|
|
2021-02-17 18:29:56 +00:00
|
|
|
StatusToolTip {
|
|
|
|
visible: communityButton.hovered
|
|
|
|
text: communityButton.name
|
|
|
|
delay: 50
|
|
|
|
}
|
|
|
|
|
2020-12-11 20:29:46 +00:00
|
|
|
Rectangle {
|
2021-02-17 16:31:59 +00:00
|
|
|
id: chatBadge
|
|
|
|
visible: unviewedMessagesCount > 0
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.left: parent.right
|
|
|
|
anchors.leftMargin: -17
|
|
|
|
anchors.topMargin: 1
|
|
|
|
radius: height / 2
|
|
|
|
color: Style.current.blue
|
|
|
|
border.color: Style.current.background
|
|
|
|
border.width: 2
|
|
|
|
width: unviewedMessagesCount < 10 ? 22 : messageCount.width + 14
|
2020-12-11 20:29:46 +00:00
|
|
|
height: 22
|
2021-02-17 16:31:59 +00:00
|
|
|
Text {
|
|
|
|
id: messageCount
|
|
|
|
font.pixelSize: chatsModel.unreadMessagesCount > 99 ? 10 : 12
|
2020-12-11 20:29:46 +00:00
|
|
|
color: Style.current.white
|
2021-02-17 16:31:59 +00:00
|
|
|
anchors.centerIn: parent
|
|
|
|
text: unviewedMessagesCount > 99 ? "99+" : unviewedMessagesCount
|
2020-12-11 20:29:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|