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