fix(wallet): Filter collectibles filter options (#16125)
This commit is contained in:
parent
3bef20401f
commit
224dd5e58d
|
@ -494,9 +494,13 @@ void ManageTokensController::rebuildCommunityTokenGroupsModel()
|
||||||
if (!communityIds.contains(communityId)) { // insert into groups
|
if (!communityIds.contains(communityId)) { // insert into groups
|
||||||
communityIds.append(communityId);
|
communityIds.append(communityId);
|
||||||
|
|
||||||
|
const auto collectionName =
|
||||||
|
!communityToken.collectionName.isEmpty() ? communityToken.collectionName : communityToken.name;
|
||||||
|
|
||||||
TokenData tokenGroup;
|
TokenData tokenGroup;
|
||||||
tokenGroup.symbol = communityId;
|
tokenGroup.symbol = communityId;
|
||||||
tokenGroup.communityId = communityId;
|
tokenGroup.communityId = communityId;
|
||||||
|
tokenGroup.collectionName = collectionName;
|
||||||
tokenGroup.communityName = communityToken.communityName;
|
tokenGroup.communityName = communityToken.communityName;
|
||||||
tokenGroup.communityImage = communityToken.communityImage;
|
tokenGroup.communityImage = communityToken.communityImage;
|
||||||
tokenGroup.backgroundColor = communityToken.backgroundColor;
|
tokenGroup.backgroundColor = communityToken.backgroundColor;
|
||||||
|
@ -551,9 +555,13 @@ void ManageTokensController::rebuildHiddenCommunityTokenGroupsModel()
|
||||||
m_hiddenCommunityGroups.contains(communityId)) { // insert into groups
|
m_hiddenCommunityGroups.contains(communityId)) { // insert into groups
|
||||||
communityIds.append(communityId);
|
communityIds.append(communityId);
|
||||||
|
|
||||||
|
const auto collectionName =
|
||||||
|
!communityToken.collectionName.isEmpty() ? communityToken.collectionName : communityToken.name;
|
||||||
|
|
||||||
TokenData tokenGroup;
|
TokenData tokenGroup;
|
||||||
tokenGroup.symbol = communityId;
|
tokenGroup.symbol = communityId;
|
||||||
tokenGroup.communityId = communityId;
|
tokenGroup.communityId = communityId;
|
||||||
|
tokenGroup.collectionName = collectionName;
|
||||||
tokenGroup.communityName = communityToken.communityName;
|
tokenGroup.communityName = communityToken.communityName;
|
||||||
tokenGroup.communityImage = communityToken.communityImage;
|
tokenGroup.communityImage = communityToken.communityImage;
|
||||||
tokenGroup.backgroundColor = communityToken.backgroundColor;
|
tokenGroup.backgroundColor = communityToken.backgroundColor;
|
||||||
|
|
|
@ -5,6 +5,7 @@ import QtGraphicalEffects 1.15
|
||||||
|
|
||||||
import StatusQ 0.1
|
import StatusQ 0.1
|
||||||
import StatusQ.Core 0.1
|
import StatusQ.Core 0.1
|
||||||
|
import StatusQ.Core.Utils 0.1 as SQUtils
|
||||||
import StatusQ.Controls 0.1
|
import StatusQ.Controls 0.1
|
||||||
import StatusQ.Components 0.1
|
import StatusQ.Components 0.1
|
||||||
import StatusQ.Components.private 0.1 as SQP
|
import StatusQ.Components.private 0.1 as SQP
|
||||||
|
@ -19,6 +20,7 @@ import SortFilterProxyModel 0.2
|
||||||
ComboBox {
|
ComboBox {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
required property var sourceModel // filtered source model
|
||||||
required property var regularTokensModel // "uncategorized" collectibles (not grouped)
|
required property var regularTokensModel // "uncategorized" collectibles (not grouped)
|
||||||
required property var collectionGroupsModel // collection groups
|
required property var collectionGroupsModel // collection groups
|
||||||
required property var communityTokenGroupsModel // community groups
|
required property var communityTokenGroupsModel // community groups
|
||||||
|
@ -51,6 +53,10 @@ ComboBox {
|
||||||
|
|
||||||
readonly property string searchTextLowerCase: searchBox.input.text.toLowerCase()
|
readonly property string searchTextLowerCase: searchBox.input.text.toLowerCase()
|
||||||
|
|
||||||
|
readonly property SQUtils.ModelChangeTracker sourceModelTracker: SQUtils.ModelChangeTracker {
|
||||||
|
model: root.sourceModel
|
||||||
|
}
|
||||||
|
|
||||||
readonly property var combinedModel: ConcatModel {
|
readonly property var combinedModel: ConcatModel {
|
||||||
sources: [
|
sources: [
|
||||||
SourceModel {
|
SourceModel {
|
||||||
|
@ -68,18 +74,34 @@ ComboBox {
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly property var combinedProxyModel: SortFilterProxyModel {
|
readonly property var combinedProxyModel: SortFilterProxyModel {
|
||||||
|
id: combinedProxyModel
|
||||||
sourceModel: d.combinedModel
|
sourceModel: d.combinedModel
|
||||||
|
readonly property var containsCollectible: (groupId) => SQUtils.ModelUtils.indexOf(root.sourceModel, "communityId", groupId) >= 0
|
||||||
|
|| SQUtils.ModelUtils.indexOf(root.sourceModel, "collectionUid", groupId) >= 0
|
||||||
proxyRoles: [
|
proxyRoles: [
|
||||||
JoinRole {
|
FastExpressionRole {
|
||||||
name: "groupName"
|
name: "groupName"
|
||||||
roleNames: ["collectionName", "communityName"]
|
expression: {
|
||||||
separator: ""
|
if (!!model.communityId) {
|
||||||
|
if (model.communityName === model.communityId && !!model.collectionName)
|
||||||
|
return model.collectionName
|
||||||
|
return model.communityName
|
||||||
|
}
|
||||||
|
return model.collectionName
|
||||||
|
}
|
||||||
|
expectedRoles: ["communityId", "collectionName", "communityName"]
|
||||||
|
},
|
||||||
|
FastExpressionRole {
|
||||||
|
name: "groupKey"
|
||||||
|
expression: !!model.communityId ? model.communityName : model.collectionName
|
||||||
|
expectedRoles: ["communityId", "collectionName", "communityName"]
|
||||||
},
|
},
|
||||||
JoinRole {
|
JoinRole {
|
||||||
name: "groupId"
|
name: "groupId"
|
||||||
roleNames: ["collectionUid", "communityId"]
|
roleNames: ["collectionUid", "communityId"]
|
||||||
separator: ""
|
separator: ""
|
||||||
}
|
}
|
||||||
|
|
||||||
]
|
]
|
||||||
filters: [
|
filters: [
|
||||||
FastExpressionFilter {
|
FastExpressionFilter {
|
||||||
|
@ -87,8 +109,9 @@ ComboBox {
|
||||||
expression: {
|
expression: {
|
||||||
d.searchTextLowerCase // ensure expression is reevaluated when searchString changes
|
d.searchTextLowerCase // ensure expression is reevaluated when searchString changes
|
||||||
return model.groupName.toLowerCase().includes(d.searchTextLowerCase) || model.groupId.toLowerCase().includes(d.searchTextLowerCase)
|
return model.groupName.toLowerCase().includes(d.searchTextLowerCase) || model.groupId.toLowerCase().includes(d.searchTextLowerCase)
|
||||||
|
|| model.groupKey.toLowerCase().includes(d.searchTextLowerCase)
|
||||||
}
|
}
|
||||||
expectedRoles: ["groupName", "groupId"]
|
expectedRoles: ["groupName", "groupId", "groupKey"]
|
||||||
},
|
},
|
||||||
FastExpressionFilter {
|
FastExpressionFilter {
|
||||||
expression: {
|
expression: {
|
||||||
|
@ -97,6 +120,13 @@ ComboBox {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
expectedRoles: ["sourceGroup", "isSelfCollection"]
|
expectedRoles: ["sourceGroup", "isSelfCollection"]
|
||||||
|
},
|
||||||
|
FastExpressionFilter {
|
||||||
|
expression: {
|
||||||
|
d.sourceModelTracker.revision
|
||||||
|
return combinedProxyModel.containsCollectible(model.groupId)
|
||||||
|
}
|
||||||
|
expectedRoles: ["groupId"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -234,9 +234,10 @@ ColumnLayout {
|
||||||
|
|
||||||
sourceModel: d.sourceModel
|
sourceModel: d.sourceModel
|
||||||
proxyRoles: [
|
proxyRoles: [
|
||||||
JoinRole {
|
FastExpressionRole {
|
||||||
name: "groupName"
|
name: "groupName"
|
||||||
roleNames: ["collectionName", "communityName"]
|
expression: !!model.communityId ? model.communityName : model.collectionName
|
||||||
|
expectedRoles: ["communityId", "collectionName", "communityName"]
|
||||||
},
|
},
|
||||||
FastExpressionRole {
|
FastExpressionRole {
|
||||||
name: "balance"
|
name: "balance"
|
||||||
|
@ -306,7 +307,7 @@ ColumnLayout {
|
||||||
|
|
||||||
Settings {
|
Settings {
|
||||||
id: settings
|
id: settings
|
||||||
category: "CollectiblesViewSortSettings"
|
category: "CollectiblesViewSortSettings-" + root.addressFilters
|
||||||
property int currentSortValue: SortOrderComboBox.TokenOrderDateAdded
|
property int currentSortValue: SortOrderComboBox.TokenOrderDateAdded
|
||||||
property alias currentSortOrder: cmbTokenOrder.currentSortOrder
|
property alias currentSortOrder: cmbTokenOrder.currentSortOrder
|
||||||
property alias selectedFilterGroupIds: cmbFilter.selectedFilterGroupIds
|
property alias selectedFilterGroupIds: cmbFilter.selectedFilterGroupIds
|
||||||
|
@ -336,6 +337,33 @@ ColumnLayout {
|
||||||
|
|
||||||
FilterComboBox {
|
FilterComboBox {
|
||||||
id: cmbFilter
|
id: cmbFilter
|
||||||
|
sourceModel: SortFilterProxyModel {
|
||||||
|
sourceModel: d.sourceModel
|
||||||
|
proxyRoles: [
|
||||||
|
FastExpressionRole {
|
||||||
|
name: "balance"
|
||||||
|
expression: {
|
||||||
|
d.addrFilters
|
||||||
|
return d.getBalance(model.ownership, d.addrFilters)
|
||||||
|
}
|
||||||
|
expectedRoles: ["ownership"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
filters: [
|
||||||
|
FastExpressionFilter {
|
||||||
|
expression: {
|
||||||
|
return d.nwFilters.includes(model.chainId+"")
|
||||||
|
}
|
||||||
|
expectedRoles: ["chainId"]
|
||||||
|
},
|
||||||
|
ValueFilter {
|
||||||
|
roleName: "balance"
|
||||||
|
value: 0
|
||||||
|
inverted: true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
regularTokensModel: root.controller.regularTokensModel
|
regularTokensModel: root.controller.regularTokensModel
|
||||||
collectionGroupsModel: root.controller.collectionGroupsModel
|
collectionGroupsModel: root.controller.collectionGroupsModel
|
||||||
communityTokenGroupsModel: root.controller.communityTokenGroupsModel
|
communityTokenGroupsModel: root.controller.communityTokenGroupsModel
|
||||||
|
|
Loading…
Reference in New Issue