From ee5fb50c292ff7c710259f7e15e519238a3cf24c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Cie=C5=9Blak?= Date: Thu, 17 Oct 2024 13:57:38 +0200 Subject: [PATCH] chore: TokenMarketValuesStore removed from shared/RootStore --- .../Wallet/views/AssetsDetailView.qml | 18 +++++++++++++----- ui/imports/shared/stores/ChartStoreBase.qml | 8 ++++---- ui/imports/shared/stores/RootStore.qml | 2 -- .../shared/stores/TokenBalanceHistoryStore.qml | 8 +++----- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/ui/app/AppLayouts/Wallet/views/AssetsDetailView.qml b/ui/app/AppLayouts/Wallet/views/AssetsDetailView.qml index e5ed4fa24c..855b3b0aa9 100644 --- a/ui/app/AppLayouts/Wallet/views/AssetsDetailView.qml +++ b/ui/app/AppLayouts/Wallet/views/AssetsDetailView.qml @@ -36,11 +36,19 @@ Item { property var networkFilters onNetworkFiltersChanged: d.forceRefreshBalanceStore = true /*required*/ property string address: "" - property SharedStores.TokenBalanceHistoryStore balanceStore: SharedStores.TokenBalanceHistoryStore {} + + SharedStores.TokenBalanceHistoryStore { + id: balanceStore + } + + SharedStores.TokenMarketValuesStore { + id: marketValueStore + } + QtObject { id: d - property SharedStores.TokenMarketValuesStore marketValueStore : root.sharedRootStore.marketValueStore + readonly property string symbol: !!root.token? root.token.symbol?? "" : "" property bool marketDetailsLoading: !!root.token? root.token.marketDetailsLoading?? false : false property bool tokenDetailsLoading: !!root.token? root.token.detailsLoading?? false: false @@ -67,7 +75,7 @@ Item { if(response.historicalData === null || response.historicalData <= 0) return - d.marketValueStore.setTimeAndValueData(response.historicalData, response.range) + marketValueStore.setTimeAndValueData(response.historicalData, response.range) } } @@ -138,7 +146,7 @@ Item { id: graphDetail property int selectedGraphType: AssetsDetailView.GraphType.Price - property SharedStores.TokenMarketValuesStore selectedStore: d.marketValueStore + property SharedStores.TokenMarketValuesStore selectedStore: marketValueStore function dataReady() { return typeof selectedStore != "undefined" @@ -179,7 +187,7 @@ Item { } if(!isTimeRange) { - graphDetail.selectedStore = graphDetail.selectedGraphType === AssetsDetailView.GraphType.Price ? d.marketValueStore : balanceStore + graphDetail.selectedStore = graphDetail.selectedGraphType === AssetsDetailView.GraphType.Price ? marketValueStore : balanceStore } chart.refresh() diff --git a/ui/imports/shared/stores/ChartStoreBase.qml b/ui/imports/shared/stores/ChartStoreBase.qml index afbf7725f7..7f675d0af9 100644 --- a/ui/imports/shared/stores/ChartStoreBase.qml +++ b/ui/imports/shared/stores/ChartStoreBase.qml @@ -1,8 +1,8 @@ -import QtQuick 2.13 +import QtQml 2.15 import utils 1.0 -Item { +QtObject { id: root // @see src/app_service/service/token/async_tasks.nim BalanceHistoryTimeInterval @@ -78,7 +78,7 @@ Item { return d.timeRangeStrToEnumMap.get(str) } - QtObject { + readonly property QtObject _d: QtObject { id: d readonly property int hoursInADay: 24 @@ -101,4 +101,4 @@ Item { } } } -} \ No newline at end of file +} diff --git a/ui/imports/shared/stores/RootStore.qml b/ui/imports/shared/stores/RootStore.qml index 32ff39f2c6..62dcc73f3b 100644 --- a/ui/imports/shared/stores/RootStore.qml +++ b/ui/imports/shared/stores/RootStore.qml @@ -18,8 +18,6 @@ QtObject { required property CurrenciesStore currencyStore - property TokenMarketValuesStore marketValueStore: TokenMarketValuesStore {} - function setNeverAskAboutUnfurlingAgain(value) { localAccountSensitiveSettings.neverAskAboutUnfurlingAgain = value; } diff --git a/ui/imports/shared/stores/TokenBalanceHistoryStore.qml b/ui/imports/shared/stores/TokenBalanceHistoryStore.qml index bbbb70c8c6..48930f309e 100644 --- a/ui/imports/shared/stores/TokenBalanceHistoryStore.qml +++ b/ui/imports/shared/stores/TokenBalanceHistoryStore.qml @@ -1,6 +1,4 @@ -import QtQuick 2.13 - -import StatusQ.Core 0.1 +import QtQml 2.15 import utils 1.0 @@ -11,7 +9,7 @@ ChartStoreBase { readonly property alias tokenSymbol: d.tokenSymbol readonly property alias currencySymbol: d.currencySymbol - QtObject { + readonly property QtObject _d: QtObject { id: d // Data identity received from backend @@ -67,7 +65,7 @@ ChartStoreBase { } } - Connections { + readonly property Connections _c: Connections { target: walletSectionAllTokens function onTokenBalanceHistoryDataReady(balanceHistoryJson: string) {