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",
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,

View File

@ -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