fix(MintTokens): Use localised amount for total supply

Fixing: https://github.com/status-im/status-desktop/issues/9763
Changes:
1. Use int to pass around the supply amount from one component to another
2. Transform the supply amount to localised string when it is displayed to the user.
This commit is contained in:
Alex Jbanca 2023-03-28 10:47:12 +03:00 committed by Alex Jbanca
parent 999d767110
commit 17834ecbc1
4 changed files with 9 additions and 9 deletions

View File

@ -31,7 +31,7 @@ SplitView {
name: nameText.text name: nameText.text
symbol: symbolText.text symbol: symbolText.text
description: descriptionText.text description: descriptionText.text
supplyText: supplyText.text supplyAmount: parseInt(supplyText.text)
infiniteSupply: unlimitedSupplyChecker.checked infiniteSupply: unlimitedSupplyChecker.checked
transferable: transferibleChecker.checked transferable: transferibleChecker.checked
selfDestruct: selfdestructChecker.checked selfDestruct: selfdestructChecker.checked

View File

@ -164,7 +164,7 @@ SettingsPageLayout {
artworkSource, artworkSource,
symbol, symbol,
description, description,
supplyText, supplyAmount,
infiniteSupply, infiniteSupply,
transferable: !notTransferable, transferable: !notTransferable,
selfDestruct, selfDestruct,
@ -191,7 +191,7 @@ SettingsPageLayout {
name, name,
symbol, symbol,
description, description,
parseInt(supplyText), supplyAmount,
infiniteSupply, infiniteSupply,
transferable, transferable,
selfDestruct, selfDestruct,
@ -257,7 +257,7 @@ SettingsPageLayout {
artworkSource, artworkSource,
symbol, symbol,
description, description,
supplyText: supply.toString(), supplyAmount: supply,
infiniteSupply, infiniteSupply,
transferable, transferable,
selfDestruct, selfDestruct,

View File

@ -24,7 +24,7 @@ StatusScrollView {
property alias description: descriptionItem.text property alias description: descriptionItem.text
property alias chainName: chainText.text property alias chainName: chainText.text
property string name property string name
property string supplyText property int supplyAmount
property bool infiniteSupply property bool infiniteSupply
property bool transferable property bool transferable
property bool selfDestruct property bool selfDestruct
@ -148,7 +148,7 @@ StatusScrollView {
CustomPreviewBox { CustomPreviewBox {
label: root.infiniteSupply ? qsTr("Infinite supply") : qsTr("Total") label: root.infiniteSupply ? qsTr("Infinite supply") : qsTr("Total")
value: root.infiniteSupply ? qsTr("Yes") : root.supplyText value: root.infiniteSupply ? qsTr("Yes") : LocaleUtils.numberToLocaleString(root.supplyAmount)
leftAlignment: root.infiniteSupply leftAlignment: root.infiniteSupply
} }
@ -245,7 +245,7 @@ StatusScrollView {
root.name, root.name,
root.symbol, root.symbol,
root.description, root.description,
parseInt(root.supplyText), root.supplyAmount,
root.infiniteSupply, root.infiniteSupply,
root.transferable, root.transferable,
root.selfDestruct, root.selfDestruct,

View File

@ -22,10 +22,10 @@ StatusScrollView {
readonly property alias name: nameInput.text readonly property alias name: nameInput.text
readonly property alias symbol: symbolInput.text readonly property alias symbol: symbolInput.text
readonly property alias description: descriptionInput.text readonly property alias description: descriptionInput.text
readonly property alias supplyText: supplyInput.text
readonly property alias infiniteSupply: unlimitedSupplyChecker.checked readonly property alias infiniteSupply: unlimitedSupplyChecker.checked
readonly property alias notTransferable: transferableChecker.checked readonly property alias notTransferable: transferableChecker.checked
readonly property alias selfDestruct: selfDestructChecker.checked readonly property alias selfDestruct: selfDestructChecker.checked
readonly property int supplyAmount: supplyInput.text ? parseInt(supplyInput.text) : 0
property url artworkSource property url artworkSource
property int chainId property int chainId
property string chainName property string chainName
@ -54,7 +54,7 @@ StatusScrollView {
&& !!root.name && !!root.name
&& !!root.symbol && !!root.symbol
&& !!root.description && !!root.description
&& (root.infiniteSupply || (!root.infiniteSupply && root.supplyText.length > 0)) && (root.infiniteSupply || (!root.infiniteSupply && root.supplyAmount > 0))
readonly property int imageSelectorRectWidth: 280 readonly property int imageSelectorRectWidth: 280