fix: fix communities not showing the letter identicon correctly

This commit is contained in:
Jonathan Rainville 2021-03-23 15:13:36 -04:00 committed by Iuri Matias
parent c28d4054ef
commit 686cbc7f54
4 changed files with 71 additions and 14 deletions

View File

@ -148,11 +148,28 @@ ModalPopup {
height: visible ? communityImage.height + Style.current.padding : 0
width: parent.width
RoundedImage {
Loader {
id: communityImage
sourceComponent: !!thumbnailImage ? commmunityImgCmp : letterIdenticonCmp
}
Component {
id: commmunityImgCmp
RoundedImage {
source: thumbnailImage
width: 40
height: 40
source: thumbnailImage
}
}
Component {
id: letterIdenticonCmp
StatusLetterIdenticon {
width: 40
height: 40
chatName: name
color: communityColor || Style.current.blue
}
}
StyledText {

View File

@ -17,6 +17,7 @@ ModalPopup {
property bool canJoin: community.canJoin
property bool canRequestAccess: community.canRequestAccess
property bool isMember: community.isMember
property string communityColor: community.communityColor || Style.current.blue
id: popup
@ -24,12 +25,30 @@ ModalPopup {
height: childrenRect.height
width: parent.width
RoundedImage {
Loader {
id: communityImg
sourceComponent: !!popup.source ? commmunityImgCmp : letterIdenticonCmp
}
Component {
id: commmunityImgCmp
RoundedImage {
source: popup.source
width: 40
height: 40
}
}
Component {
id: letterIdenticonCmp
StatusLetterIdenticon {
width: 40
height: 40
chatName: popup.name
color: popup.communityColor
}
}
StyledTextEdit {
id: communityName

View File

@ -2,6 +2,7 @@ import QtQuick 2.13
import QtQuick.Controls 2.13
import QtQuick.Layouts 1.13
import "../../../../shared"
import "../../../../shared/status"
import "../../../../imports"
import "../components"
import "./"
@ -18,14 +19,34 @@ Button {
contentItem: Item {
id: content
RoundedImage {
Loader {
id: communityImage
anchors.verticalCenter: parent.verticalCenter
active: true
sourceComponent: !chatsModel.communities.activeCommunity.thumbnailImage ? letterIdenticon : imageIcon
}
Component {
id: imageIcon
RoundedImage {
width: 40
height: 40
source: chatsModel.communities.activeCommunity.thumbnailImage
anchors.verticalCenter: parent.verticalCenter
noHover: true
noMouseArea: true
}
}
Component {
id: letterIdenticon
StatusLetterIdenticon {
width: 40
height: 40
chatName: chatsModel.communities.activeCommunity.name
color: chatsModel.communities.activeCommunity.communityColor || Style.current.blue
}
}
StyledText {
id: communityName

View File

@ -59,7 +59,7 @@ ModalPopup {
width: 40
height: 40
chatName: popup.name
color: popup.communityColor
color: popup.communityColor || Style.current.blue
}
}