fix(Community Permissions): Update `tokens` names to `assets`

- Updated enumerators that were defining `tokens` instead of `assets`.
- Updated property names and labels.
- Updated signals and components names.
- Updated storybook.

Fixes #8816
This commit is contained in:
Noelia 2023-01-12 14:18:52 +01:00 committed by Noelia
parent ac7b322ee7
commit ea0db55361
16 changed files with 113 additions and 113 deletions

View File

@ -12,7 +12,7 @@ Pane {
CommunityNewPermissionView { CommunityNewPermissionView {
store: CommunitiesStore { store: CommunitiesStore {
readonly property var tokensModel: TokensModel {} readonly property var assetsModel: AssetsModel {}
readonly property var collectiblesModel: CollectiblesModel {} readonly property var collectiblesModel: CollectiblesModel {}
readonly property var channelsModel: ChannelsModel {} readonly property var channelsModel: ChannelsModel {}

View File

@ -61,7 +61,7 @@ Flickable {
icon: model.imageSource icon: model.imageSource
amountText: model.amount amountText: model.amount
isAmountVisible: true isAmountVisible: true
iconsModel: TokensCollectiblesIconsModel {} iconsModel: AssetsCollectiblesIconsModel {}
onNameChanged: model.name = name onNameChanged: model.name = name
onIconChanged: model.imageSource = icon onIconChanged: model.imageSource = icon
onAmountTextChanged: model.amount = parseFloat(amountText) onAmountTextChanged: model.amount = parseFloat(amountText)
@ -75,7 +75,7 @@ Flickable {
icon: d.newImageSource icon: d.newImageSource
amountText: d.newAmount amountText: d.newAmount
isAmountVisible: true isAmountVisible: true
iconsModel: TokensCollectiblesIconsModel {} iconsModel: AssetsCollectiblesIconsModel {}
onNameChanged: d.newName = name onNameChanged: d.newName = name
onIconChanged: d.newImageSource = icon onIconChanged: d.newImageSource = icon
onAmountTextChanged: d.newAmount = parseFloat(amountText) onAmountTextChanged: d.newAmount = parseFloat(amountText)
@ -103,7 +103,7 @@ Flickable {
panelText: "In [item " + model.index + "]" panelText: "In [item " + model.index + "]"
name: model.name name: model.name
icon: model.iconSource icon: model.iconSource
iconsModel: TokensCollectiblesIconsModel {} iconsModel: AssetsCollectiblesIconsModel {}
onNameChanged: model.name = name onNameChanged: model.name = name
onIconChanged: model.iconSource = icon onIconChanged: model.iconSource = icon
} }
@ -116,7 +116,7 @@ Flickable {
panelText: "New In item" panelText: "New In item"
name: d.newChannelName name: d.newChannelName
icon: d.newChannelIconSource icon: d.newChannelIconSource
iconsModel: TokensCollectiblesIconsModel {} iconsModel: AssetsCollectiblesIconsModel {}
onNameChanged: d.newChannelName = name onNameChanged: d.newChannelName = name
onIconChanged: d.newChannelIconSource = icon onIconChanged: d.newChannelIconSource = icon
} }

View File

@ -25,19 +25,19 @@ SplitView {
topMargin: 50 topMargin: 50
} }
store: CommunitiesStore { store: CommunitiesStore {
tokensModel: TokensModel {} assetsModel: AssetsModel {}
collectiblesModel: CollectiblesModel {} collectiblesModel: CollectiblesModel {}
channelsModel: ListModel { channelsModel: ListModel {
Component.onCompleted: { Component.onCompleted: {
append([ append([
{ {
key: "welcome", key: "welcome",
iconSource: ModelsData.tokens.inch, iconSource: ModelsData.assets.inch,
name: "#welcome" name: "#welcome"
}, },
{ {
key: "general", key: "general",
iconSource: ModelsData.tokens.inch, iconSource: ModelsData.assets.inch,
name: "#general" name: "#general"
} }
]) ])

View File

@ -68,21 +68,21 @@ Pane {
} }
} }
readonly property ListModel tokensModel: ListModel { readonly property ListModel assetsModel: ListModel {
ListElement { ListElement {
key: "socks"; iconSource: ""; name: "Unisocks"; shortName: "SOCKS"; category: "Community tokens" key: "socks"; iconSource: ""; name: "Unisocks"; shortName: "SOCKS"; category: "Community assets"
} }
ListElement { ListElement {
key: "zrx"; iconSource: ""; name: "Ox"; shortName: "ZRX"; category: "Listed tokens" key: "zrx"; iconSource: ""; name: "Ox"; shortName: "ZRX"; category: "Listed assets"
} }
ListElement { ListElement {
key: "1inch"; iconSource: ""; name: "1inch"; shortName: "ZRX"; category: "Listed tokens" key: "1inch"; iconSource: ""; name: "1inch"; shortName: "ZRX"; category: "Listed assets"
} }
ListElement { ListElement {
key: "Aave"; iconSource: ""; name: "Aave"; shortName: "AAVE"; category: "Listed tokens"} key: "Aave"; iconSource: ""; name: "Aave"; shortName: "AAVE"; category: "Listed assets"}
ListElement { ListElement {
key: "Amp"; iconSource: ""; name: "Amp"; shortName: "AMP"; category: "Listed tokens" key: "Amp"; iconSource: ""; name: "Amp"; shortName: "AMP"; category: "Listed assets"
} }
} }
} }

View File

@ -4,9 +4,9 @@ import QtQuick 2.14
ListModel { ListModel {
Component.onCompleted: append([ Component.onCompleted: append([
{image: ModelsData.tokens.socks}, {image: ModelsData.assets.socks},
{image: ModelsData.tokens.zrx}, {image: ModelsData.assets.zrx},
{image: ModelsData.tokens.inch}, {image: ModelsData.assets.inch},
{image: ModelsData.collectibles.anniversary}, {image: ModelsData.collectibles.anniversary},
{image: ModelsData.collectibles.cryptoKitties}, {image: ModelsData.collectibles.cryptoKitties},
{image: ModelsData.collectibles.kitty1}, {image: ModelsData.collectibles.kitty1},

View File

@ -5,38 +5,38 @@ ListModel {
append([ append([
{ {
key: "socks", key: "socks",
iconSource: ModelsData.tokens.socks, iconSource: ModelsData.assets.socks,
name: "Unisocks", name: "Unisocks",
shortName: "SOCKS", shortName: "SOCKS",
category: "Community tokens" category: "Community assets"
}, },
{ {
key: "zrx", key: "zrx",
iconSource: ModelsData.tokens.zrx, iconSource: ModelsData.assets.zrx,
name: "Ox", name: "Ox",
shortName: "ZRX", shortName: "ZRX",
category: "Listed tokens" category: "Listed assets"
}, },
{ {
key: "1inch", key: "1inch",
iconSource: ModelsData.tokens.inch, iconSource: ModelsData.assets.inch,
name: "1inch", name: "1inch",
shortName: "ZRX", shortName: "ZRX",
category: "Listed tokens" category: "Listed assets"
}, },
{ {
key: "Aave", key: "Aave",
iconSource: ModelsData.tokens.aave, iconSource: ModelsData.assets.aave,
name: "Aave", name: "Aave",
shortName: "AAVE", shortName: "AAVE",
category: "Listed tokens" category: "Listed assets"
}, },
{ {
key: "Amp", key: "Amp",
iconSource: ModelsData.tokens.amp, iconSource: ModelsData.assets.amp,
name: "Amp", name: "Amp",
shortName: "AMP", shortName: "AMP",
category: "Listed tokens" category: "Listed assets"
} }
]) ])
} }

View File

@ -33,7 +33,7 @@ QtObject {
"Software dev":"👩‍💻","Sports":"⚽️","Tech":"📱","Travel":"🗺","Vehicles":"🚕","Web3":"🌐"}) "Software dev":"👩‍💻","Sports":"⚽️","Tech":"📱","Travel":"🗺","Vehicles":"🚕","Web3":"🌐"})
readonly property QtObject tokens: QtObject { readonly property QtObject assets: QtObject {
readonly property string socks: Style.png("tokens/SOCKS") readonly property string socks: Style.png("tokens/SOCKS")
readonly property string zrx: Style.png("tokens/ZRX") readonly property string zrx: Style.png("tokens/ZRX")
readonly property string inch: Style.png("tokens/CUSTOM-TOKEN") readonly property string inch: Style.png("tokens/CUSTOM-TOKEN")

View File

@ -35,19 +35,19 @@ ListModel {
var holdings = [] var holdings = []
holdings.push({ holdings.push({
operator: OperatorsUtils.Operators.None, operator: OperatorsUtils.Operators.None,
type: HoldingTypes.Type.Token, type: HoldingTypes.Type.Asset,
key: "SOCKS", key: "SOCKS",
name: "SOCKS", name: "SOCKS",
amount: 1.2, amount: 1.2,
imageSource: ModelsData.tokens.socks imageSource: ModelsData.assets.socks
}); });
holdings.push({ holdings.push({
operator: OperatorsUtils.Operators.Or, operator: OperatorsUtils.Operators.Or,
type: HoldingTypes.Type.Token, type: HoldingTypes.Type.Asset,
key: "ZRX", key: "ZRX",
name: "ZRX", name: "ZRX",
amount: 15, amount: 15,
imageSource: ModelsData.tokens.zrx imageSource: ModelsData.assets.zrx
}); });
holdings.push({ holdings.push({
operator: OperatorsUtils.Operators.And, operator: OperatorsUtils.Operators.And,
@ -76,7 +76,7 @@ ListModel {
key: "AMP", key: "AMP",
name: "AMP", name: "AMP",
amount: 11, amount: 11,
imageSource: ModelsData.tokens.amp imageSource: ModelsData.assets.amp
}); });
return holdings return holdings
} }
@ -85,12 +85,12 @@ ListModel {
var channels = [] var channels = []
channels.push({ channels.push({
key: "help", key: "help",
iconSource: ModelsData.tokens.zrx, iconSource: ModelsData.assets.zrx,
name: "#help" name: "#help"
}); });
channels.push({ channels.push({
key: "faq", key: "faq",
iconSource: ModelsData.tokens.zrx, iconSource: ModelsData.assets.zrx,
name: "#faq" name: "#faq"
}); });
return channels return channels
@ -100,12 +100,12 @@ ListModel {
var channels = [] var channels = []
channels.push({ channels.push({
key: "welcome", key: "welcome",
iconSource: ModelsData.tokens.inch, iconSource: ModelsData.assets.inch,
name: "#welcome" name: "#welcome"
}); });
channels.push({ channels.push({
key: "general", key: "general",
iconSource: ModelsData.tokens.inch, iconSource: ModelsData.assets.inch,
name: "#general" name: "#general"
}); });
return channels return channels

View File

@ -2,8 +2,8 @@ singleton ModelsData 1.0 ModelsData.qml
IconModel 1.0 IconModel.qml IconModel 1.0 IconModel.qml
BannerModel 1.0 BannerModel.qml BannerModel 1.0 BannerModel.qml
UsersModel 1.0 UsersModel.qml UsersModel 1.0 UsersModel.qml
TokensModel 1.0 TokensModel.qml AssetsModel 1.0 AssetsModel.qml
CollectiblesModel 1.0 CollectiblesModel.qml CollectiblesModel 1.0 CollectiblesModel.qml
ChannelsModel 1.0 ChannelsModel.qml ChannelsModel 1.0 ChannelsModel.qml
PermissionsModel 1.0 PermissionsModel.qml PermissionsModel 1.0 PermissionsModel.qml
TokensCollectiblesIconsModel 1.0 TokensCollectiblesIconsModel.qml AssetsCollectiblesIconsModel 1.0 AssetsCollectiblesIconsModel.qml

View File

@ -10,8 +10,8 @@ import shared.controls 1.0
ColumnLayout { ColumnLayout {
id: root id: root
property alias tokenName: pickerButton.text property alias assetName: pickerButton.text
property url tokenImage property url assetImage
property alias amountText: amountInput.text property alias amountText: amountInput.text
property alias amount: amountInput.amount property alias amount: amountInput.amount
readonly property bool amountValid: amountInput.valid && amountInput.text.length > 0 readonly property bool amountValid: amountInput.valid && amountInput.text.length > 0
@ -33,7 +33,7 @@ ColumnLayout {
bgColor: Theme.palette.baseColor5 bgColor: Theme.palette.baseColor5
contentColor: Theme.palette.directColor1 contentColor: Theme.palette.directColor1
font.pixelSize: 13 font.pixelSize: 13
asset.name: root.tokenImage asset.name: root.assetImage
onClicked: pickerClicked() onClicked: pickerClicked()
} }

View File

@ -16,14 +16,14 @@ Item {
id: root id: root
property var store property var store
property int type: ExtendedDropdownContent.Type.Tokens property int type: ExtendedDropdownContent.Type.Assets
readonly property bool canGoBack: root.state !== d.listView_depth1_State readonly property bool canGoBack: root.state !== d.listView_depth1_State
signal itemClicked(string key, string name, url iconSource) signal itemClicked(string key, string name, url iconSource)
enum Type{ enum Type{
Tokens, Assets,
Collectibles Collectibles
} }
@ -76,13 +76,13 @@ Item {
PropertyChanges { PropertyChanges {
target: contentLoader target: contentLoader
sourceComponent: root.type === ExtendedDropdownContent.Type.Tokens sourceComponent: root.type === ExtendedDropdownContent.Type.Assets
? tokensListView : collectiblesListView ? assetsListView : collectiblesListView
} }
PropertyChanges { PropertyChanges {
target: d target: d
currentModel: root.type === ExtendedDropdownContent.Type.Tokens currentModel: root.type === ExtendedDropdownContent.Type.Assets
? root.store.tokensModel : collectiblesFilteredModel//root.store.collectiblesModel ? root.store.assetsModel : collectiblesFilteredModel//root.store.collectiblesModel
isFilterOptionVisible: false isFilterOptionVisible: false
} }
PropertyChanges { PropertyChanges {
@ -257,18 +257,18 @@ Item {
} }
Component { Component {
id: tokensListView id: assetsListView
ListDropdownContent { ListDropdownContent {
headerModel: ListModel { headerModel: ListModel {
ListElement { key: "MINT"; icon: "add"; iconSize: 16; description: qsTr("Mint token"); rotation: 0; spacing: 8 } ListElement { key: "MINT"; icon: "add"; iconSize: 16; description: qsTr("Mint asset"); rotation: 0; spacing: 8 }
ListElement { key: "IMPORT"; icon: "invite-users"; iconSize: 16; description: qsTr("Import existing token"); rotation: 180; spacing: 8 } ListElement { key: "IMPORT"; icon: "invite-users"; iconSize: 16; description: qsTr("Import existing asset"); rotation: 180; spacing: 8 }
} }
isHeaderVisible: false // TEMPORARILY hidden. These 2 header options will be implemented after MVP. isHeaderVisible: false // TEMPORARILY hidden. These 2 header options will be implemented after MVP.
model: d.currentModel model: d.currentModel
onHeaderItemClicked: { onHeaderItemClicked: {
if(key === "MINT") console.log("TODO: Mint token") if(key === "MINT") console.log("TODO: Mint asset")
else if(key === "IMPORT") console.log("TODO: Import existing token") else if(key === "IMPORT") console.log("TODO: Import existing asset")
} }
onItemClicked: root.itemClicked(key, shortName, iconSource) onItemClicked: root.itemClicked(key, shortName, iconSource)
} }

View File

@ -2,6 +2,6 @@ import QtQml 2.14
QtObject { QtObject {
enum Type { enum Type {
Token, Collectible, Ens Asset, Collectible, Ens
} }
} }

View File

@ -15,8 +15,8 @@ StatusDropdown {
property var store property var store
property string tokenKey: "" property string assetKey: ""
property real tokenAmount: 0 property real assetAmount: 0
property string collectibleKey: "" property string collectibleKey: ""
property real collectibleAmount: 1 property real collectibleAmount: 1
@ -25,24 +25,24 @@ StatusDropdown {
property int ensType: EnsPanel.EnsType.Any property int ensType: EnsPanel.EnsType.Any
property string ensDomainName: "" property string ensDomainName: ""
signal addToken(string key, real amount) signal addAsset(string key, real amount)
signal addCollectible(string key, real amount) signal addCollectible(string key, real amount)
signal addEns(bool any, string customDomain) signal addEns(bool any, string customDomain)
signal updateToken(string key, real amount) signal updateAsset(string key, real amount)
signal updateCollectible(string key, real amount) signal updateCollectible(string key, real amount)
signal updateEns(bool any, string customDomain) signal updateEns(bool any, string customDomain)
signal removeClicked signal removeClicked
function reset() { function reset() {
d.currentHoldingType = HoldingTypes.Type.Token d.currentHoldingType = HoldingTypes.Type.Asset
d.tokenAmountText = "" d.assetAmountText = ""
d.collectibleAmountText = "" d.collectibleAmountText = ""
root.tokenKey = "" root.assetKey = ""
root.collectibleKey = "" root.collectibleKey = ""
root.tokenAmount = 0 root.assetAmount = 0
root.collectibleAmount = 1 root.collectibleAmount = 1
root.collectiblesSpecificAmount = false root.collectiblesSpecificAmount = false
root.ensType = EnsPanel.EnsType.Any root.ensType = EnsPanel.EnsType.Any
@ -87,7 +87,7 @@ StatusDropdown {
id: d id: d
// Internal management properties and signals: // Internal management properties and signals:
readonly property bool tokensReady: root.tokenAmount > 0 && root.tokenKey readonly property bool assetsReady: root.assetAmount > 0 && root.assetKey
readonly property bool collectiblesReady: root.collectibleAmount > 0 && root.collectibleKey readonly property bool collectiblesReady: root.collectibleAmount > 0 && root.collectibleKey
readonly property bool ensReady: root.ensType === EnsPanel.EnsType.Any || d.ensDomainNameValid readonly property bool ensReady: root.ensType === EnsPanel.EnsType.Any || d.ensDomainNameValid
@ -96,12 +96,12 @@ StatusDropdown {
readonly property string extendedState: "EXTENDED" readonly property string extendedState: "EXTENDED"
property int holdingsTabMode: HoldingsTabs.Mode.Add property int holdingsTabMode: HoldingsTabs.Mode.Add
property int extendedDropdownType: ExtendedDropdownContent.Type.Tokens property int extendedDropdownType: ExtendedDropdownContent.Type.Assets
property string tokenAmountText: "" property string assetAmountText: ""
property string collectibleAmountText: "" property string collectibleAmountText: ""
property int currentHoldingType: HoldingTypes.Type.Token property int currentHoldingType: HoldingTypes.Type.Asset
property bool ensDomainNameValid: false property bool ensDomainNameValid: false
@ -125,7 +125,7 @@ StatusDropdown {
readonly property int backButtonHeight: 24 readonly property int backButtonHeight: 24
readonly property int backButtonToContentSpace: 8 readonly property int backButtonToContentSpace: 8
readonly property string defaultTokenNameText: qsTr("Choose token") readonly property string defaultAssetNameText: qsTr("Choose asset")
readonly property string defaultCollectibleNameText: qsTr("Choose collectible") readonly property string defaultCollectibleNameText: qsTr("Choose collectible")
} }
@ -209,9 +209,9 @@ StatusDropdown {
id: holdingsTabs id: holdingsTabs
readonly property var holdingTypes: [ readonly property var holdingTypes: [
HoldingTypes.Type.Token, HoldingTypes.Type.Collectible, HoldingTypes.Type.Ens HoldingTypes.Type.Asset, HoldingTypes.Type.Collectible, HoldingTypes.Type.Ens
] ]
readonly property var labels: [qsTr("Token"), qsTr("Collectible"), qsTr("ENS")] readonly property var labels: [qsTr("Asset"), qsTr("Collectible"), qsTr("ENS")]
readonly property bool extendedHeight: readonly property bool extendedHeight:
d.currentHoldingType === HoldingTypes.Type.Collectible && collectiblesSpecificAmount || d.currentHoldingType === HoldingTypes.Type.Collectible && collectiblesSpecificAmount ||
@ -223,8 +223,8 @@ StatusDropdown {
states: [ states: [
State { State {
name: HoldingTypes.Type.Token name: HoldingTypes.Type.Asset
PropertyChanges {target: holdingsTabs; sourceComponent: tokensLayout; addOrUpdateButtonEnabled: d.tokensReady} PropertyChanges {target: holdingsTabs; sourceComponent: assetsLayout; addOrUpdateButtonEnabled: d.assetsReady}
}, },
State { State {
name: HoldingTypes.Type.Collectible name: HoldingTypes.Type.Collectible
@ -258,52 +258,52 @@ StatusDropdown {
} }
Component { Component {
id: tokensLayout id: assetsLayout
TokensPanel { AssetsPanel {
id: tokensPanel id: assetsPanel
tokenName: d.defaultTokenNameText assetName: d.defaultAssetNameText
amountText: d.tokenAmountText amountText: d.assetAmountText
onAmountTextChanged: d.tokenAmountText = amountText onAmountTextChanged: d.assetAmountText = amountText
readonly property real effectiveAmount: amountValid ? amount : 0 readonly property real effectiveAmount: amountValid ? amount : 0
onEffectiveAmountChanged: root.tokenAmount = effectiveAmount onEffectiveAmountChanged: root.assetAmount = effectiveAmount
onPickerClicked: { onPickerClicked: {
d.extendedDropdownType = ExtendedDropdownContent.Type.Tokens d.extendedDropdownType = ExtendedDropdownContent.Type.Assets
statesStack.push(d.extendedState) statesStack.push(d.extendedState)
} }
readonly property string tokenKey: root.tokenKey readonly property string assetKey: root.assetKey
onTokenKeyChanged: { onAssetKeyChanged: {
const modelItem = CommunityPermissionsHelpers.getTokenByKey( const modelItem = CommunityPermissionsHelpers.getAssetByKey(
store.tokensModel, tokenKey) store.assetsModel, assetKey)
if (modelItem) { if (modelItem) {
tokensPanel.tokenName = modelItem.shortName assetsPanel.assetName = modelItem.shortName
tokensPanel.tokenImage = modelItem.iconSource assetsPanel.assetImage = modelItem.iconSource
} else { } else {
tokensPanel.tokenName = d.defaultTokenNameText assetsPanel.assetName = d.defaultAssetNameText
tokensPanel.tokenImage = "" assetsPanel.assetImage = ""
} }
} }
Component.onCompleted: { Component.onCompleted: {
if (d.tokenAmountText.length === 0 && root.tokenAmount) if (d.assetAmountText.length === 0 && root.assetAmount)
tokensPanel.setAmount(root.tokenAmount) assetsPanel.setAmount(root.assetAmount)
} }
Connections { Connections {
target: d target: d
function onAddClicked() { function onAddClicked() {
root.addToken(root.tokenKey, root.tokenAmount) root.addAsset(root.assetKey, root.assetAmount)
} }
function onUpdateClicked() { function onUpdateClicked() {
root.updateToken(root.tokenKey, root.tokenAmount) root.updateAsset(root.assetKey, root.assetAmount)
} }
} }
} }
@ -405,8 +405,8 @@ StatusDropdown {
onItemClicked: { onItemClicked: {
statesStack.pop() statesStack.pop()
if(d.extendedDropdownType === ExtendedDropdownContent.Type.Tokens) if(d.extendedDropdownType === ExtendedDropdownContent.Type.Assets)
root.tokenKey = key root.assetKey = key
else else
root.collectibleKey = key root.collectibleKey = key
} }

View File

@ -17,8 +17,8 @@ QtObject {
} }
} }
function getTokenByKey(tokensModel, key) { function getAssetByKey(assetsModel, key) {
return d.getByKey(tokensModel, key) return d.getByKey(assetsModel, key)
} }
function getCollectibleByKey(collectiblesModel, key) { function getCollectibleByKey(collectiblesModel, key) {

View File

@ -10,12 +10,12 @@ QtObject {
property var permissionsModel: ListModel {} // Backend permissions list object model asignement. Please check the current expected data in qml defined in `createPermissions` method property var permissionsModel: ListModel {} // Backend permissions list object model asignement. Please check the current expected data in qml defined in `createPermissions` method
// TODO: Replace to real data, now dummy model // TODO: Replace to real data, now dummy model
property var tokensModel: ListModel { property var assetsModel: ListModel {
ListElement {key: "socks"; iconSource: "qrc:imports/assets/png/tokens/SOCKS.png"; name: "Unisocks"; shortName: "SOCKS"; category: "Community tokens"} ListElement {key: "socks"; iconSource: "qrc:imports/assets/png/tokens/SOCKS.png"; name: "Unisocks"; shortName: "SOCKS"; category: "Community assets"}
ListElement {key: "zrx"; iconSource: "qrc:imports/assets/png/tokens/ZRX.png"; name: "Ox"; shortName: "ZRX"; category: "Listed tokens"} ListElement {key: "zrx"; iconSource: "qrc:imports/assets/png/tokens/ZRX.png"; name: "Ox"; shortName: "ZRX"; category: "Listed assets"}
ListElement {key: "1inch"; iconSource: "qrc:imports/assets/png/tokens/CUSTOM-TOKEN.png"; name: "1inch"; shortName: "ZRX"; category: "Listed tokens"} ListElement {key: "1inch"; iconSource: "qrc:imports/assets/png/tokens/CUSTOM-TOKEN.png"; name: "1inch"; shortName: "ZRX"; category: "Listed assets"}
ListElement {key: "Aave"; iconSource: "qrc:imports/assets/png/tokens/CUSTOM-TOKEN.png"; name: "Aave"; shortName: "AAVE"; category: "Listed tokens"} ListElement {key: "Aave"; iconSource: "qrc:imports/assets/png/tokens/CUSTOM-TOKEN.png"; name: "Aave"; shortName: "AAVE"; category: "Listed assets"}
ListElement {key: "Amp"; iconSource: "qrc:imports/assets/png/tokens/CUSTOM-TOKEN.png"; name: "Amp"; shortName: "AMP"; category: "Listed tokens"} ListElement {key: "Amp"; iconSource: "qrc:imports/assets/png/tokens/CUSTOM-TOKEN.png"; name: "Amp"; shortName: "AMP"; category: "Listed assets"}
} }
// TODO: Replace to real data, now dummy model // TODO: Replace to real data, now dummy model
@ -135,7 +135,7 @@ QtObject {
function setHoldingsTextFormat(type, name, amount) { function setHoldingsTextFormat(type, name, amount) {
switch (type) { switch (type) {
case HoldingTypes.Type.Token: case HoldingTypes.Type.Asset:
case HoldingTypes.Type.Collectible: case HoldingTypes.Type.Collectible:
return `${LocaleUtils.numberToLocaleString(amount)} ${name}` return `${LocaleUtils.numberToLocaleString(amount)} ${name}`
case HoldingTypes.Type.Ens: case HoldingTypes.Type.Ens:

View File

@ -216,10 +216,10 @@ StatusScrollView {
d.dirtyValues.holdingsModel.append({ type, key, name, amount, imageSource }) d.dirtyValues.holdingsModel.append({ type, key, name, amount, imageSource })
} }
onAddToken: { onAddAsset: {
const modelItem = CommunityPermissionsHelpers.getTokenByKey( const modelItem = CommunityPermissionsHelpers.getAssetByKey(
store.tokensModel, key) store.assetsModel, key)
addItem(HoldingTypes.Type.Token, modelItem, amount) addItem(HoldingTypes.Type.Asset, modelItem, amount)
dropdown.close() dropdown.close()
} }
@ -239,13 +239,13 @@ StatusScrollView {
dropdown.close() dropdown.close()
} }
onUpdateToken: { onUpdateAsset: {
const modelItem = CommunityPermissionsHelpers.getTokenByKey( const modelItem = CommunityPermissionsHelpers.getAssetByKey(
store.tokensModel, key) store.assetsModel, key)
const name = modelItem.shortName ? modelItem.shortName : modelItem.name const name = modelItem.shortName ? modelItem.shortName : modelItem.name
const imageSource = modelItem.iconSource.toString() const imageSource = modelItem.iconSource.toString()
d.dirtyValues.holdingsModel.set(tokensSelector.editedIndex, { type: HoldingTypes.Type.Token, key, name, amount, imageSource }) d.dirtyValues.holdingsModel.set(tokensSelector.editedIndex, { type: HoldingTypes.Type.Asset, key, name, amount, imageSource })
d.triggerDirtyTool = !d.triggerDirtyTool d.triggerDirtyTool = !d.triggerDirtyTool
dropdown.close() dropdown.close()
} }
@ -295,9 +295,9 @@ StatusScrollView {
const modelItem = tokensSelector.itemsModel.get(index) const modelItem = tokensSelector.itemsModel.get(index)
switch(modelItem.type) { switch(modelItem.type) {
case HoldingTypes.Type.Token: case HoldingTypes.Type.Asset:
dropdown.tokenKey = modelItem.key dropdown.assetKey = modelItem.key
dropdown.tokenAmount = modelItem.amount dropdown.assetAmount = modelItem.amount
break break
case HoldingTypes.Type.Collectible: case HoldingTypes.Type.Collectible:
dropdown.collectibleKey = modelItem.key dropdown.collectibleKey = modelItem.key