From 38bbd0fb539edbb50b27a61663747bb1d9fe1072 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Tinkl?= Date: Thu, 15 Jun 2023 02:06:10 +0200 Subject: [PATCH] fix: unbreak profile showcase - amISectionAdmin no longer exists - profile section wallet store no longer provided the base assets model --- .../Profile/controls/CommunityShowcaseDelegate.qml | 5 ++++- .../Profile/panels/ProfileShowcaseCommunitiesPanel.qml | 2 +- ui/app/AppLayouts/Profile/stores/WalletStore.qml | 4 ++-- ui/imports/shared/views/profile/ProfileShowcaseView.qml | 7 ++++--- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/ui/app/AppLayouts/Profile/controls/CommunityShowcaseDelegate.qml b/ui/app/AppLayouts/Profile/controls/CommunityShowcaseDelegate.qml index 4c00108655..21a5c77e37 100644 --- a/ui/app/AppLayouts/Profile/controls/CommunityShowcaseDelegate.qml +++ b/ui/app/AppLayouts/Profile/controls/CommunityShowcaseDelegate.qml @@ -1,8 +1,11 @@ import QtQuick 2.15 +import utils 1.0 + ShowcaseDelegate { title: !!showcaseObj && !!showcaseObj.name ? showcaseObj.name : "" - secondaryTitle: !!showcaseObj && !!showcaseObj.amISectionAdmin ? qsTr("Admin") : qsTr("Member") + secondaryTitle: !!showcaseObj && (showcaseObj.memberRole === Constants.memberRole.owner || + showcaseObj.memberRole === Constants.memberRole.admin) ? qsTr("Admin") : qsTr("Member") hasImage: !!showcaseObj && !!showcaseObj.image icon.name: !!showcaseObj ? showcaseObj.name : "" diff --git a/ui/app/AppLayouts/Profile/panels/ProfileShowcaseCommunitiesPanel.qml b/ui/app/AppLayouts/Profile/panels/ProfileShowcaseCommunitiesPanel.qml index e1b47b7095..880866a64a 100644 --- a/ui/app/AppLayouts/Profile/panels/ProfileShowcaseCommunitiesPanel.qml +++ b/ui/app/AppLayouts/Profile/panels/ProfileShowcaseCommunitiesPanel.qml @@ -9,7 +9,7 @@ ProfileShowcasePanel { settingsKey: "communities" keyRole: "id" - roleNames: ["id", "name", "amISectionAdmin", "image", "color"] + roleNames: ["id", "name", "memberRole", "image", "color"] filterFunc: (modelData) => modelData.joined && !showcaseModel.hasItem(modelData.id) hiddenPlaceholderBanner: qsTr("Communities here will show on your profile") showcasePlaceholderBanner: qsTr("Communities here will be hidden from your profile") diff --git a/ui/app/AppLayouts/Profile/stores/WalletStore.qml b/ui/app/AppLayouts/Profile/stores/WalletStore.qml index 834f1247ae..54aea5d968 100644 --- a/ui/app/AppLayouts/Profile/stores/WalletStore.qml +++ b/ui/app/AppLayouts/Profile/stores/WalletStore.qml @@ -10,7 +10,7 @@ QtObject { property var accountSensitiveSettings: Global.appIsReady? localAccountSensitiveSettings : null - property var areTestNetworksEnabled: networksModule.areTestNetworksEnabled + readonly property bool areTestNetworksEnabled: networksModule.areTestNetworksEnabled property var networks: networksModule.networks function toggleTestNetworksEnabled(){ @@ -20,7 +20,7 @@ QtObject { // TODO(alaibe): there should be no access to wallet section, create collectible in profile property var overview: walletSectionOverview property var flatCollectibles: Global.appIsReady ? walletSectionCollectibles.model : null - + property var assets: walletSectionAssets.assets property var accounts: Global.appIsReady? accountsModule.accounts : null function deleteAccount(address) { diff --git a/ui/imports/shared/views/profile/ProfileShowcaseView.qml b/ui/imports/shared/views/profile/ProfileShowcaseView.qml index 54c8b7f48e..6b7bf5b1bd 100644 --- a/ui/imports/shared/views/profile/ProfileShowcaseView.qml +++ b/ui/imports/shared/views/profile/ProfileShowcaseView.qml @@ -84,7 +84,7 @@ Control { } sorters: [ RoleSorter { - roleName: "amISectionAdmin" + roleName: "memberRole" sortOrder: Qt.DescendingOrder // admin first }, StringSorter { @@ -103,7 +103,7 @@ Control { subTitle: model.description tertiaryTitle: qsTr("%n member(s)", "", model.members.count) asset.name: model.image ?? model.name - asset.isImage: asset.name.startsWith("data:image/") + asset.isImage: asset.name.startsWith(Constants.dataImagePrefix) asset.isLetterIdenticon: !model.image asset.color: model.color asset.width: 40 @@ -112,7 +112,8 @@ Control { border.color: Theme.palette.baseColor2 components: [ StatusIcon { - visible: model.amISectionAdmin + visible: model.memberRole === Constants.memberRole.owner || + model.memberRole === Constants.memberRole.admin anchors.verticalCenter: parent.verticalCenter icon: "crown" color: Theme.palette.directColor1