2020-06-17 19:18:31 +00:00
|
|
|
import QtQuick 2.13
|
2021-10-21 08:22:05 +00:00
|
|
|
import QtQuick.Controls 2.13
|
2020-08-18 18:46:11 +00:00
|
|
|
import QtGraphicalEffects 1.13
|
2021-09-28 15:04:06 +00:00
|
|
|
|
2022-07-13 12:29:38 +00:00
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
|
2021-09-28 15:04:06 +00:00
|
|
|
import utils 1.0
|
2021-10-27 21:27:49 +00:00
|
|
|
import shared 1.0
|
|
|
|
import shared.panels 1.0
|
2021-10-21 08:22:05 +00:00
|
|
|
|
2021-10-05 20:50:22 +00:00
|
|
|
import "../stores"
|
2021-10-21 08:22:05 +00:00
|
|
|
import "../popups"
|
|
|
|
import "collectibles"
|
|
|
|
|
2020-05-28 14:54:42 +00:00
|
|
|
Item {
|
2020-08-18 18:46:11 +00:00
|
|
|
id: root
|
2021-10-21 08:22:05 +00:00
|
|
|
width: parent.width
|
2022-12-16 12:05:19 +00:00
|
|
|
signal collectibleClicked(string collectionSlug, int collectibleId)
|
2020-07-28 18:19:46 +00:00
|
|
|
|
2021-10-21 08:22:05 +00:00
|
|
|
Loader {
|
|
|
|
id: contentLoader
|
|
|
|
width: parent.width
|
|
|
|
height: parent.height
|
2020-07-30 20:46:25 +00:00
|
|
|
|
2021-10-21 08:22:05 +00:00
|
|
|
sourceComponent: {
|
2022-12-16 12:05:19 +00:00
|
|
|
if (!RootStore.collections.collectionsLoaded)
|
|
|
|
{
|
|
|
|
return loading
|
|
|
|
} else if (RootStore.collections.count === 0) {
|
2021-10-21 08:22:05 +00:00
|
|
|
return empty;
|
|
|
|
}
|
|
|
|
return loaded;
|
|
|
|
}
|
2020-08-19 15:58:25 +00:00
|
|
|
}
|
|
|
|
|
2022-12-16 12:05:19 +00:00
|
|
|
Component {
|
|
|
|
id: loading
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: loadingIndicator
|
|
|
|
height: 164
|
|
|
|
StatusLoadingIndicator {
|
|
|
|
width: 20
|
|
|
|
height: 20
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-21 08:22:05 +00:00
|
|
|
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-20 21:59:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-08-18 18:46:11 +00:00
|
|
|
|
2021-10-21 08:22:05 +00:00
|
|
|
Component {
|
|
|
|
id: loaded
|
2020-08-19 17:07:07 +00:00
|
|
|
|
2022-07-13 12:29:38 +00:00
|
|
|
StatusScrollView {
|
2021-10-21 08:22:05 +00:00
|
|
|
id: scrollView
|
2020-08-19 17:07:07 +00:00
|
|
|
|
2021-10-21 08:22:05 +00:00
|
|
|
Column {
|
|
|
|
id: collectiblesSection
|
|
|
|
width: root.width
|
2020-08-19 17:07:07 +00:00
|
|
|
|
2021-10-21 08:22:05 +00:00
|
|
|
Repeater {
|
2022-08-10 14:26:29 +00:00
|
|
|
objectName: "collectionsRepeater"
|
2021-10-21 08:22:05 +00:00
|
|
|
id: collectionsRepeater
|
2022-12-16 12:05:19 +00:00
|
|
|
model: RootStore.collections
|
2021-10-21 08:22:05 +00:00
|
|
|
delegate: StatusExpandableItem {
|
2022-12-16 12:05:19 +00:00
|
|
|
id: collectionDelegate
|
2021-11-02 12:57:52 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
2021-10-21 08:22:05 +00:00
|
|
|
primaryText: model.name
|
2022-08-11 11:55:08 +00:00
|
|
|
asset.name: model.imageUrl
|
|
|
|
asset.isImage: true
|
2021-10-21 08:22:05 +00:00
|
|
|
type: StatusExpandableItem.Type.Secondary
|
|
|
|
expandableComponent: CollectibleCollectionView {
|
2022-07-28 20:56:44 +00:00
|
|
|
collectionImageUrl: model.imageUrl
|
2022-12-16 12:05:19 +00:00
|
|
|
collectiblesLoaded: model.collectiblesLoaded
|
|
|
|
collectiblesModel: model.collectiblesModel
|
2021-10-21 08:22:05 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
onCollectibleClicked: {
|
2022-12-16 12:05:19 +00:00
|
|
|
RootStore.selectCollectible(model.slug, collectibleId)
|
|
|
|
root.collectibleClicked(model.slug, collectibleId);
|
2021-10-21 08:22:05 +00:00
|
|
|
}
|
|
|
|
}
|
2022-04-12 11:46:21 +00:00
|
|
|
onExpandedChanged: {
|
|
|
|
if(expanded) {
|
2022-12-16 12:05:19 +00:00
|
|
|
RootStore.fetchCollectibles(model.slug)
|
2022-04-12 11:46:21 +00:00
|
|
|
}
|
|
|
|
}
|
2021-10-21 08:22:05 +00:00
|
|
|
}
|
2021-10-05 20:50:22 +00:00
|
|
|
}
|
2020-08-19 15:58:25 +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
|
|
|
}
|