From 013d7a8373f21fd681b03d0cf486955b781632cd Mon Sep 17 00:00:00 2001 From: Khushboo Mehta Date: Sat, 13 Jan 2024 08:43:05 +0530 Subject: [PATCH] fix(@desktop/wallet): Update the new tokens service in Profile showcase panel --- storybook/pages/ProfileShowcaseAssetsPanelPage.qml | 12 +----------- ui/app/AppLayouts/Profile/ProfileLayout.qml | 4 ---- .../Profile/controls/AssetShowcaseDelegate.qml | 12 +----------- .../Profile/panels/ProfileShowcaseAssetsPanel.qml | 3 --- ui/app/AppLayouts/Profile/stores/WalletStore.qml | 1 + ui/app/AppLayouts/Profile/views/MyProfileView.qml | 8 -------- .../Profile/views/profile/MyProfileSettingsView.qml | 10 +--------- 7 files changed, 4 insertions(+), 46 deletions(-) diff --git a/storybook/pages/ProfileShowcaseAssetsPanelPage.qml b/storybook/pages/ProfileShowcaseAssetsPanelPage.qml index d6a5e5c222..217dd4e46c 100644 --- a/storybook/pages/ProfileShowcaseAssetsPanelPage.qml +++ b/storybook/pages/ProfileShowcaseAssetsPanelPage.qml @@ -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}) - } } } diff --git a/ui/app/AppLayouts/Profile/ProfileLayout.qml b/ui/app/AppLayouts/Profile/ProfileLayout.qml index fc64f4b4a0..9e9f99d1a4 100644 --- a/ui/app/AppLayouts/Profile/ProfileLayout.qml +++ b/ui/app/AppLayouts/Profile/ProfileLayout.qml @@ -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 diff --git a/ui/app/AppLayouts/Profile/controls/AssetShowcaseDelegate.qml b/ui/app/AppLayouts/Profile/controls/AssetShowcaseDelegate.qml index c9522a7531..7169359519 100644 --- a/ui/app/AppLayouts/Profile/controls/AssetShowcaseDelegate.qml +++ b/ui/app/AppLayouts/Profile/controls/AssetShowcaseDelegate.qml @@ -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" - } } diff --git a/ui/app/AppLayouts/Profile/panels/ProfileShowcaseAssetsPanel.qml b/ui/app/AppLayouts/Profile/panels/ProfileShowcaseAssetsPanel.qml index ec22fa6347..dbcaea5876 100644 --- a/ui/app/AppLayouts/Profile/panels/ProfileShowcaseAssetsPanel.qml +++ b/ui/app/AppLayouts/Profile/panels/ProfileShowcaseAssetsPanel.qml @@ -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]) diff --git a/ui/app/AppLayouts/Profile/stores/WalletStore.qml b/ui/app/AppLayouts/Profile/stores/WalletStore.qml index 40ac9c4e00..5449396683 100644 --- a/ui/app/AppLayouts/Profile/stores/WalletStore.qml +++ b/ui/app/AppLayouts/Profile/stores/WalletStore.qml @@ -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 diff --git a/ui/app/AppLayouts/Profile/views/MyProfileView.qml b/ui/app/AppLayouts/Profile/views/MyProfileView.qml index f1da1e8abc..c33c337069 100644 --- a/ui/app/AppLayouts/Profile/views/MyProfileView.qml +++ b/ui/app/AppLayouts/Profile/views/MyProfileView.qml @@ -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) diff --git a/ui/app/AppLayouts/Profile/views/profile/MyProfileSettingsView.qml b/ui/app/AppLayouts/Profile/views/profile/MyProfileSettingsView.qml index cafab30dbd..adec91e558 100644 --- a/ui/app/AppLayouts/Profile/views/profile/MyProfileSettingsView.qml +++ b/ui/app/AppLayouts/Profile/views/profile/MyProfileSettingsView.qml @@ -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) - } } } }