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
symbol: symbolText.text
description: descriptionText.text
supplyText: supplyText.text
supplyAmount: parseInt(supplyText.text)
infiniteSupply: unlimitedSupplyChecker.checked
transferable: transferibleChecker.checked
selfDestruct: selfdestructChecker.checked

View File

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

View File

@ -24,7 +24,7 @@ StatusScrollView {
property alias description: descriptionItem.text
property alias chainName: chainText.text
property string name
property string supplyText
property int supplyAmount
property bool infiniteSupply
property bool transferable
property bool selfDestruct
@ -148,7 +148,7 @@ StatusScrollView {
CustomPreviewBox {
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
}
@ -245,7 +245,7 @@ StatusScrollView {
root.name,
root.symbol,
root.description,
parseInt(root.supplyText),
root.supplyAmount,
root.infiniteSupply,
root.transferable,
root.selfDestruct,

View File

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