bug(@desktop/wallet): Fix new transaction button visuals (#12589)

* Fixed duplicated wallet activity fetch request
* Fixed not resetting tab on wallet account add
This commit is contained in:
Cuteivist 2023-11-14 11:35:18 +01:00 committed by GitHub
parent 69783e173b
commit 90cfc0842a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 6 deletions

View File

@ -113,6 +113,7 @@ Item {
root.resetView() root.resetView()
RootStore.setFillterAllAddresses() RootStore.setFillterAllAddresses()
} }
onCurrentAddressChanged: root.resetView()
onShowSavedAddressesChanged: { onShowSavedAddressesChanged: {
if(showSavedAddresses) if(showSavedAddresses)
rightPanelStackView.replace(cmpSavedAddresses) rightPanelStackView.replace(cmpSavedAddresses)

View File

@ -18,6 +18,7 @@ Column {
property var activityFilterStore property var activityFilterStore
property var store property var store
property bool isLoading: false property bool isLoading: false
property bool hideNoResults: false
spacing: 12 spacing: 12
@ -212,14 +213,15 @@ Column {
} }
Separator { Separator {
visible: noResultsAfterFilter.visible visible: noResultsAfterFilter.noResults
} }
StatusBaseText { StatusBaseText {
id: noResultsAfterFilter id: noResultsAfterFilter
readonly property bool noResults: !root.isLoading && activityFilterStore.transactionsList.count === 0 && activityFilterStore.filtersSet
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.topMargin: 16 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") text: qsTr("No activity items for the current filter")
font.pixelSize: Style.current.primaryTextFontSize font.pixelSize: Style.current.primaryTextFontSize
color: Theme.palette.baseColor1 color: Theme.palette.baseColor1

View File

@ -12,7 +12,7 @@ QtObject {
property bool autoUpdateFilter: true property bool autoUpdateFilter: true
property var activityController: walletSection.activityController property var activityController: walletSection.activityController
property bool filtersSet: selectedTime !== Constants.TransactionTimePeriod.All || readonly property bool filtersSet: selectedTime !== Constants.TransactionTimePeriod.All ||
typeFilters.length !== 0 || typeFilters.length !== 0 ||
statusFilters.length !== 0 || statusFilters.length !== 0 ||
tokensFilter.length !== 0 || tokensFilter.length !== 0 ||
@ -146,7 +146,7 @@ QtObject {
applyTimeRange() applyTimeRange()
} }
function applyTimeRange() { function applyTimeRange(callUpdate = true) {
const startTimestamp = d.fromTimestampNoLimit const startTimestamp = d.fromTimestampNoLimit
? activityController.noLimitTimestamp ? activityController.noLimitTimestamp
: fromTimestamp/1000 : fromTimestamp/1000
@ -154,7 +154,7 @@ QtObject {
? activityController.noLimitTimestamp ? activityController.noLimitTimestamp
: toTimestamp/1000 : toTimestamp/1000
activityController.setFilterTime(startTimestamp, endTimestamp) activityController.setFilterTime(startTimestamp, endTimestamp)
if (autoUpdateFilter) if (autoUpdateFilter && callUpdate)
activityController.updateFilter() activityController.updateFilter()
} }
@ -259,7 +259,7 @@ QtObject {
} }
function applyAllFilters() { function applyAllFilters() {
applyTimeRange() applyTimeRange(false)
activityController.setFilterType(JSON.stringify(typeFilters)) activityController.setFilterType(JSON.stringify(typeFilters))
activityController.setFilterStatus(JSON.stringify(statusFilters)) activityController.setFilterStatus(JSON.stringify(statusFilters))
activityController.setFilterAssets(JSON.stringify(tokensFilter), false) activityController.setFilterAssets(JSON.stringify(tokensFilter), false)

View File

@ -112,6 +112,7 @@ ColumnLayout {
visible: d.isInitialLoading || transactionListRoot.count > 0 || WalletStores.RootStore.currentActivityFiltersStore.filtersSet visible: d.isInitialLoading || transactionListRoot.count > 0 || WalletStores.RootStore.currentActivityFiltersStore.filtersSet
activityFilterStore: WalletStores.RootStore.currentActivityFiltersStore activityFilterStore: WalletStores.RootStore.currentActivityFiltersStore
store: WalletStores.RootStore store: WalletStores.RootStore
hideNoResults: newTransactions.visible
isLoading: d.isInitialLoading isLoading: d.isInitialLoading
} }
} }
@ -277,6 +278,12 @@ ColumnLayout {
function onNewDataAvailableChanged() { function onNewDataAvailableChanged() {
if (!d.lastRefreshTime || ((Date.now() - d.lastRefreshTime) > (1000 * d.maxSecondsBetweenRefresh))) { 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 newTransactions.visible = RootStore.newDataAvailable
return return
} }