Skip to content

Commit

Permalink
bug(@desktop/wallet): Fix new transaction button visuals
Browse files Browse the repository at this point in the history
* Fixed duplicated wallet activity fetch request
* Fixed not resetting tab on wallet account add
  • Loading branch information
Cuteivist committed Oct 31, 2023
1 parent 7de6eaa commit 9ed1509
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
1 change: 1 addition & 0 deletions ui/app/AppLayouts/Wallet/WalletLayout.qml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ Item {
root.resetView()
RootStore.setFillterAllAddresses()
}
onCurrentAddressChanged: root.resetView()
onShowSavedAddressesChanged: {
if(showSavedAddresses)
rightPanelStackView.replace(cmpSavedAddresses)
Expand Down
6 changes: 4 additions & 2 deletions ui/app/AppLayouts/Wallet/panels/ActivityFilterPanel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Column {
property var activityFilterStore
property var store
property bool isLoading: false
property bool hideNoResults: false

spacing: 12

Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions ui/app/AppLayouts/Wallet/stores/ActivityFiltersStore.qml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ QtObject {
property var transactionsList: walletSection.activityController.model

property bool autoUpdateFilter: true
property var activityController: walletSection.activityController
property bool filtersSet: selectedTime !== Constants.TransactionTimePeriod.All ||
readonly property var activityController: walletSection.activityController
readonly property bool filtersSet: selectedTime !== Constants.TransactionTimePeriod.All ||
typeFilters.length !== 0 ||
statusFilters.length !== 0 ||
tokensFilter.length !== 0 ||
Expand Down Expand Up @@ -146,15 +146,15 @@ QtObject {
applyTimeRange()
}

function applyTimeRange() {
function applyTimeRange(callUpdate = true) {
const startTimestamp = d.fromTimestampNoLimit
? activityController.noLimitTimestamp
: fromTimestamp/1000
const endTimestamp = d.toTimestampNoLimit
? activityController.noLimitTimestamp
: toTimestamp/1000
activityController.setFilterTime(startTimestamp, endTimestamp)
if (autoUpdateFilter)
if (autoUpdateFilter && callUpdate)
activityController.updateFilter()
}

Expand Down Expand Up @@ -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)
Expand Down
7 changes: 7 additions & 0 deletions ui/imports/shared/views/HistoryView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 9ed1509

Please sign in to comment.