fix(@desktop/wallet): Update the new tokens service in Profile showcase panel

This commit is contained in:
Khushboo Mehta 2024-01-13 08:43:05 +05:30
parent b4002a7120
commit 013d7a8373
7 changed files with 4 additions and 46 deletions

View File

@ -13,8 +13,6 @@ import utils 1.0
import Storybook 1.0 import Storybook 1.0
import Models 1.0 import Models 1.0
import AppLayouts.Wallet.stores 1.0
SplitView { SplitView {
id: root id: root
@ -28,8 +26,6 @@ SplitView {
communityTokensStore: CommunityTokensStore {} communityTokensStore: CommunityTokensStore {}
} }
readonly property WalletAssetsStore walletAssetStore: WalletAssetsStore{}
ListModel { ListModel {
id: assetsModel id: assetsModel
@ -130,14 +126,8 @@ SplitView {
ProfileShowcaseAssetsPanel { ProfileShowcaseAssetsPanel {
id: showcasePanel id: showcasePanel
width: 500 width: 500
baseModel: walletAssetStore.builtAccountAssetsModel baseModel: assetsModel
showcaseModel: inShowcaseAssetsModel showcaseModel: inShowcaseAssetsModel
getCurrencyAmount: function (amount, symbol) {
return ({amount: amount,
symbol: symbol.toUpperCase(),
displayDecimals: 4,
stripTrailingZeroes: false})
}
} }
} }

View File

@ -32,8 +32,6 @@ StatusSectionLayout {
property var emojiPopup property var emojiPopup
property var networkConnectionStore property var networkConnectionStore
required property TokensStore tokensStore required property TokensStore tokensStore
required property WalletAssetsStore walletAssetsStore
required property SharedStores.CurrenciesStore currencyStore
backButtonName: root.store.backButtonName backButtonName: root.store.backButtonName
notificationCount: activityCenterStore.unreadNotificationsCount notificationCount: activityCenterStore.unreadNotificationsCount
@ -124,8 +122,6 @@ StatusSectionLayout {
implicitWidth: parent.width implicitWidth: parent.width
implicitHeight: parent.height implicitHeight: parent.height
walletAssetsStore: root.walletAssetsStore
currencyStore: root.currencyStore
walletStore: root.store.walletStore walletStore: root.store.walletStore
profileStore: root.store.profileStore profileStore: root.store.profileStore
privacyStore: root.store.privacyStore privacyStore: root.store.privacyStore

View File

@ -1,22 +1,12 @@
import QtQuick 2.15 import QtQuick 2.15
import StatusQ 0.1
import StatusQ.Core 0.1 import StatusQ.Core 0.1
import utils 1.0 import utils 1.0
ShowcaseDelegate { ShowcaseDelegate {
property var getCurrencyAmount: function(){}
title: !!showcaseObj && !!showcaseObj.name ? showcaseObj.name : "" title: !!showcaseObj && !!showcaseObj.name ? showcaseObj.name : ""
secondaryTitle: !!showcaseObj && !!showcaseObj.decimals && !!showcaseObj.symbol ? secondaryTitle: !!showcaseObj ? LocaleUtils.currencyAmountToLocaleString(showcaseObj.enabledNetworkBalance) : Qt.locale().zeroDigit
LocaleUtils.currencyAmountToLocaleString(root.getCurrencyAmount(balancesAggregator.value/(10 ** showcaseObj.decimals), showcaseObj.symbol)) :
Qt.locale().zeroDigit
hasImage: true hasImage: true
icon.source: !!showcaseObj ? Constants.tokenIcon(showcaseObj.symbol) : "" icon.source: !!showcaseObj ? Constants.tokenIcon(showcaseObj.symbol) : ""
SumAggregator {
id: balancesAggregator
model: !!showcaseObj && !!showcaseObj.balances ? showcaseObj.balances: null
roleName: "balance"
}
} }

View File

@ -7,8 +7,6 @@ import AppLayouts.Profile.controls 1.0
ProfileShowcasePanel { ProfileShowcasePanel {
id: root id: root
property var getCurrencyAmount: function(){}
keyRole: "symbol" keyRole: "symbol"
roleNames: ["symbol", "name", "enabledNetworkBalance"].concat(showcaseRoles) roleNames: ["symbol", "name", "enabledNetworkBalance"].concat(showcaseRoles)
filterFunc: (modelData) => modelData.symbol !== "" && !showcaseModel.hasItemInShowcase(modelData.symbol) filterFunc: (modelData) => modelData.symbol !== "" && !showcaseModel.hasItemInShowcase(modelData.symbol)
@ -20,7 +18,6 @@ ProfileShowcasePanel {
showcaseObj: modelData showcaseObj: modelData
dragParent: dragParentData dragParent: dragParentData
visualIndex: visualIndexData visualIndex: visualIndexData
getCurrencyAmount: root.getCurrencyAmount()
onShowcaseVisibilityRequested: { onShowcaseVisibilityRequested: {
var tmpObj = Object() var tmpObj = Object()
root.roleNames.forEach(role => tmpObj[role] = showcaseObj[role]) root.roleNames.forEach(role => tmpObj[role] = showcaseObj[role])

View File

@ -25,6 +25,7 @@ QtObject {
} }
// TODO(alaibe): there should be no access to wallet section, create collectible in profile // TODO(alaibe): there should be no access to wallet section, create collectible in profile
property var overview: walletSectionOverview property var overview: walletSectionOverview
property var assets: walletSectionAssets.assets
property var accounts: Global.appIsReady? accountsModule.accounts : null property var accounts: Global.appIsReady? accountsModule.accounts : null
property var originModel: accountsModule.keyPairModel property var originModel: accountsModule.keyPairModel

View File

@ -6,7 +6,6 @@ import utils 1.0
import shared 1.0 import shared 1.0
import shared.panels 1.0 import shared.panels 1.0
import shared.popups 1.0 import shared.popups 1.0
import shared.stores 1.0
import shared.controls.chat 1.0 import shared.controls.chat 1.0
import "../popups" import "../popups"
@ -19,8 +18,6 @@ import StatusQ.Core.Theme 0.1
import StatusQ.Components 0.1 import StatusQ.Components 0.1
import StatusQ.Controls 0.1 import StatusQ.Controls 0.1
import AppLayouts.Wallet.stores 1.0
SettingsContentBase { SettingsContentBase {
id: root id: root
@ -28,9 +25,6 @@ SettingsContentBase {
property ProfileStore profileStore property ProfileStore profileStore
property PrivacyStore privacyStore property PrivacyStore privacyStore
property ContactsStore contactsStore property ContactsStore contactsStore
required property WalletAssetsStore walletAssetsStore
required property CurrenciesStore currencyStore
property var communitiesModel property var communitiesModel
titleRowComponentLoader.sourceComponent: StatusButton { titleRowComponentLoader.sourceComponent: StatusButton {
@ -81,8 +75,6 @@ SettingsContentBase {
privacyStore: root.privacyStore privacyStore: root.privacyStore
walletStore: root.walletStore walletStore: root.walletStore
communitiesModel: root.communitiesModel communitiesModel: root.communitiesModel
walletAssetsStore: root.walletAssetsStore
currencyStore: root.currencyStore
onVisibleChanged: if (visible) stackLayout.Layout.preferredHeight = settingsView.implicitHeight onVisibleChanged: if (visible) stackLayout.Layout.preferredHeight = settingsView.implicitHeight
Component.onCompleted: stackLayout.Layout.preferredHeight = Qt.binding(() => settingsView.implicitHeight) Component.onCompleted: stackLayout.Layout.preferredHeight = Qt.binding(() => settingsView.implicitHeight)

View File

@ -4,7 +4,6 @@ import QtQuick.Layouts 1.13
import utils 1.0 import utils 1.0
import shared 1.0 import shared 1.0
import shared.stores 1.0
import shared.panels 1.0 import shared.panels 1.0
import shared.popups 1.0 import shared.popups 1.0
import shared.controls.chat 1.0 import shared.controls.chat 1.0
@ -19,8 +18,6 @@ import StatusQ.Core.Theme 0.1
import StatusQ.Components 0.1 import StatusQ.Components 0.1
import StatusQ.Controls 0.1 import StatusQ.Controls 0.1
import AppLayouts.Wallet.stores 1.0
ColumnLayout { ColumnLayout {
id: root id: root
@ -29,8 +26,6 @@ ColumnLayout {
property PrivacyStore privacyStore property PrivacyStore privacyStore
property ProfileStore profileStore property ProfileStore profileStore
property WalletStore walletStore property WalletStore walletStore
required property WalletAssetsStore walletAssetsStore
required property CurrenciesStore currencyStore
property var communitiesModel property var communitiesModel
property bool hasAnyProfileShowcaseChanges: false property bool hasAnyProfileShowcaseChanges: false
@ -249,12 +244,9 @@ ColumnLayout {
id: profileShowcaseAssetsPanel id: profileShowcaseAssetsPanel
Layout.minimumHeight: implicitHeight Layout.minimumHeight: implicitHeight
Layout.maximumHeight: implicitHeight Layout.maximumHeight: implicitHeight
baseModel: root.walletAssetsStore.groupedAccountAssetsModel baseModel: root.walletStore.assets
showcaseModel: root.profileStore.profileShowcaseAssetsModel showcaseModel: root.profileStore.profileShowcaseAssetsModel
onShowcaseEntryChanged: hasAnyProfileShowcaseChanges = true onShowcaseEntryChanged: hasAnyProfileShowcaseChanges = true
getCurrencyAmount: function(amount, symbol) {
return root.currencyStore.getCurrencyAmount(amount, symbol)
}
} }
} }
} }