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
This commit is contained in:
Noelia 2023-05-11 19:14:11 +02:00 committed by Noelia
parent 9277392dd4
commit 60acb43249
2 changed files with 15 additions and 5 deletions

View File

@ -25,6 +25,7 @@ QtObject {
symbol: "SRW", symbol: "SRW",
description: "Desc", description: "Desc",
supply: 1, supply: 1,
availableTokens: 1,
infiniteSupply: true, infiniteSupply: true,
transferable: false, transferable: false,
remoteSelfDestruct: true, remoteSelfDestruct: true,
@ -36,10 +37,11 @@ QtObject {
{ {
name: "Kitty artwork", name: "Kitty artwork",
image: ModelsData.collectibles.kitty1Big, image: ModelsData.collectibles.kitty1Big,
deployState: 1, deployState: 2,
symbol: "KAT", symbol: "KAT",
description: "Desc", description: "Desc",
supply: 10, supply: 10,
availableTokens: 5,
infiniteSupply: false, infiniteSupply: false,
transferable: false, transferable: false,
remoteSelfDestruct: true, remoteSelfDestruct: true,
@ -55,6 +57,7 @@ QtObject {
symbol: "MMM", symbol: "MMM",
description: "Desc", description: "Desc",
supply: 1, supply: 1,
availableTokens: 0,
infiniteSupply: true, infiniteSupply: true,
transferable: false, transferable: false,
remoteSelfDestruct: true, remoteSelfDestruct: true,
@ -66,10 +69,11 @@ QtObject {
{ {
name: "Crypto Punks artwork", name: "Crypto Punks artwork",
image: ModelsData.banners.cryptPunks, image: ModelsData.banners.cryptPunks,
deployState: 1, deployState: 2,
symbol: "CPA", symbol: "CPA",
description: "Desc", description: "Desc",
supply: 5000, supply: 5000,
availableTokens: 1500,
infiniteSupply: false, infiniteSupply: false,
transferable: false, transferable: false,
remoteSelfDestruct: false, remoteSelfDestruct: false,

View File

@ -24,7 +24,7 @@ StatusScrollView {
QtObject { QtObject {
id: d id: d
function getStateText(deployState) { function getSubtitle(deployState, availableTokens, supply) {
if(deployState === Constants.DeployState.Failed) { if(deployState === Constants.DeployState.Failed) {
return qsTr("Failed") return qsTr("Failed")
} }
@ -32,7 +32,13 @@ StatusScrollView {
if(deployState === Constants.DeployState.InProgress) { if(deployState === Constants.DeployState.InProgress) {
return qsTr("Minting...") 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 height: gridView.cellHeight
width: gridView.cellWidth width: gridView.cellWidth
title: model.name ? model.name : "..." title: model.name ? model.name : "..."
subTitle: d.getStateText(model.deployState) subTitle: d.getSubtitle(model.deployState, model.availableTokens, model.supply)
fallbackImageUrl: model.image ? model.image : "" fallbackImageUrl: model.image ? model.image : ""
backgroundColor: model.backgroundColor ? model.backgroundColor : "transparent" // TODO BACKEND backgroundColor: model.backgroundColor ? model.backgroundColor : "transparent" // TODO BACKEND
isLoading: false isLoading: false