add contact requests to the chat badge

This commit is contained in:
Jonathan Rainville 2021-05-27 11:14:29 -04:00
parent 346cbd2433
commit c817cadca1
1 changed files with 6 additions and 4 deletions

View File

@ -431,8 +431,10 @@ RowLayout {
checked: !chatsModel.communities.activeCommunity.active && sLayout.currentIndex === Utils.getAppSectionIndex(Constants.chat) checked: !chatsModel.communities.activeCommunity.active && sLayout.currentIndex === Utils.getAppSectionIndex(Constants.chat)
Rectangle { Rectangle {
property int badgeCount: chatsModel.unreadMessagesCount + profileModel.contacts.contactRequests.count
id: chatBadge id: chatBadge
visible: chatsModel.unreadMessagesCount > 0 visible: chatBadge.badgeCount > 0
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.right anchors.left: parent.right
anchors.leftMargin: -17 anchors.leftMargin: -17
@ -441,14 +443,14 @@ RowLayout {
color: Style.current.blue color: Style.current.blue
border.color: chatBtn.hovered ? Style.current.secondaryBackground : Style.current.mainMenuBackground border.color: chatBtn.hovered ? Style.current.secondaryBackground : Style.current.mainMenuBackground
border.width: 2 border.width: 2
width: chatsModel.unreadMessagesCount < 10 ? 22 : messageCount.width + 14 width: chatBadge.badgeCount < 10 ? 22 : messageCount.width + 14
height: 22 height: 22
Text { Text {
id: messageCount id: messageCount
font.pixelSize: chatsModel.unreadMessagesCount > 99 ? 10 : 12 font.pixelSize: chatBadge.badgeCount > 99 ? 10 : 12
color: Style.current.white color: Style.current.white
anchors.centerIn: parent anchors.centerIn: parent
text: chatsModel.unreadMessagesCount > 99 ? "99+" : chatsModel.unreadMessagesCount text: chatBadge.badgeCount > 99 ? "99+" : chatBadge.badgeCount
} }
} }
} }