From f1904d9ef8fd6787051e2995758b53b5ea3009e5 Mon Sep 17 00:00:00 2001 From: Cuteivist Date: Wed, 4 Sep 2024 06:29:31 +0200 Subject: [PATCH] fix: Reset collectible details after exiting details page (#16231) --- .../shared_modules/collectible_details/controller.nim | 4 ++++ ui/app/AppLayouts/Wallet/WalletLayout.qml | 7 ++++++- ui/app/AppLayouts/Wallet/stores/CollectiblesStore.qml | 4 ++++ ui/app/AppLayouts/Wallet/views/RightTabView.qml | 1 + 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/app/modules/shared_modules/collectible_details/controller.nim b/src/app/modules/shared_modules/collectible_details/controller.nim index 2bd8dc9211..6d0c1474a7 100644 --- a/src/app/modules/shared_modules/collectible_details/controller.nim +++ b/src/app/modules/shared_modules/collectible_details/controller.nim @@ -112,6 +112,10 @@ QtObject: error "error fetching collectible details: ", response.error return + proc resetDetailedCollectible*(self: Controller) {.slot.} = + self.detailedEntry = newCollectibleDetailsEmptyEntry() + self.detailedEntryChanged() + proc setupEventHandlers(self: Controller) = self.eventsHandler.onGetCollectiblesDetailsDone(proc (jsonObj: JsonNode) = self.processGetCollectiblesDetailsResponse(jsonObj) diff --git a/ui/app/AppLayouts/Wallet/WalletLayout.qml b/ui/app/AppLayouts/Wallet/WalletLayout.qml index 1a84c3d041..3fdab822b6 100644 --- a/ui/app/AppLayouts/Wallet/WalletLayout.qml +++ b/ui/app/AppLayouts/Wallet/WalletLayout.qml @@ -297,7 +297,12 @@ Item { footer: WalletFooter { id: footer - readonly property bool isHoldingSelected: !!walletStore.currentViewedCollectible && walletStore.currentViewedHoldingID !== "" + readonly property bool isHoldingSelected: { + if (!rightPanelStackView.currentItem || rightPanelStackView.currentItem.currentTabIndex !== WalletLayout.RightPanelSelection.Collectibles) { + return false + } + return !!walletStore.currentViewedCollectible && walletStore.currentViewedHoldingID !== "" + } readonly property bool isCommunityCollectible: !!walletStore.currentViewedCollectible ? walletStore.currentViewedCollectible.communityId !== "" : false readonly property bool isOwnerCommunityCollectible: isCommunityCollectible ? (walletStore.currentViewedCollectible.communityPrivilegesLevel === Constants.TokenPrivilegesLevel.Owner) : false diff --git a/ui/app/AppLayouts/Wallet/stores/CollectiblesStore.qml b/ui/app/AppLayouts/Wallet/stores/CollectiblesStore.qml index 9e26c082eb..c2cc4ad12d 100644 --- a/ui/app/AppLayouts/Wallet/stores/CollectiblesStore.qml +++ b/ui/app/AppLayouts/Wallet/stores/CollectiblesStore.qml @@ -109,6 +109,10 @@ QtObject { walletSection.collectibleDetailsController.getDetailedCollectible(chainId, contractAddress, tokenId) } + function resetDetailedCollectible() { + walletSection.collectibleDetailsController.resetDetailedCollectible() + } + function hasNFT(ownerAddress, chainId, tokenId, tokenAddress) { const uid = getUidForData(tokenId, tokenAddress, chainId) ownerAddress = ownerAddress.toLowerCase() diff --git a/ui/app/AppLayouts/Wallet/views/RightTabView.qml b/ui/app/AppLayouts/Wallet/views/RightTabView.qml index 864b2ff9a3..1e1cd15c51 100644 --- a/ui/app/AppLayouts/Wallet/views/RightTabView.qml +++ b/ui/app/AppLayouts/Wallet/views/RightTabView.qml @@ -356,6 +356,7 @@ RightTabBaseView { onVisibleChanged: { if (!visible) { RootStore.resetCurrentViewedHolding(Constants.TokenType.ERC721) + RootStore.collectiblesStore.resetDetailedCollectible() } }