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
|
2021-09-28 15:04:06 +00:00
|
|
|
|
2022-07-13 12:29:38 +00:00
|
|
|
import StatusQ.Core 0.1
|
2023-01-20 00:44:35 +00:00
|
|
|
import StatusQ.Core.Theme 0.1
|
2022-07-13 12:29:38 +00:00
|
|
|
import StatusQ.Components 0.1
|
2023-01-31 10:49:07 +00:00
|
|
|
|
2021-10-27 21:27:49 +00:00
|
|
|
import shared.panels 1.0
|
2023-01-31 10:49:07 +00:00
|
|
|
import utils 1.0
|
2021-10-21 08:22:05 +00:00
|
|
|
|
|
|
|
import "collectibles"
|
|
|
|
|
2020-05-28 14:54:42 +00:00
|
|
|
Item {
|
2020-08-18 18:46:11 +00:00
|
|
|
id: root
|
2023-01-20 00:44:35 +00:00
|
|
|
property var collectiblesModel
|
2021-10-21 08:22:05 +00:00
|
|
|
width: parent.width
|
2023-01-20 00:44:35 +00:00
|
|
|
|
2022-12-16 12:05:19 +00:00
|
|
|
signal collectibleClicked(string collectionSlug, int collectibleId)
|
2020-07-28 18:19:46 +00:00
|
|
|
|
2023-01-20 00:44:35 +00:00
|
|
|
readonly property bool areCollectionsLoaded: root.collectiblesModel.collectionsLoaded
|
|
|
|
|
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: {
|
2023-01-31 10:49:07 +00:00
|
|
|
if (root.areCollectionsLoaded && root.collectiblesModel.collectionCount === 0)
|
2021-10-21 08:22:05 +00:00
|
|
|
return empty;
|
|
|
|
return loaded;
|
|
|
|
}
|
2020-08-19 15:58:25 +00:00
|
|
|
}
|
|
|
|
|
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
|
2023-01-20 00:44:35 +00:00
|
|
|
StatusGridView {
|
|
|
|
id: gridView
|
|
|
|
anchors.fill: parent
|
2023-01-31 10:49:07 +00:00
|
|
|
model: root.areCollectionsLoaded ? root.collectiblesModel : Constants.dummyModelItems
|
2023-01-20 00:44:35 +00:00
|
|
|
cellHeight: 229
|
|
|
|
cellWidth: 176
|
2023-01-31 10:49:07 +00:00
|
|
|
delegate: CollectibleView {
|
2023-01-20 00:44:35 +00:00
|
|
|
height: gridView.cellHeight
|
|
|
|
width: gridView.cellWidth
|
2023-01-31 10:49:07 +00:00
|
|
|
collectibleModel: root.areCollectionsLoaded ? model : undefined
|
|
|
|
isLoadingDelegate: !root.areCollectionsLoaded
|
|
|
|
onCollectibleClicked: {
|
|
|
|
root.collectibleClicked(slug, collectibleId);
|
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
|
|
|
}
|