status-desktop/ui/app/AppLayouts/Wallet/views/CollectiblesView.qml

109 lines
3.1 KiB
QML
Raw Normal View History

2020-06-17 19:18:31 +00:00
import QtQuick 2.13
import QtQuick.Controls 2.13
2020-08-18 18:46:11 +00:00
import QtGraphicalEffects 1.13
import StatusQ.Core 0.1
import StatusQ.Components 0.1
import utils 1.0
import shared 1.0
import shared.panels 1.0
import "../stores"
import "../popups"
import "collectibles"
2020-05-28 14:54:42 +00:00
Item {
2020-08-18 18:46:11 +00:00
id: root
width: parent.width
signal collectibleClicked(string collectionSlug, int collectibleId)
2020-07-28 18:19:46 +00:00
Loader {
id: contentLoader
width: parent.width
height: parent.height
sourceComponent: {
if (!RootStore.collections.collectionsLoaded)
{
return loading
} else if (RootStore.collections.count === 0) {
return empty;
}
return loaded;
}
}
Component {
id: loading
Item {
id: loadingIndicator
height: 164
StatusLoadingIndicator {
width: 20
height: 20
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
}
}
}
Component {
id: empty
Item {
StyledText {
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
color: Style.current.secondaryText
text: qsTr("Collectibles will appear here")
font.pixelSize: 15
}
}
}
2020-08-18 18:46:11 +00:00
Component {
id: loaded
StatusScrollView {
id: scrollView
Column {
id: collectiblesSection
width: root.width
Repeater {
objectName: "collectionsRepeater"
id: collectionsRepeater
model: RootStore.collections
delegate: StatusExpandableItem {
id: collectionDelegate
anchors.left: parent.left
anchors.right: parent.right
primaryText: model.name
asset.name: model.imageUrl
asset.isImage: true
type: StatusExpandableItem.Type.Secondary
expandableComponent: CollectibleCollectionView {
collectionImageUrl: model.imageUrl
collectiblesLoaded: model.collectiblesLoaded
collectiblesModel: model.collectiblesModel
anchors.left: parent.left
anchors.right: parent.right
onCollectibleClicked: {
RootStore.selectCollectible(model.slug, collectibleId)
root.collectibleClicked(model.slug, collectibleId);
}
}
2022-04-12 11:46:21 +00:00
onExpandedChanged: {
if(expanded) {
RootStore.fetchCollectibles(model.slug)
2022-04-12 11:46:21 +00:00
}
}
}
}
}
2020-08-18 18:46:11 +00:00
}
2020-07-28 18:19:46 +00:00
}
2020-05-28 14:54:42 +00:00
}