From 90cfc0842ad010290d05c1e9aef21ee75fa77bfb Mon Sep 17 00:00:00 2001 From: Cuteivist Date: Tue, 14 Nov 2023 11:35:18 +0100 Subject: [PATCH] bug(@desktop/wallet): Fix new transaction button visuals (#12589) * Fixed duplicated wallet activity fetch request * Fixed not resetting tab on wallet account add --- ui/app/AppLayouts/Wallet/WalletLayout.qml | 1 + ui/app/AppLayouts/Wallet/panels/ActivityFilterPanel.qml | 6 ++++-- ui/app/AppLayouts/Wallet/stores/ActivityFiltersStore.qml | 8 ++++---- ui/imports/shared/views/HistoryView.qml | 7 +++++++ 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/ui/app/AppLayouts/Wallet/WalletLayout.qml b/ui/app/AppLayouts/Wallet/WalletLayout.qml index 5ef000f9a7..96853934ab 100644 --- a/ui/app/AppLayouts/Wallet/WalletLayout.qml +++ b/ui/app/AppLayouts/Wallet/WalletLayout.qml @@ -113,6 +113,7 @@ Item { root.resetView() RootStore.setFillterAllAddresses() } + onCurrentAddressChanged: root.resetView() onShowSavedAddressesChanged: { if(showSavedAddresses) rightPanelStackView.replace(cmpSavedAddresses) diff --git a/ui/app/AppLayouts/Wallet/panels/ActivityFilterPanel.qml b/ui/app/AppLayouts/Wallet/panels/ActivityFilterPanel.qml index 87da2cd2fc..7d67468fe9 100644 --- a/ui/app/AppLayouts/Wallet/panels/ActivityFilterPanel.qml +++ b/ui/app/AppLayouts/Wallet/panels/ActivityFilterPanel.qml @@ -18,6 +18,7 @@ Column { property var activityFilterStore property var store property bool isLoading: false + property bool hideNoResults: false spacing: 12 @@ -212,14 +213,15 @@ Column { } Separator { - visible: noResultsAfterFilter.visible + visible: noResultsAfterFilter.noResults } StatusBaseText { id: noResultsAfterFilter + readonly property bool noResults: !root.isLoading && activityFilterStore.transactionsList.count === 0 && activityFilterStore.filtersSet anchors.horizontalCenter: parent.horizontalCenter anchors.topMargin: 16 - visible: !root.isLoading && activityFilterStore.transactionsList.count === 0 && activityFilterStore.filtersSet + visible: !root.hideNoResults && noResults text: qsTr("No activity items for the current filter") font.pixelSize: Style.current.primaryTextFontSize color: Theme.palette.baseColor1 diff --git a/ui/app/AppLayouts/Wallet/stores/ActivityFiltersStore.qml b/ui/app/AppLayouts/Wallet/stores/ActivityFiltersStore.qml index 693c725666..c3743e7783 100644 --- a/ui/app/AppLayouts/Wallet/stores/ActivityFiltersStore.qml +++ b/ui/app/AppLayouts/Wallet/stores/ActivityFiltersStore.qml @@ -12,7 +12,7 @@ QtObject { property bool autoUpdateFilter: true property var activityController: walletSection.activityController - property bool filtersSet: selectedTime !== Constants.TransactionTimePeriod.All || + readonly property bool filtersSet: selectedTime !== Constants.TransactionTimePeriod.All || typeFilters.length !== 0 || statusFilters.length !== 0 || tokensFilter.length !== 0 || @@ -146,7 +146,7 @@ QtObject { applyTimeRange() } - function applyTimeRange() { + function applyTimeRange(callUpdate = true) { const startTimestamp = d.fromTimestampNoLimit ? activityController.noLimitTimestamp : fromTimestamp/1000 @@ -154,7 +154,7 @@ QtObject { ? activityController.noLimitTimestamp : toTimestamp/1000 activityController.setFilterTime(startTimestamp, endTimestamp) - if (autoUpdateFilter) + if (autoUpdateFilter && callUpdate) activityController.updateFilter() } @@ -259,7 +259,7 @@ QtObject { } function applyAllFilters() { - applyTimeRange() + applyTimeRange(false) activityController.setFilterType(JSON.stringify(typeFilters)) activityController.setFilterStatus(JSON.stringify(statusFilters)) activityController.setFilterAssets(JSON.stringify(tokensFilter), false) diff --git a/ui/imports/shared/views/HistoryView.qml b/ui/imports/shared/views/HistoryView.qml index 27e75be95b..6b83525d93 100644 --- a/ui/imports/shared/views/HistoryView.qml +++ b/ui/imports/shared/views/HistoryView.qml @@ -112,6 +112,7 @@ ColumnLayout { visible: d.isInitialLoading || transactionListRoot.count > 0 || WalletStores.RootStore.currentActivityFiltersStore.filtersSet activityFilterStore: WalletStores.RootStore.currentActivityFiltersStore store: WalletStores.RootStore + hideNoResults: newTransactions.visible isLoading: d.isInitialLoading } } @@ -277,6 +278,12 @@ ColumnLayout { function onNewDataAvailableChanged() { if (!d.lastRefreshTime || ((Date.now() - d.lastRefreshTime) > (1000 * d.maxSecondsBetweenRefresh))) { + // Show `New transactions` button only when filter is applied + if (!WalletStores.RootStore.currentActivityFiltersStore.filtersSet) { + d.refreshData() + return + } + newTransactions.visible = RootStore.newDataAvailable return }