feat(MintTokens): Update CommunityCollectibleView according to new design

- Title format changed. Now symbol is a title side text.
- Back button text changed.
- Description / boxes order changed.
- Boxes changed order and format.
- Warning description changed.

Closes #10601
This commit is contained in:
Noelia 2023-05-15 14:49:26 +02:00 committed by Noelia
parent 24f09e9e96
commit e0acf0f195
5 changed files with 77 additions and 45 deletions

View File

@ -25,7 +25,7 @@ QtObject {
symbol: "SRW", symbol: "SRW",
description: "Desc", description: "Desc",
supply: 1, supply: 1,
availableTokens: 1, remainingTokens: 1,
infiniteSupply: true, infiniteSupply: true,
transferable: false, transferable: false,
remoteSelfDestruct: true, remoteSelfDestruct: true,
@ -41,7 +41,7 @@ QtObject {
symbol: "KAT", symbol: "KAT",
description: "Desc", description: "Desc",
supply: 10, supply: 10,
availableTokens: 5, remainingTokens: 5,
infiniteSupply: false, infiniteSupply: false,
transferable: false, transferable: false,
remoteSelfDestruct: true, remoteSelfDestruct: true,
@ -57,7 +57,7 @@ QtObject {
symbol: "MMM", symbol: "MMM",
description: "Desc", description: "Desc",
supply: 1, supply: 1,
availableTokens: 0, remainingTokens: 0,
infiniteSupply: true, infiniteSupply: true,
transferable: false, transferable: false,
remoteSelfDestruct: true, remoteSelfDestruct: true,
@ -73,7 +73,7 @@ QtObject {
symbol: "CPA", symbol: "CPA",
description: "Desc", description: "Desc",
supply: 5000, supply: 5000,
availableTokens: 1500, remainingTokens: 1500,
infiniteSupply: false, infiniteSupply: false,
transferable: false, transferable: false,
remoteSelfDestruct: false, remoteSelfDestruct: false,

View File

@ -13,7 +13,7 @@ Item {
id: root id: root
// required // required
property string title property alias title: itemHeader.text
property Component content property Component content
@ -29,6 +29,7 @@ Item {
property alias saveChangesText: settingsDirtyToastMessage.saveChangesText property alias saveChangesText: settingsDirtyToastMessage.saveChangesText
property alias cancelChangesText: settingsDirtyToastMessage.cancelChangesText property alias cancelChangesText: settingsDirtyToastMessage.cancelChangesText
property alias changesDetectedText: settingsDirtyToastMessage.changesDetectedText property alias changesDetectedText: settingsDirtyToastMessage.changesDetectedText
property alias subTitle: sideTextHeader.text
readonly property Item contentItem: contentLoader.item readonly property Item contentItem: contentLoader.item
readonly property size settingsDirtyToastMessageImplicitSize: readonly property size settingsDirtyToastMessageImplicitSize:
@ -61,15 +62,29 @@ Item {
Layout.maximumWidth: root.headerWidth === 0 ? parent.width : (root.headerWidth + itemHeader.Layout.leftMargin) Layout.maximumWidth: root.headerWidth === 0 ? parent.width : (root.headerWidth + itemHeader.Layout.leftMargin)
Layout.preferredHeight: 56 Layout.preferredHeight: 56
StatusBaseText { RowLayout {
id: itemHeader
Layout.leftMargin: 64
Layout.fillWidth: true
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
text: root.title Layout.fillWidth: true
color: Theme.palette.directColor1
font.pixelSize: 26 StatusBaseText {
font.bold: true id: itemHeader
Layout.leftMargin: 64
color: Theme.palette.directColor1
font.pixelSize: 26
font.bold: true
}
StatusBaseText {
id: sideTextHeader
Layout.leftMargin: 6
Layout.topMargin: 6
color: Theme.palette.baseColor1
font.pixelSize: 15
}
} }
StatusButton { StatusButton {

View File

@ -83,7 +83,6 @@ SettingsPageLayout {
readonly property string newCollectiblePageTitle: qsTr("Mint collectible") readonly property string newCollectiblePageTitle: qsTr("Mint collectible")
readonly property string newTokenButtonText: qsTr("Mint token") readonly property string newTokenButtonText: qsTr("Mint token")
readonly property string backButtonText: qsTr("Back") readonly property string backButtonText: qsTr("Back")
readonly property string backTokensText: qsTr("Tokens")
property string accountAddress property string accountAddress
property string accountName property string accountName
@ -121,6 +120,7 @@ SettingsPageLayout {
State { State {
name: d.initialViewState name: d.initialViewState
PropertyChanges {target: root; title: d.welcomePageTitle} PropertyChanges {target: root; title: d.welcomePageTitle}
PropertyChanges {target: root; subTitle: ""}
PropertyChanges {target: root; previousPageName: ""} PropertyChanges {target: root; previousPageName: ""}
PropertyChanges {target: root; headerButtonVisible: true} PropertyChanges {target: root; headerButtonVisible: true}
PropertyChanges {target: root; headerButtonText: d.newTokenButtonText} PropertyChanges {target: root; headerButtonText: d.newTokenButtonText}
@ -129,6 +129,7 @@ SettingsPageLayout {
State { State {
name: d.newCollectibleViewState name: d.newCollectibleViewState
PropertyChanges {target: root; title: d.newCollectiblePageTitle} PropertyChanges {target: root; title: d.newCollectiblePageTitle}
PropertyChanges {target: root; subTitle: ""}
PropertyChanges {target: root; previousPageName: d.backButtonText} PropertyChanges {target: root; previousPageName: d.backButtonText}
PropertyChanges {target: root; headerButtonVisible: false} PropertyChanges {target: root; headerButtonVisible: false}
PropertyChanges {target: root; headerWidth: 0} PropertyChanges {target: root; headerWidth: 0}
@ -141,7 +142,7 @@ SettingsPageLayout {
}, },
State { State {
name: d.collectibleViewState name: d.collectibleViewState
PropertyChanges {target: root; previousPageName: d.backTokensText} PropertyChanges {target: root; previousPageName: d.backButtonText}
PropertyChanges {target: root; headerButtonVisible: false} PropertyChanges {target: root; headerButtonVisible: false}
PropertyChanges {target: root; headerWidth: 0} PropertyChanges {target: root; headerWidth: 0}
PropertyChanges {target: root; footer: mintTokenFooter} PropertyChanges {target: root; footer: mintTokenFooter}
@ -244,6 +245,13 @@ SettingsPageLayout {
value: preview.name value: preview.name
} }
Binding {
target: root
property: "subTitle"
value: preview.symbol
restoreMode: Binding.RestoreBindingOrValue
}
SignMintTokenTransactionPopup { SignMintTokenTransactionPopup {
id: popup id: popup
@ -370,6 +378,13 @@ SettingsPageLayout {
value: view.name value: view.name
} }
Binding {
target: root
property: "subTitle"
value: view.symbol
restoreMode: Binding.RestoreBindingOrValue
}
Binding { Binding {
target: d target: d
property: "tokenOwnersModel" property: "tokenOwnersModel"
@ -403,6 +418,7 @@ SettingsPageLayout {
Bind { property: "description"; value: model.description }, Bind { property: "description"; value: model.description },
Bind { property: "supplyAmount"; value: model.supply }, Bind { property: "supplyAmount"; value: model.supply },
Bind { property: "infiniteSupply"; value: model.infiniteSupply }, Bind { property: "infiniteSupply"; value: model.infiniteSupply },
Bind { property: "remainingTokens"; value: model.remainingTokens },
Bind { property: "selfDestruct"; value: model.remoteSelfDestruct }, Bind { property: "selfDestruct"; value: model.remoteSelfDestruct },
Bind { property: "chainId"; value: model.chainId }, Bind { property: "chainId"; value: model.chainId },
Bind { property: "chainName"; value: model.chainName }, Bind { property: "chainName"; value: model.chainName },

View File

@ -26,6 +26,7 @@ StatusScrollView {
property alias chainName: chainText.text property alias chainName: chainText.text
property string name property string name
property int supplyAmount property int supplyAmount
property int remainingTokens
property bool infiniteSupply property bool infiniteSupply
property bool transferable property bool transferable
property bool selfDestruct property bool selfDestruct
@ -52,6 +53,7 @@ StatusScrollView {
readonly property int imageSelectorRectSize: 280 readonly property int imageSelectorRectSize: 280
readonly property int iconSize: 20 readonly property int iconSize: 20
readonly property string infiniteSymbol: "∞"
} }
contentWidth: mainLayout.width contentWidth: mainLayout.width
@ -101,15 +103,6 @@ StatusScrollView {
} }
} }
StatusBaseText {
id: descriptionItem
Layout.fillWidth: true
wrapMode: TextEdit.WordWrap
font.pixelSize: Theme.primaryTextFontSize
lineHeight: 1.2
}
Flow { Flow {
spacing: Style.current.halfPadding spacing: Style.current.halfPadding
Layout.fillWidth: true Layout.fillWidth: true
@ -119,7 +112,6 @@ StatusScrollView {
property string label property string label
property string value property string value
property bool leftAlignment: true
radius: 8 radius: 8
border.color: Theme.palette.baseColor2 border.color: Theme.palette.baseColor2
@ -143,20 +135,28 @@ StatusScrollView {
StatusBaseText { StatusBaseText {
Layout.maximumWidth: mainLayout.width - Style.current.padding Layout.maximumWidth: mainLayout.width - Style.current.padding
Layout.alignment: previewBox.leftAlignment ? Qt.AlignLeft : Qt.AlignHCenter
text: previewBox.value text: previewBox.value
elide: Text.ElideRight elide: Text.ElideRight
font.pixelSize: Theme.primaryTextFontSize font.pixelSize: Theme.primaryTextFontSize
color: Theme.palette.directColor1 color: Theme.palette.directColor1
horizontalAlignment: previewBox.leftAlignment ? Text.AlignLeft : Text.AlignHCenter
} }
} }
} }
CustomPreviewBox { CustomPreviewBox {
label: root.infiniteSupply ? qsTr("Infinite supply") : qsTr("Total") id: symbolBox
value: root.infiniteSupply ? qsTr("Yes") : LocaleUtils.numberToLocaleString(root.supplyAmount)
leftAlignment: root.infiniteSupply label: qsTr("Symbol")
}
CustomPreviewBox {
label: qsTr("Total")
value: root.infiniteSupply ? d.infiniteSymbol : LocaleUtils.numberToLocaleString(root.supplyAmount)
}
CustomPreviewBox {
label: qsTr("Remaining")
value: root.infiniteSupply ? d.infiniteSymbol : LocaleUtils.numberToLocaleString(root.remainingTokens)
} }
CustomPreviewBox { CustomPreviewBox {
@ -165,22 +165,14 @@ StatusScrollView {
} }
CustomPreviewBox { CustomPreviewBox {
label: qsTr("Remote self-destruct") label: qsTr("Remotely destructible")
value: root.selfDestruct ? qsTr("Yes") : qsTr("No") value: root.selfDestruct ? qsTr("Yes") : qsTr("No")
} }
CustomPreviewBox {
id: symbolBox
label: qsTr("Symbol")
leftAlignment: false
}
CustomPreviewBox { CustomPreviewBox {
id: accountBox id: accountBox
label: qsTr("Account") label: qsTr("Account")
leftAlignment: false
} }
Rectangle { Rectangle {
@ -218,6 +210,15 @@ StatusScrollView {
} }
} }
StatusBaseText {
id: descriptionItem
Layout.fillWidth: true
wrapMode: TextEdit.WordWrap
font.pixelSize: Theme.primaryTextFontSize
lineHeight: 1.2
}
RowLayout { RowLayout {
visible: root.preview visible: root.preview
Layout.fillWidth: true Layout.fillWidth: true
@ -235,7 +236,7 @@ StatusScrollView {
wrapMode: Text.Wrap wrapMode: Text.Wrap
font.pixelSize: Style.current.primaryTextFontSize font.pixelSize: Style.current.primaryTextFontSize
color: Theme.palette.baseColor1 color: Theme.palette.baseColor1
text: qsTr("Make sure youre happy with your collectible before minting it as it cant be edited later") text: qsTr("Make sure youre happy with your token before minting it as it cant be edited later")
} }
} }

View File

@ -24,7 +24,7 @@ StatusScrollView {
QtObject { QtObject {
id: d id: d
function getSubtitle(deployState, availableTokens, supply) { function getSubtitle(deployState, remainingTokens, supply) {
if(deployState === Constants.DeployState.Failed) { if(deployState === Constants.DeployState.Failed) {
return qsTr("Failed") return qsTr("Failed")
} }
@ -34,11 +34,11 @@ StatusScrollView {
} }
// 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. // 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) if(!remainingTokens)
availableTokens = 0 remainingTokens = 0
if(supply === 0) if(supply === 0)
supply = "∞" supply = "∞"
return qsTr("%1 / %2 remaining").arg(availableTokens).arg(supply) return qsTr("%1 / %2 remaining").arg(remainingTokens).arg(supply)
} }
} }
@ -70,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.getSubtitle(model.deployState, model.availableTokens, model.supply) subTitle: d.getSubtitle(model.deployState, model.remainingTokens, 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