feat(CommunityPermissions): search for collectibles dropdown

Closes: #7158
This commit is contained in:
Michał Cieślak 2022-12-06 15:45:07 +01:00 committed by Michał
parent 7234e49fee
commit 9dcaf86e42
1 changed files with 78 additions and 14 deletions

View File

@ -7,8 +7,11 @@ import StatusQ.Core.Theme 0.1
import StatusQ.Popups 0.1 import StatusQ.Popups 0.1
import StatusQ.Core 0.1 import StatusQ.Core 0.1
import shared.controls 1.0
import shared.panels 1.0 import shared.panels 1.0
import SortFilterProxyModel 0.2
Item { Item {
id: root id: root
@ -44,6 +47,19 @@ Item {
property string currentItemName: "" property string currentItemName: ""
property url currentItemSource: "" property url currentItemSource: ""
readonly property SortFilterProxyModel filtered: SortFilterProxyModel {
id: collectiblesFilteredModel
sourceModel: root.store.collectiblesModel
filters: ExpressionFilter {
expression: {
searcher.text
return name.toLowerCase().includes(searcher.text.toLowerCase())
}
}
}
function reset() { function reset() {
d.currentItemName = "" d.currentItemName = ""
d.currentItemSource = "" d.currentItemSource = ""
@ -55,23 +71,50 @@ Item {
state: d.listView_depth1_State state: d.listView_depth1_State
states: [ states: [
State {
name: d.thumbnailsViewState
PropertyChanges {target: contentLoader; sourceComponent: thumbnailsView}
PropertyChanges {target: d; isFilterOptionVisible: true}
PropertyChanges {target: d; currentModel: d.currentSubitems}
},
State { State {
name: d.listView_depth1_State name: d.listView_depth1_State
PropertyChanges {target: contentLoader; sourceComponent: root.type === ExtendedDropdownContent.Type.Tokens ? tokensListView : collectiblesListView}
PropertyChanges {target: d; isFilterOptionVisible: false} PropertyChanges {
PropertyChanges {target: d; currentModel: root.type === ExtendedDropdownContent.Type.Tokens ? root.store.tokensModel : root.store.collectiblesModel} target: contentLoader
sourceComponent: root.type === ExtendedDropdownContent.Type.Tokens
? tokensListView : collectiblesListView
}
PropertyChanges {
target: d
currentModel: root.type === ExtendedDropdownContent.Type.Tokens
? root.store.tokensModel : collectiblesFilteredModel//root.store.collectiblesModel
isFilterOptionVisible: false
}
PropertyChanges {
target: searcher
visible: type === ExtendedDropdownContent.Type.Collectibles
}
}, },
State { State {
name: d.listView_depth2_State name: d.listView_depth2_State
PropertyChanges {target: contentLoader; sourceComponent: collectiblesListView}
PropertyChanges {target: d; isFilterOptionVisible: true } PropertyChanges {
PropertyChanges {target: d; currentModel: d.currentSubitems} target: contentLoader
sourceComponent: collectiblesListView
}
PropertyChanges {
target: d
currentModel: d.currentSubitems
isFilterOptionVisible: true
}
},
State {
name: d.thumbnailsViewState
PropertyChanges {
target: contentLoader
sourceComponent: thumbnailsView
}
PropertyChanges {
target: d
currentModel: d.currentSubitems
isFilterOptionVisible: true
}
} }
] ]
@ -188,10 +231,29 @@ Item {
} }
// List elements content // List elements content
Loader {
id: contentLoader
ColumnLayout {
anchors.fill: parent anchors.fill: parent
SearchBox {
id: searcher
Layout.fillWidth: true
visible: false
topPadding: 0
bottomPadding: 0
minimumHeight: 36
maximumHeight: 36
}
Loader {
id: contentLoader
Layout.fillWidth: true
Layout.fillHeight: true
}
} }
Component { Component {
@ -219,7 +281,9 @@ Item {
headerModel: ListModel { headerModel: ListModel {
ListElement { key: "MINT"; icon: "add"; iconSize: 16; description: qsTr("Mint collectible"); rotation: 0; spacing: 8 } ListElement { key: "MINT"; icon: "add"; iconSize: 16; description: qsTr("Mint collectible"); rotation: 0; spacing: 8 }
} }
model: d.currentModel model: d.currentModel
onHeaderItemClicked: { onHeaderItemClicked: {
if(key === "MINT") console.log("TODO: Mint collectible") if(key === "MINT") console.log("TODO: Mint collectible")
} }