fix(wallet)_: disable Sort by Date option when timestamps are not ready
- Disable 'Sort by Date' when timestamps are incomplete. - Default to 'Alphabetical' sort if date is unavailable. fixes: #13630 Update status-go submodule to latest commit on develop
This commit is contained in:
parent
1834581821
commit
60e0e212b2
|
@ -58,6 +58,26 @@ ColumnLayout {
|
|||
readonly property var sourceModel: root.controller.sourceModel
|
||||
readonly property bool isLoading: root.isUpdating || root.isFetching
|
||||
|
||||
function setSortByDateIsDisabled(value) {
|
||||
const orderByDateIndex = cmbTokenOrder.indexOfValue(SortOrderComboBox.TokenOrderDateAdded)
|
||||
|
||||
cmbTokenOrder.model[orderByDateIndex].isDisabled = value
|
||||
cmbTokenOrder.modelChanged()
|
||||
|
||||
if (!value && cmbTokenOrder.currentIndex === orderByDateIndex) {
|
||||
cmbTokenOrder.indexOfValue(SortOrderComboBox.TokenOrderAlpha)
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
settings.sync()
|
||||
if (settings.currentSortValue === SortOrderComboBox.TokenOrderDateAdded && !d.hasAllTimestampsAggregator.value) {
|
||||
cmbTokenOrder.currentIndex = cmbTokenOrder.indexOfValue(SortOrderComboBox.TokenOrderAlpha) // Change to a different default option
|
||||
} else {
|
||||
cmbTokenOrder.currentIndex = cmbTokenOrder.indexOfValue(settings.currentSortValue) // Change to a different default option
|
||||
}
|
||||
}
|
||||
|
||||
onIsLoadingChanged: {
|
||||
d.loadingItemsModel.refresh()
|
||||
}
|
||||
|
@ -115,6 +135,21 @@ ColumnLayout {
|
|||
markerRoleName: "sourceGroup"
|
||||
}
|
||||
|
||||
readonly property var allCollectiblesModel: ConcatModel {
|
||||
sources: [
|
||||
SourceModel {
|
||||
model: d.communityModel
|
||||
markerRoleValue: "loadingItemsModel"
|
||||
},
|
||||
SourceModel {
|
||||
model: d.nonCommunityModel
|
||||
markerRoleValue: "nonCommunityModel"
|
||||
}
|
||||
]
|
||||
markerRoleName: "sourceGroup"
|
||||
}
|
||||
|
||||
|
||||
readonly property bool hasRegularCollectibles: d.nonCommunityModel.count || d.loadingItemsModel.count
|
||||
readonly property bool hasCommunityCollectibles: d.communityModel.count || d.loadingItemsModel.count
|
||||
readonly property bool onlyRegularCollectiblesType: hasRegularCollectibles && !hasCommunityCollectibles
|
||||
|
@ -160,6 +195,18 @@ ColumnLayout {
|
|||
}
|
||||
return AmountsArithmetic.toNumber(balance)
|
||||
}
|
||||
|
||||
property FunctionAggregator hasAllTimestampsAggregator: FunctionAggregator {
|
||||
model: d.allCollectiblesModel
|
||||
initialValue: true
|
||||
roleName: "lastTxTimestamp"
|
||||
|
||||
aggregateFunction: (aggr, value) => aggr && !!value
|
||||
|
||||
onValueChanged: {
|
||||
d.setSortByDateIsDisabled(value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
component CustomSFPM: SortFilterProxyModel {
|
||||
|
@ -246,11 +293,6 @@ ColumnLayout {
|
|||
property alias selectedFilterGroupIds: cmbFilter.selectedFilterGroupIds
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
settings.sync()
|
||||
cmbTokenOrder.currentIndex = cmbTokenOrder.indexOfValue(settings.currentSortValue)
|
||||
}
|
||||
|
||||
Component.onDestruction: {
|
||||
settings.currentSortValue = cmbTokenOrder.currentValue
|
||||
}
|
||||
|
@ -299,7 +341,7 @@ ColumnLayout {
|
|||
id: cmbTokenOrder
|
||||
hasCustomOrderDefined: root.controller.hasSettings
|
||||
model: [
|
||||
{ value: SortOrderComboBox.TokenOrderDateAdded, text: qsTr("Date added"), icon: "", sortRoleName: "lastTxTimestamp" }, // Custom SFPM role
|
||||
{ value: SortOrderComboBox.TokenOrderDateAdded, text: qsTr("Date added"), icon: "", sortRoleName: "lastTxTimestamp", isDisabled: !d.hasAllTimestampsAggregator.value }, // Custom SFPM role
|
||||
{ value: SortOrderComboBox.TokenOrderAlpha, text: qsTr("Collectible name"), icon: "", sortRoleName: "name" },
|
||||
{ value: SortOrderComboBox.TokenOrderGroupName, text: qsTr("Collection/community name"), icon: "", sortRoleName: "groupName" }, // Custom SFPM role communityName || collectionName
|
||||
{ value: SortOrderComboBox.TokenOrderCustom, text: qsTr("Custom order"), icon: "", sortRoleName: "" },
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit f98c411b32ddbc4e4c4873a93e5df12680b03aea
|
||||
Subproject commit 1e0a24f1b8f963e3ec8f007316a01d83d0d8ad5c
|
Loading…
Reference in New Issue