From 8ad9e52abf3f49bb1801c8da9a1f30213015326c Mon Sep 17 00:00:00 2001 From: Pascal Precht Date: Tue, 16 Mar 2021 13:39:09 +0100 Subject: [PATCH] fix(Communities): render community image in profile popup --- .../CommunityHeaderButton.qml | 3 ++ .../CommunityProfilePopup.qml | 30 +++++++++++++++---- .../CommunityWelcomeBanner.qml | 2 ++ 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/ui/app/AppLayouts/Chat/CommunityComponents/CommunityHeaderButton.qml b/ui/app/AppLayouts/Chat/CommunityComponents/CommunityHeaderButton.qml index e95ea6ada6..dc5144f1f3 100644 --- a/ui/app/AppLayouts/Chat/CommunityComponents/CommunityHeaderButton.qml +++ b/ui/app/AppLayouts/Chat/CommunityComponents/CommunityHeaderButton.qml @@ -63,6 +63,9 @@ Button { communityProfilePopup.access = chatsModel.communities.activeCommunity.access; communityProfilePopup.nbMembers = chatsModel.communities.activeCommunity.nbMembers; communityProfilePopup.isAdmin = chatsModel.communities.activeCommunity.admin + communityProfilePopup.source = chatsModel.communities.activeCommunity.thumbnailImage + communityProfilePopup.communityColor = chatsModel.communities.activeCommunity.communityColor + communityProfilePopup.open(); } hoverEnabled: true diff --git a/ui/app/AppLayouts/Chat/CommunityComponents/CommunityProfilePopup.qml b/ui/app/AppLayouts/Chat/CommunityComponents/CommunityProfilePopup.qml index 6835948b68..38e45e35f7 100644 --- a/ui/app/AppLayouts/Chat/CommunityComponents/CommunityProfilePopup.qml +++ b/ui/app/AppLayouts/Chat/CommunityComponents/CommunityProfilePopup.qml @@ -13,8 +13,8 @@ ModalPopup { property string name: community.name property string description: community.description property int access: community.access - // TODO get the real image once it's available - property string source: "../../../img/ens-header-dark@2x.png" + property string source: "" + property string communityColor: "" property int nbMembers: community.nbMembers property bool isAdmin: false height: (isAdmin ? 600 : 590) + descriptionText.height @@ -25,13 +25,31 @@ ModalPopup { height: childrenRect.height width: parent.width - RoundedImage { + Loader { id: communityImg - source: popup.source - width: 40 - height: 40 + 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 text: popup.name diff --git a/ui/app/AppLayouts/Chat/CommunityComponents/CommunityWelcomeBanner.qml b/ui/app/AppLayouts/Chat/CommunityComponents/CommunityWelcomeBanner.qml index 9255185acb..d246760b2d 100644 --- a/ui/app/AppLayouts/Chat/CommunityComponents/CommunityWelcomeBanner.qml +++ b/ui/app/AppLayouts/Chat/CommunityComponents/CommunityWelcomeBanner.qml @@ -95,6 +95,8 @@ Rectangle { communityProfilePopup.access = chatsModel.communities.activeCommunity.access; communityProfilePopup.nbMembers = chatsModel.communities.activeCommunity.nbMembers; communityProfilePopup.isAdmin = chatsModel.communities.activeCommunity.admin; + communityProfilePopup.source = chatsModel.communities.activeCommunity.thumbnailImage + communityProfilePopup.communityColor = chatsModel.communities.activeCommunity.communityColor communityProfilePopup.open() } }