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 Models 1.0
import AppLayouts.Wallet.stores 1.0
SplitView {
id: root
@ -28,8 +26,6 @@ SplitView {
communityTokensStore: CommunityTokensStore {}
}
readonly property WalletAssetsStore walletAssetStore: WalletAssetsStore{}
ListModel {
id: assetsModel
@ -130,14 +126,8 @@ SplitView {
ProfileShowcaseAssetsPanel {
id: showcasePanel
width: 500
baseModel: walletAssetStore.builtAccountAssetsModel
baseModel: assetsModel
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 networkConnectionStore
required property TokensStore tokensStore
required property WalletAssetsStore walletAssetsStore
required property SharedStores.CurrenciesStore currencyStore
backButtonName: root.store.backButtonName
notificationCount: activityCenterStore.unreadNotificationsCount
@ -124,8 +122,6 @@ StatusSectionLayout {
implicitWidth: parent.width
implicitHeight: parent.height
walletAssetsStore: root.walletAssetsStore
currencyStore: root.currencyStore
walletStore: root.store.walletStore
profileStore: root.store.profileStore
privacyStore: root.store.privacyStore

View File

@ -1,22 +1,12 @@
import QtQuick 2.15
import StatusQ 0.1
import StatusQ.Core 0.1
import utils 1.0
ShowcaseDelegate {
property var getCurrencyAmount: function(){}
title: !!showcaseObj && !!showcaseObj.name ? showcaseObj.name : ""
secondaryTitle: !!showcaseObj && !!showcaseObj.decimals && !!showcaseObj.symbol ?
LocaleUtils.currencyAmountToLocaleString(root.getCurrencyAmount(balancesAggregator.value/(10 ** showcaseObj.decimals), showcaseObj.symbol)) :
Qt.locale().zeroDigit
secondaryTitle: !!showcaseObj ? LocaleUtils.currencyAmountToLocaleString(showcaseObj.enabledNetworkBalance) : Qt.locale().zeroDigit
hasImage: true
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 {
id: root
property var getCurrencyAmount: function(){}
keyRole: "symbol"
roleNames: ["symbol", "name", "enabledNetworkBalance"].concat(showcaseRoles)
filterFunc: (modelData) => modelData.symbol !== "" && !showcaseModel.hasItemInShowcase(modelData.symbol)
@ -20,7 +18,6 @@ ProfileShowcasePanel {
showcaseObj: modelData
dragParent: dragParentData
visualIndex: visualIndexData
getCurrencyAmount: root.getCurrencyAmount()
onShowcaseVisibilityRequested: {
var tmpObj = Object()
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
property var overview: walletSectionOverview
property var assets: walletSectionAssets.assets
property var accounts: Global.appIsReady? accountsModule.accounts : null
property var originModel: accountsModule.keyPairModel

View File

@ -6,7 +6,6 @@ import utils 1.0
import shared 1.0
import shared.panels 1.0
import shared.popups 1.0
import shared.stores 1.0
import shared.controls.chat 1.0
import "../popups"
@ -19,8 +18,6 @@ import StatusQ.Core.Theme 0.1
import StatusQ.Components 0.1
import StatusQ.Controls 0.1
import AppLayouts.Wallet.stores 1.0
SettingsContentBase {
id: root
@ -28,9 +25,6 @@ SettingsContentBase {
property ProfileStore profileStore
property PrivacyStore privacyStore
property ContactsStore contactsStore
required property WalletAssetsStore walletAssetsStore
required property CurrenciesStore currencyStore
property var communitiesModel
titleRowComponentLoader.sourceComponent: StatusButton {
@ -81,8 +75,6 @@ SettingsContentBase {
privacyStore: root.privacyStore
walletStore: root.walletStore
communitiesModel: root.communitiesModel
walletAssetsStore: root.walletAssetsStore
currencyStore: root.currencyStore
onVisibleChanged: if (visible) stackLayout.Layout.preferredHeight = 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 shared 1.0
import shared.stores 1.0
import shared.panels 1.0
import shared.popups 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.Controls 0.1
import AppLayouts.Wallet.stores 1.0
ColumnLayout {
id: root
@ -29,8 +26,6 @@ ColumnLayout {
property PrivacyStore privacyStore
property ProfileStore profileStore
property WalletStore walletStore
required property WalletAssetsStore walletAssetsStore
required property CurrenciesStore currencyStore
property var communitiesModel
property bool hasAnyProfileShowcaseChanges: false
@ -249,12 +244,9 @@ ColumnLayout {
id: profileShowcaseAssetsPanel
Layout.minimumHeight: implicitHeight
Layout.maximumHeight: implicitHeight
baseModel: root.walletAssetsStore.groupedAccountAssetsModel
baseModel: root.walletStore.assets
showcaseModel: root.profileStore.profileShowcaseAssetsModel
onShowcaseEntryChanged: hasAnyProfileShowcaseChanges = true
getCurrencyAmount: function(amount, symbol) {
return root.currencyStore.getCurrencyAmount(amount, symbol)
}
}
}
}