From 60acb43249418e5eb97ef8a15cad7705d2b1525f Mon Sep 17 00:00:00 2001 From: Noelia Date: Thu, 11 May 2023 19:14:11 +0200 Subject: [PATCH] feat(MintToken): Updated collectible subtitle information Added available tokens and total supply as subtitle information in minted collectibles view. Updated storybook model with new property `availableTokens`. Closes #10606 --- storybook/src/Models/MintedCollectiblesModel.qml | 8 ++++++-- .../views/communities/CommunityMintedTokensView.qml | 12 +++++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/storybook/src/Models/MintedCollectiblesModel.qml b/storybook/src/Models/MintedCollectiblesModel.qml index c400761f15..b0dbb33be8 100644 --- a/storybook/src/Models/MintedCollectiblesModel.qml +++ b/storybook/src/Models/MintedCollectiblesModel.qml @@ -25,6 +25,7 @@ QtObject { symbol: "SRW", description: "Desc", supply: 1, + availableTokens: 1, infiniteSupply: true, transferable: false, remoteSelfDestruct: true, @@ -36,10 +37,11 @@ QtObject { { name: "Kitty artwork", image: ModelsData.collectibles.kitty1Big, - deployState: 1, + deployState: 2, symbol: "KAT", description: "Desc", supply: 10, + availableTokens: 5, infiniteSupply: false, transferable: false, remoteSelfDestruct: true, @@ -55,6 +57,7 @@ QtObject { symbol: "MMM", description: "Desc", supply: 1, + availableTokens: 0, infiniteSupply: true, transferable: false, remoteSelfDestruct: true, @@ -66,10 +69,11 @@ QtObject { { name: "Crypto Punks artwork", image: ModelsData.banners.cryptPunks, - deployState: 1, + deployState: 2, symbol: "CPA", description: "Desc", supply: 5000, + availableTokens: 1500, infiniteSupply: false, transferable: false, remoteSelfDestruct: false, diff --git a/ui/app/AppLayouts/Chat/views/communities/CommunityMintedTokensView.qml b/ui/app/AppLayouts/Chat/views/communities/CommunityMintedTokensView.qml index 1b0b84c4d7..724b64e005 100644 --- a/ui/app/AppLayouts/Chat/views/communities/CommunityMintedTokensView.qml +++ b/ui/app/AppLayouts/Chat/views/communities/CommunityMintedTokensView.qml @@ -24,7 +24,7 @@ StatusScrollView { QtObject { id: d - function getStateText(deployState) { + function getSubtitle(deployState, availableTokens, supply) { if(deployState === Constants.DeployState.Failed) { return qsTr("Failed") } @@ -32,7 +32,13 @@ StatusScrollView { if(deployState === Constants.DeployState.InProgress) { return qsTr("Minting...") } - return "" + + // TO REMOVE: Just added bc backend still doesn't have `availableTokens` property in model. Once it is added, the following 2 lines can be removed. + if(!availableTokens) + availableTokens = 0 + if(supply === 0) + supply = "∞" + return qsTr("%1 / %2 remaining").arg(availableTokens).arg(supply) } } @@ -64,7 +70,7 @@ StatusScrollView { height: gridView.cellHeight width: gridView.cellWidth title: model.name ? model.name : "..." - subTitle: d.getStateText(model.deployState) + subTitle: d.getSubtitle(model.deployState, model.availableTokens, model.supply) fallbackImageUrl: model.image ? model.image : "" backgroundColor: model.backgroundColor ? model.backgroundColor : "transparent" // TODO BACKEND isLoading: false